Clarify that WVM format always uses all zero IV

Close b/22894397

Change-Id: I9f2295130d32ea5135ef0143ec7758df1114b18d
This commit is contained in:
Kongqun Yang 2016-04-22 13:41:45 -07:00
parent 797ae3e639
commit 25305b6aa3
1 changed files with 5 additions and 3 deletions

View File

@ -1113,9 +1113,10 @@ bool WvmMediaParser::ProcessEcm() {
std::vector<uint8_t> asset_key( std::vector<uint8_t> asset_key(
encryption_key.key.begin(), encryption_key.key.begin(),
encryption_key.key.begin() + kAssetKeySizeBytes); encryption_key.key.begin() + kAssetKeySizeBytes);
std::vector<uint8_t> iv(kInitializationVectorSizeBytes); // WVM format always uses all zero IV.
std::vector<uint8_t> zero_iv(kInitializationVectorSizeBytes, 0);
AesCbcDecryptor asset_decryptor(kCtsPadding, AesCryptor::kUseConstantIv); 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."; LOG(ERROR) << "Failed to initialize asset_decryptor.";
return false; return false;
} }
@ -1132,7 +1133,8 @@ bool WvmMediaParser::ProcessEcm() {
content_key_buffer.begin() + 20); content_key_buffer.begin() + 20);
scoped_ptr<AesCbcDecryptor> content_decryptor( scoped_ptr<AesCbcDecryptor> content_decryptor(
new AesCbcDecryptor(kCtsPadding, AesCryptor::kUseConstantIv)); 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."; LOG(ERROR) << "Failed to initialize content decryptor.";
return false; return false;
} }