From 25305b6aa32eb3cc0541c5de290ee4b6e8a7fe7a Mon Sep 17 00:00:00 2001 From: Kongqun Yang Date: Fri, 22 Apr 2016 13:41:45 -0700 Subject: [PATCH] Clarify that WVM format always uses all zero IV Close b/22894397 Change-Id: I9f2295130d32ea5135ef0143ec7758df1114b18d --- packager/media/formats/wvm/wvm_media_parser.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packager/media/formats/wvm/wvm_media_parser.cc b/packager/media/formats/wvm/wvm_media_parser.cc index 8fa47e6e37..30ced3dd1d 100644 --- a/packager/media/formats/wvm/wvm_media_parser.cc +++ b/packager/media/formats/wvm/wvm_media_parser.cc @@ -1113,9 +1113,10 @@ bool WvmMediaParser::ProcessEcm() { std::vector asset_key( encryption_key.key.begin(), encryption_key.key.begin() + kAssetKeySizeBytes); - std::vector iv(kInitializationVectorSizeBytes); + // WVM format always uses all zero IV. + std::vector zero_iv(kInitializationVectorSizeBytes, 0); AesCbcDecryptor asset_decryptor(kCtsPadding, AesCryptor::kUseConstantIv); - if (!asset_decryptor.InitializeWithIv(asset_key, iv)) { + if (!asset_decryptor.InitializeWithIv(asset_key, zero_iv)) { LOG(ERROR) << "Failed to initialize asset_decryptor."; return false; } @@ -1132,7 +1133,8 @@ bool WvmMediaParser::ProcessEcm() { content_key_buffer.begin() + 20); scoped_ptr content_decryptor( new AesCbcDecryptor(kCtsPadding, AesCryptor::kUseConstantIv)); - if (!content_decryptor->InitializeWithIv(decrypted_content_key_vec, iv)) { + if (!content_decryptor->InitializeWithIv(decrypted_content_key_vec, + zero_iv)) { LOG(ERROR) << "Failed to initialize content decryptor."; return false; }