Updates to OEMCrytpo Mock
Squash merge from the widevine repo of several changes to oemcrypto unit tests and the mock reference code. http://go/wvgerrit/16264 Use unsigned int for count in usage table (more mock) http://go/wvgerrit/16262 Use unsigned int for count in usage table (mock version) http://go/wvgerrit/16247 Fix mock OEMCrypto_DeleteUsageTable http://go/wvgerrit/16070 Fix OEMCrypto_GenerateRSASignature return values http://go/wvgerrit/15991 Fix buffer overflow for 32-bit systems http://go/wvgerrit/15993 Return Correct Value from OEMCrypto_RefreshKeys http://go/wvgerrit/15880 Cast RSA_size() to int http://go/wvgerrit/15831 Be strict about warnings for CE CDM b/23729420 b/25221168 Change-Id: I97b91dfc672db8c586ae317977871b7d6afac4bb
This commit is contained in:
@@ -444,7 +444,7 @@ OEMCryptoResult OEMCrypto_RefreshKeys(
|
||||
}
|
||||
|
||||
// Decrypt and refresh keys in key refresh object
|
||||
bool status = true;
|
||||
OEMCryptoResult status = OEMCrypto_SUCCESS;
|
||||
std::vector<uint8_t> key_id;
|
||||
std::vector<uint8_t> key_control;
|
||||
std::vector<uint8_t> key_control_iv;
|
||||
@@ -469,15 +469,17 @@ OEMCryptoResult OEMCrypto_RefreshKeys(
|
||||
key_array[i].key_control + wvcdm::KEY_CONTROL_SIZE);
|
||||
}
|
||||
|
||||
if (!session_ctx->RefreshKey(key_id, key_control, key_control_iv)) {
|
||||
LOGE("[OEMCrypto_RefreshKeys(): error in key %i]", i);
|
||||
status = false;
|
||||
status = session_ctx->RefreshKey(key_id, key_control, key_control_iv);
|
||||
if (status != OEMCrypto_SUCCESS) {
|
||||
LOGE("[OEMCrypto_RefreshKeys(): error %u in key %i]", status, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
session_ctx->FlushNonces();
|
||||
if (!status) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
if (status != OEMCrypto_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
||||
session_ctx->StartTimer();
|
||||
return OEMCrypto_SUCCESS;
|
||||
@@ -1101,10 +1103,6 @@ OEMCryptoResult OEMCrypto_GenerateRSASignature(
|
||||
LOGE("OEMCrypto_GenerateRSASignature: OEMCrypto Not Initialized.");
|
||||
return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
}
|
||||
if (NO_ERROR != crypto_engine->ValidateKeybox()) {
|
||||
LOGE("[OEMCrypto_GenerateRSASignature(): ERROR_KEYBOX_INVALID]");
|
||||
return OEMCrypto_ERROR_KEYBOX_INVALID;
|
||||
}
|
||||
|
||||
if (signature_length == 0) {
|
||||
LOGE("[OEMCrypto_GenerateRSASignature(): OEMCrypto_ERROR_INVALID_CONTEXT]");
|
||||
@@ -1129,19 +1127,19 @@ OEMCryptoResult OEMCrypto_GenerateRSASignature(
|
||||
return OEMCrypto_ERROR_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
if (session_ctx->GenerateRSASignature(message,
|
||||
message_length,
|
||||
signature,
|
||||
signature_length,
|
||||
padding_scheme)) {
|
||||
OEMCryptoResult sts = session_ctx->GenerateRSASignature(message,
|
||||
message_length,
|
||||
signature,
|
||||
signature_length,
|
||||
padding_scheme);
|
||||
if (sts == OEMCrypto_SUCCESS) {
|
||||
if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) {
|
||||
if (wvcdm::g_cutoff >= wvcdm::LOG_VERBOSE) {
|
||||
dump_hex("signature", signature, *signature_length);
|
||||
}
|
||||
}
|
||||
return OEMCrypto_SUCCESS;
|
||||
}
|
||||
return OEMCrypto_ERROR_UNKNOWN_FAILURE;;
|
||||
return sts;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
@@ -1625,6 +1623,7 @@ OEMCryptoResult OEMCrypto_DeleteUsageTable() {
|
||||
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
crypto_engine->usage_table()->Clear();
|
||||
crypto_engine->usage_table()->UpdateTable();
|
||||
return OEMCrypto_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user