Testbed classes inherit from oemcrypto reference code

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

This CL removes code from the testbed that is duplicated in the
reference code using inheritance.

bug: 76393338 Split mock into reference code and testbed code
test: unit tests
Change-Id: I7b5f5330a595fa1756e6dfdf75bc07addb6107a8
This commit is contained in:
Fred Gylys-Colwell
2018-09-02 13:20:14 -07:00
parent a0961a8834
commit 3a2d291dc5
8 changed files with 98 additions and 97 deletions

View File

@@ -307,16 +307,6 @@ bool SessionContext::GenerateSignature(const uint8_t* message,
return false;
}
bool using_usage_entry_mac_key_client = false;
std::vector<uint8_t> usage_entry_mac_key_client;
if (usage_entry_status_ == kUsageEntryLoaded) {
usage_entry_mac_key_client.assign(
usage_entry_->mac_key_client(),
usage_entry_->mac_key_client() + wvoec::MAC_KEY_SIZE * sizeof(uint8_t));
using_usage_entry_mac_key_client =
mac_key_client_ == usage_entry_mac_key_client;
}
unsigned int md_len = *signature_length;
if (HMAC(EVP_sha256(), &mac_key_client_[0], wvoec::MAC_KEY_SIZE, message,
message_length, signature, &md_len)) {
@@ -818,6 +808,7 @@ OEMCryptoResult SessionContext::RefreshKey(
Key* content_key = session_keys_->Find(key_id);
if (NULL == content_key) {
LOGE("Key ID not found.");
return OEMCrypto_ERROR_UNKNOWN_FAILURE;
}
@@ -840,6 +831,7 @@ OEMCryptoResult SessionContext::RefreshKey(
KeyControlBlock key_control_block(control);
if (!key_control_block.valid()) {
LOGE("Error parsing key control.");
return OEMCrypto_ERROR_INVALID_CONTEXT;
}
if ((key_control_block.control_bits() & wvoec::kControlNonceEnabled) &&