Unit Tests for Security Patch Level
Merge of widevine change http://go/wvgerrit/16249 This CL adds unit tests and reference code for the security patch level, which is a new feature in OEMCrypto v11. This CL also adjusts the dynamic and static adapters to still run with devices that have a v10 OEMCrypto. The level 3 haystack code will be updated in a future CL. bug: 26188985 Change-Id: I518ef46b4098cf3718fe0c0390bfb6825db4fb6b
This commit is contained in:
@@ -327,6 +327,8 @@ OEMCryptoResult OEMCrypto_LoadKeys(OEMCrypto_SESSION session,
|
||||
key_array[i].key_control_iv, wvcdm::KEY_IV_SIZE);
|
||||
dump_array_part("key_array", i, "key_control",
|
||||
key_array[i].key_control, wvcdm::KEY_IV_SIZE);
|
||||
LOGV("key_array[%zu].cipher_mode=%s;\n", i,
|
||||
key_array[i].cipher_mode == OEMCrypto_CipherMode_CTR ? "CTR" : "CBC");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -380,6 +382,10 @@ OEMCryptoResult OEMCrypto_LoadKeys(OEMCrypto_SESSION session,
|
||||
LOGE("[OEMCrypto_LoadKeys(): OEMCrypto_ERROR_INVALID_CONTEXT -range check %d]", i);
|
||||
return OEMCrypto_ERROR_INVALID_CONTEXT;
|
||||
}
|
||||
if (key_array[i].cipher_mode != OEMCrypto_CipherMode_CTR) {
|
||||
LOGE("[OEMCrypto_LoadKeys(): CBC Mode not yet implemented]");
|
||||
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
}
|
||||
|
||||
return session_ctx->LoadKeys(message, message_length, signature,
|
||||
@@ -603,7 +609,7 @@ OEMCryptoResult OEMCrypto_DecryptCENC(OEMCrypto_SESSION session,
|
||||
const uint8_t* iv,
|
||||
size_t block_offset,
|
||||
OEMCrypto_DestBufferDesc* out_buffer,
|
||||
const OEMCrypto_PatternDesc* pattern,
|
||||
const OEMCrypto_CENCEncryptPatternDesc* pattern,
|
||||
uint8_t subsample_flags) {
|
||||
if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) {
|
||||
LOGI("-- OEMCryptoResult OEMCrypto_DecryptCTR"
|
||||
@@ -1214,14 +1220,19 @@ uint32_t OEMCrypto_APIVersion() {
|
||||
|
||||
extern "C"
|
||||
uint8_t OEMCrypto_Security_Patch_Level() {
|
||||
return 0;
|
||||
uint8_t security_patch_level = crypto_engine->security_patch_level();
|
||||
if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) {
|
||||
LOGI("-- uint8_t OEMCrypto_Security_Patch_Level(); // returns %d.\n",
|
||||
security_patch_level);
|
||||
}
|
||||
return security_patch_level;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
const char* OEMCrypto_SecurityLevel() {
|
||||
const char* security_level = crypto_engine->security_level();
|
||||
if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) {
|
||||
LOGI("-- bool OEMCrypto_SecurityLevel(); // returns %s.\n", security_level);
|
||||
LOGI("-- const char* OEMCrypto_SecurityLevel(); // returns %s.\n", security_level);
|
||||
}
|
||||
return security_level;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user