OEMCrypto Query Key Control Block

Merge from Widevine repo http://go/wvgerrit/13818

This CL adds the ability to query OEMCrypto about the key control
block and duration of a key that has been loaded.  There are unit
tests and implementation in the level 3 and reference implementation.

b/18503541

Change-Id: I8e40d90a3c64c1ce030af6fef9e98c8eac0df1a5
This commit is contained in:
Fred Gylys-Colwell
2015-03-30 15:38:52 -07:00
parent 10cc0a5ddb
commit 582eb32661
5 changed files with 115 additions and 0 deletions

View File

@@ -941,6 +941,25 @@ bool SessionContext::UpdateMacKeys(const std::vector<uint8_t>& enc_mac_keys,
return true;
}
bool SessionContext::QueryKeyControlBlock(const KeyId& key_id, uint32_t* data) {
const Key* content_key = session_keys_.Find(key_id);
if (LogCategoryEnabled(kLoggingTraceDecryption)){
LOGI(( "Select Key: key_id = " +
wvcdm::b2a_hex(key_id) ).c_str());
LOGI(( "Select Key: key = " +
wvcdm::b2a_hex(content_key->value()) ).c_str());
}
if (NULL == content_key) {
LOGE("[QueryKeyControlBlock(): No key matches key id]");
return false;
}
data[0] = 0; // verification optional.
data[1] = htonl(content_key->control().duration());
data[2] = 0; // nonce optional.
data[3] = htonl(content_key->control().control_bits());
return true;
}
bool SessionContext::SelectContentKey(const KeyId& key_id) {
const Key* content_key = session_keys_.Find(key_id);