summaryrefslogtreecommitdiffstats
path: root/media/crypto
Commit message (Collapse)AuthorAgeFilesLines
* Add RegisterKeyAddedCB in Decryptor interface.xhwang@chromium.org2012-11-022-8/+30
| | | | | | | | | | | Previously KeyAddedCB is registered with InitializeXXXDecoder calls. Generalize this to a separate RegisterKeyAddedCB call so that we can also support the decrypt-only path. BUG=123421 TEST=media_unittests passes. EME demo page still works. Review URL: https://chromiumcodereview.appspot.com/11348056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165792 0039d316-1c4b-4281-b951-d872f2087c98
* Add "type" in GenerateKeyRequest() and OnNeedKey().xhwang@chromium.org2012-10-273-3/+6
| | | | | | | | | | | | | | The "type" information could help the CDM to parse the initialization data correctly. See for details: https://www.w3.org/Bugs/Public/show_bug.cgi?id=19096 TBR=viettrungluu@chromium.org BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/11313016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164522 0039d316-1c4b-4281-b951-d872f2087c98
* Update Decryptor interface to support audio decoding.xhwang@chromium.org2012-10-183-18/+38
| | | | | | | | | | | | | | | | | | | | | | | | We were discussing the use of decryptor_->DeinitializeDecoder(Decryptor::kVideo); - vs - decryptor_->DeinitializeVideoDecoder(); I choose to use parameterized methods so that we have less code (duplication). The non-parameterized methods are cleaner for callers. But I feel the former is slightly better in general. Later on we'll have two Decryptors (ProxyDecryptor will not be a Decryptor anymore): 1) AesDecryptor, which doesn't care the stream type at all, not even for CancelDecrypt(). 2) PpapiDecryptor, which merely passes similar calls to the PluginInstance which then make similar PPP calls. It seems to me that for passing calls it's slightly cleaner to use parameterized methods. Also we have parameterized PPP calls already for the same reason (less functions through multiple layers). So in both cases, using parameterized methods results in less code. It's unfortunate that InitializeXXXDecoder and DecryptAndDecodeXXX are exceptions, due to different types they take/return. BUG=123421 TEST=media_unittest, content_unittest Review URL: https://chromiumcodereview.appspot.com/11144036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162768 0039d316-1c4b-4281-b951-d872f2087c98
* Change WebM parser to treat IVs from encrypted WebM as raw data.fgalligan@chromium.org2012-10-161-16/+12
| | | | | | | | | | | | The encrypted WebM spec RFC changed to treat IVs as raw data. BUG=155641 TEST=All media_unittests pass. TBR=sky Review URL: https://chromiumcodereview.appspot.com/11139008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162012 0039d316-1c4b-4281-b951-d872f2087c98
* Implement video decoding methods in all Decryptor implementations.xhwang@chromium.org2012-10-112-4/+3
| | | | | | | | | | BUG=141784 TEST=none Review URL: https://chromiumcodereview.appspot.com/11094006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161373 0039d316-1c4b-4281-b951-d872f2087c98
* Add decryptor requesting and kNoKey handling in DecryptingVideoDecoder (DVD).xhwang@chromium.org2012-10-102-2/+4
| | | | | | | | | | | | | | - These logic was previously implemented in ProxyDecryptor. Now add them into DVD so that the DVD can talk directly to other Decryptor implementations such as the PpapiDecryptor. - Since we have more states in DVD now, add more state enum to manage state transition. - Add RequestDecryptorNotificationCB for decryptor creation notification. - Add KeyAddedCB for notifying the DVD that new key has been added. BUG=141784 TEST=current unittests pass; added more unittests. Review URL: https://chromiumcodereview.appspot.com/11074010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161231 0039d316-1c4b-4281-b951-d872f2087c98
* Add video decoding methods in Decryptor and add DecryptingVideoDecoder.xhwang@chromium.org2012-10-042-0/+30
| | | | | | | | | | | | | | | In Decryptor interface, video decoding methods are added to support CDMs that support both decryption and video decoding. A new VideoDecoder, DecryptingVideoDecoder, is added to support video decoding by Decryptors in the media pipeline. DecryptingVideoDecoder uses adapter pattern to convert a Decryptor into a VideoDecoder. In AddDefaultDecodersToCollection, add a DecryptingVideoDecoder object into the video decoder list. BUG=141784 TEST=new tests added into media_unittest Review URL: https://chromiumcodereview.appspot.com/10969028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160183 0039d316-1c4b-4281-b951-d872f2087c98
* Call Decryptor::Stop() in FFmpegVideoDecoder::Reset().xhwang@chromium.org2012-09-252-2/+2
| | | | | | | | | | | | | To avoid freeze when user trying to seek() when a DecrptCB is pending. It also fix an issue that the stop_cb isn't fired when FFmpegVideoDecoder::Stop() is called when a DecryptCB is pending. BUG=151708 TEST=added new unittest to catch this Review URL: https://chromiumcodereview.appspot.com/10964055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158457 0039d316-1c4b-4281-b951-d872f2087c98
* We are removing checksum/HMAC in WebM spec for encrypted content.fgalligan@chromium.org2012-09-183-188/+89
| | | | | | | | | | | | | | | | | | | | xhwang's CL http://codereview.chromium.org/10918276 has been merged into this one. 10918276 CL updates the CDM interface, ClearKeyCdm, CdmWrapper and PPAPI code to reflect this change. - Remove checksum from DecryptConfig. - Remove HMAC from AesDecryptor. - Update AesDecryptorTest as all decrypts will not fail but the data checks will. - Remove FakeCheckSum from ffmpeg_video_decoder_unittest. - Remove HMAC from WebMClusterParser. - Remove checksum from ppapi_plugin_instance. BUG=150014 TEST=All media_unittests pass. TBR=dmichael Review URL: https://chromiumcodereview.appspot.com/10917308 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157322 0039d316-1c4b-4281-b951-d872f2087c98
* Add a bool return value to media::Decryptor::GenerateKeyRequest().xhwang@chromium.org2012-08-293-3/+5
| | | | | | | | | | | | Add a bool return value in media::Decryptor::GenerateKeyRequest() call and add code in WebMeidaPlayerImpl to check this value. If GenerateKeyRequest() fails, prevent further calls to AddKey() and CancelKeyRequest(). BUG=145322 TEST=Called AddKey() after GenerateKeyRequest() fails and no crash. Review URL: https://chromiumcodereview.appspot.com/10896014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153818 0039d316-1c4b-4281-b951-d872f2087c98
* Change Deryptor::DecryptStatus and VideoDecoder::DecoderStatus to *::Status.xhwang@chromium.org2012-08-071-1/+1
| | | | | | | | | | | | Previously this was not possible because it conflicts with a macro in x11. This has been fixed by acolwell@. Make this change now to be consistent with DemuxerStream::Status, AudioDecoder::Status, and SourceBufferStream::Status. BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/10825194 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150397 0039d316-1c4b-4281-b951-d872f2087c98
* Implement "Key Presence" step in "Encrypted Block Encounted" algorithm in EME.xhwang@chromium.org2012-08-033-2/+16
| | | | | | | | | | | | | | | See related spec here: http://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html#algorithms-enrypted-block If the AesDecryptor cannot find the decryption for the encrypted buffer, it returns a kNoKey. In ProxyDecryptor, if the input cannot be decrypted due to kNoKey, the ProxyDecryptor will cache the encrypted buffers and callbacks and fire a needkey event. When some key is added (AddKey called) later, it will try to decrypt these buffers again. The callbacks will be fired on the same thread where Decrypt() was called originally. BUG=125401, 125753 TEST=media_unittest, media layout_tests Review URL: https://chromiumcodereview.appspot.com/10822026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149952 0039d316-1c4b-4281-b951-d872f2087c98
* Add support for v0.3 of the encrypted WebM specification. (Revert Fix)fgalligan@chromium.org2012-08-022-96/+177
| | | | | | | | | | | | | | | | | | | | | | | | | - Fixed HmacCheckFailure from aes_decryptor_unittest.cc that was causing a failure on the ASAN bots. - Added code to handle the signal_byte contained within WebM encrypted Blocks. - Added a unittest to aes_decryptor to handle an encrypted WebM Block with an unencrypted frame. - Added two unittests to aes_decryptor to try an encrypted WebM frame as an unencrypted frame and an unencrypted WebM frame as an encrypted frame. Revert "Revert 149449 - Add support for v0.3 of the encrypted WebM specification." This reverts commit 672f667ed68e59ec0aaf5c40167e890673ef3f7c. BUG=139876 TEST=Run media_unittests --gtest_filter=AesDecryptor* and all tests must pass. media_unittests must pass on linux_asan and mac_asan. Review URL: https://chromiumcodereview.appspot.com/10824136 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149696 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 149449 - Add support for v0.3 of the encrypted WebM specification.vandebo@chromium.org2012-08-012-103/+54
| | | | | | | | | | | | | | | | | | | | | Asan didn't like this: http://build.chromium.org/p/chromium.memory/builders/Linux%20ASAN%20Tests%20%282%29/builds/414/steps/media_unittests/logs/stdio - Added code to handle the signal_byte contained within WebM encrypted Blocks. - Added a unittest to aes_decryptor to hanlde an encrypted WebM Block with an unencrypted frame. BUG=139876 TEST=Run media_unittests --gtest_filter=AesDecryptor* and all tests must pass. Review URL: https://chromiumcodereview.appspot.com/10823110 TBR=fgalligan@chromium.org Review URL: https://chromiumcodereview.appspot.com/10831115 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149457 0039d316-1c4b-4281-b951-d872f2087c98
* Add support for v0.3 of the encrypted WebM specification.fgalligan@chromium.org2012-08-012-54/+103
| | | | | | | | | | | | | | | | - Added code to handle the signal_byte contained within WebM encrypted Blocks. - Added a unittest to aes_decryptor to hanlde an encrypted WebM Block with an unencrypted frame. BUG=139876 TEST=Run media_unittests --gtest_filter=AesDecryptor* and all tests must pass. Review URL: https://chromiumcodereview.appspot.com/10823110 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149449 0039d316-1c4b-4281-b951-d872f2087c98
* Code clean-up in AesDecryptor and test.xhwang@chromium.org2012-07-303-135/+142
| | | | | | | | | | | | - Added GetKey() and SetKey() in AesDecryptor. - Moved static functions out of AesDecryptorTest to make them file scope functions. BUG=none TEST=media_unittests Review URL: https://chromiumcodereview.appspot.com/10822013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148984 0039d316-1c4b-4281-b951-d872f2087c98
* Add Common Encryption support to BMFF, including subsample decryption.strobe@google.com2012-07-263-148/+313
| | | | | | | | | | BUG=132351 TEST=AesDecryptorTest, plus manual playback in browser Review URL: https://chromiumcodereview.appspot.com/10651006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148453 0039d316-1c4b-4281-b951-d872f2087c98
* Replace memcmp() with HMAC.VerifyTruncated() in aes_decryptor.ccfgalligan@chromium.org2012-07-241-12/+13
| | | | | | | | | | BUG=138682 TEST=media_unittests --gtest_filter=AesDecryptor* Review URL: https://chromiumcodereview.appspot.com/10800091 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148240 0039d316-1c4b-4281-b951-d872f2087c98
* Add support for encrypted WebM files as defined in the RFC.fgalligan@chromium.org2012-07-203-98/+502
| | | | | | | | | | | | | | | | | | | The WebM parser now reads the HMAC and IV from every encrypted Block and stores that information in the DecryptorConfig object. Added two new elements ContentEncAESSettings and AESSettingsCipherMode used by encrypted WebM files. This is a new code review of https://chromiumcodereview.appspot.com/10535029/ patch set 17 after patch set 16 was reverted. BUG=119845 TEST=media_unittests Review URL: https://chromiumcodereview.appspot.com/10810026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147654 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 147169 - Add support for encrypted WebM files as defined in the RFC.jln@chromium.org2012-07-183-502/+98
| | | | | | | | | | | | | | | | | The WebM parser now reads the HMAC and IV from every encrypted Block and stores that information in the DecryptorConfig object. Added two new elements ContentEncAESSettings and AESSettingsCipherMode used by encrypted WebM files. BUG=119845 TEST=media_unittests --gtest_filter=HmacAesDecryptorTest Review URL: https://chromiumcodereview.appspot.com/10535029 TBR=fgalligan@chromium.org Review URL: https://chromiumcodereview.appspot.com/10807003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147172 0039d316-1c4b-4281-b951-d872f2087c98
* Add support for encrypted WebM files as defined in the RFC.fgalligan@chromium.org2012-07-183-98/+502
| | | | | | | | | | | | | | The WebM parser now reads the HMAC and IV from every encrypted Block and stores that information in the DecryptorConfig object. Added two new elements ContentEncAESSettings and AESSettingsCipherMode used by encrypted WebM files. BUG=119845 TEST=media_unittests --gtest_filter=HmacAesDecryptorTest Review URL: https://chromiumcodereview.appspot.com/10535029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147169 0039d316-1c4b-4281-b951-d872f2087c98
* Change AesDecryptor::Decrypt to be an asynchronous call.xhwang@chromium.org2012-07-153-19/+37
| | | | | | | | | | BUG=125401 TEST=media_tests, media layout tests. Review URL: https://chromiumcodereview.appspot.com/10561014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146748 0039d316-1c4b-4281-b951-d872f2087c98
* Add Decryptor interface.xhwang@chromium.org2012-06-194-102/+25
| | | | | | | | | | | | This is in preparation for the ProxyDecryptor and PpapiDecryptor. BUG=123260 TEST=media_unittests, media layout tests Review URL: https://chromiumcodereview.appspot.com/10539150 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143030 0039d316-1c4b-4281-b951-d872f2087c98
* Generalize AesDecryptor to make it more spec compliant.xhwang@chromium.org2012-06-164-56/+260
| | | | | | | | | | BUG=123260 TEST=media_unittests, encrypted-media layout tests. Review URL: https://chromiumcodereview.appspot.com/10534096 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142553 0039d316-1c4b-4281-b951-d872f2087c98
* Introducing DecoderBuffer and general Buffer cleanup.dalecurtis@google.com2012-05-313-20/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FFmpeg expects data to be padded and aligned in a certain way. It's currently possible to do this incorrectly and introduce dangerous issues. I enforce padding and alignment by introducing a new Buffer called DecoderBuffer and forcing DemuxerStream::Read to only accept it for transfer into decoders. DecoderBuffer allocates all memory through av_malloc (which takes care of alignment) with the appropriate padding size (except for Android, which doesn't care about this). Along the way it was necessary to clean up a large smattering of code to replace usage of DataBuffer with DecoderBuffer. I've rolled in several cleanup actions as well: - Moved DecryptConfig from Buffer to DecoderBuffer. - Replaced AVPacketBuffer and av_dup_packet with a DecoderBuffer::CopyFrom. - Fixed a resultant issue with FFmpegBitStreamConverter after removing the av_dup_packet functionality. Removed some unsupported bitstream filters. - Reduce TestDataUtil::ReadTestDataFile() to a single method returning a DecoderBuffer so unit tests will always have safe buffers. - Replace new DataBuffer(0)/new DecoderBuffer(0) w/ DecoderBuffer::CreateEOSBuffer. - Remove extraneous IsEndOfStream check from FFmpegAudioDecoder. BUG=129843 TEST=media_unittests + valgrind, layout tests. Review URL: https://chromiumcodereview.appspot.com/10447035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139857 0039d316-1c4b-4281-b951-d872f2087c98
* Replace size_t with int in a few media classes.scherkus@chromium.org2012-03-271-1/+1
| | | | | | | | This addressed TODOs in DataSource::Read() and AudioRendererAlgorithmBase, which led to converting Buffer and SeekableBuffer as well. Review URL: https://chromiumcodereview.appspot.com/9854031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129140 0039d316-1c4b-4281-b951-d872f2087c98
* Add AddKey to AesDecryptorxhwang@chromium.org2012-03-143-41/+127
| | | | | | | | | BUG=117063 TEST=updated media_unittest:AesDecryptorTest.* Review URL: http://codereview.chromium.org/9390024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126576 0039d316-1c4b-4281-b951-d872f2087c98
* Add AES decryptor and tests.xhwang@chromium.org2012-03-084-0/+169
For now we support decryption in video only. The first encryption key ID in ContentEncodings element will be used as the decryption key ID. Also we assume decryption key is the same as key ID. BUG=117060 TEST=test page with encrypted content plays; added media_unittest Review URL: http://codereview.chromium.org/9298021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125560 0039d316-1c4b-4281-b951-d872f2087c98