Index: media/crypto/aes_decryptor.cc |
diff --git a/media/crypto/aes_decryptor.cc b/media/crypto/aes_decryptor.cc |
index cbb75b37bd33457f74b9f540d652ae01bbd77c19..7b8feca73ebae36b6ec6f4f5186718d773643f99 100644 |
--- a/media/crypto/aes_decryptor.cc |
+++ b/media/crypto/aes_decryptor.cc |
@@ -14,40 +14,6 @@ |
namespace media { |
-// TODO(xhwang): Get real IV from frames. |
-static const char kInitialCounter[] = "0000000000000000"; |
- |
-// Decrypt |input| using |key|. |
-// Return a DecoderBuffer with the decrypted data if decryption succeeded. |
-// Return NULL if decryption failed. |
-static scoped_refptr<DecoderBuffer> DecryptData(const DecoderBuffer& input, |
- crypto::SymmetricKey* key) { |
- CHECK(input.GetDataSize()); |
- CHECK(key); |
- |
- // Initialize encryption data. |
- // The IV must be exactly as long as the cipher block size. |
- crypto::Encryptor encryptor; |
- if (!encryptor.Init(key, crypto::Encryptor::CBC, kInitialCounter)) { |
- DVLOG(1) << "Could not initialize encryptor."; |
- return NULL; |
- } |
- |
- std::string decrypted_text; |
- base::StringPiece encrypted_text( |
- reinterpret_cast<const char*>(input.GetData()), |
- input.GetDataSize()); |
- if (!encryptor.Decrypt(encrypted_text, &decrypted_text)) { |
- DVLOG(1) << "Could not decrypt data."; |
- return NULL; |
- } |
- |
- // TODO(xhwang): Find a way to avoid this data copy. |
- return DecoderBuffer::CopyFrom( |
- reinterpret_cast<const uint8*>(decrypted_text.data()), |
- decrypted_text.size()); |
-} |
- |
AesDecryptor::AesDecryptor() {} |
AesDecryptor::~AesDecryptor() { |
@@ -99,7 +65,8 @@ scoped_refptr<DecoderBuffer> AesDecryptor::Decrypt( |
key = found->second; |
} |
- scoped_refptr<DecoderBuffer> decrypted = DecryptData(*encrypted, key); |
+ scoped_refptr<DecoderBuffer> decrypted = |
+ Decryptor::DecryptData(*encrypted, key, 0); |
if (decrypted) { |
decrypted->SetTimestamp(encrypted->GetTimestamp()); |