Fix key size when decrypting KCB with entitlement keys.

Merge from Widevine repo of http://go/wvgerrit/42942

This CL changes test code only.

Bug: 73132054
test: unit tests

Change-Id: Ic9ca1879a942b0cad8ea15a98ed263a5fd170b4c
This commit is contained in:
Fred Gylys-Colwell
2018-02-09 11:43:20 -08:00
parent 928ae5639e
commit 6562488d0f
2 changed files with 5 additions and 1 deletions

View File

@@ -750,7 +750,10 @@ OEMCryptoResult SessionContext::InstallKey(
return OEMCrypto_ERROR_INVALID_CONTEXT;
}
if (!DecryptMessage(content_key, key_control_iv, key_control,
&key_control_str, 128 /* key size */)) {
&key_control_str,
(session_keys_->type() == OEMCrypto_EntitlementLicense
? 256
: 128) /* key size */)) {
LOGE("[Installkey(): ERROR: Could not decrypt content key]");
return OEMCrypto_ERROR_UNKNOWN_FAILURE;
}

View File

@@ -516,6 +516,7 @@ void Session::FillSimpleMessage(uint32_t duration, uint32_t control,
void Session::FillSimpleEntitlementMessage(
uint32_t duration, uint32_t control, uint32_t nonce,
const std::string& pst) {
has_entitlement_license_ = true;
EXPECT_EQ(
1, GetRandBytes(license_.mac_key_iv, sizeof(license_.mac_key_iv)));
EXPECT_EQ(1, GetRandBytes(license_.mac_keys, sizeof(license_.mac_keys)));