Update LoadTestKeybox

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

This CL updates oemcrypto unit tests to use the new test keybox.

bug: 69552641 Update OEMCrypto_LoadTestKeybox

test: Unit tests compile and run -- many tests won't pass until merged
with vendor code

Change-Id: I73bdca3958b2c985d4c61801aa95807a2e6d4299
This commit is contained in:
Fred Gylys-Colwell
2018-01-23 16:06:16 -08:00
parent 19cb1792a4
commit d72f49e31a
11 changed files with 139 additions and 48 deletions

View File

@@ -49,7 +49,10 @@ class AuthenticationRoot {
}
WvKeybox& keybox() { return use_test_keybox_ ? test_keybox_ : keybox_; }
void UseTestKeybox() { use_test_keybox_ = true; }
bool UseTestKeybox(const uint8_t* keybox_data, size_t keybox_length) {
use_test_keybox_ = true;
return test_keybox_.InstallKeybox(keybox_data, keybox_length);
}
RSA_shared_ptr& SharedRsaKey() { return rsa_key_; }
RSA* rsa_key() { return rsa_key_.get(); }

View File

@@ -47,7 +47,9 @@ class CryptoEngine {
return root_of_trust_.InstallKeybox(keybox, keybox_length);
}
void UseTestKeybox() { root_of_trust_.UseTestKeybox(); }
bool UseTestKeybox(const uint8_t* keybox_data, size_t keybox_length) {
return root_of_trust_.UseTestKeybox(keybox_data, keybox_length);
}
bool LoadTestRsaKey() { return root_of_trust_.LoadTestRsaKey(); }

View File

@@ -688,7 +688,8 @@ extern "C" OEMCryptoResult OEMCrypto_InstallKeybox(const uint8_t* keybox,
return OEMCrypto_ERROR_WRITE_KEYBOX;
}
extern "C" OEMCryptoResult OEMCrypto_LoadTestKeybox() {
extern "C" OEMCryptoResult OEMCrypto_LoadTestKeybox(
const uint8_t* buffer, size_t length) {
if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) {
LOGI("-- OEMCryptoResult OEMCrypto_LoadTestKeybox()\n");
}
@@ -699,7 +700,7 @@ extern "C" OEMCryptoResult OEMCrypto_LoadTestKeybox() {
if (crypto_engine->config_provisioning_method() != OEMCrypto_Keybox) {
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
}
crypto_engine->UseTestKeybox();
crypto_engine->UseTestKeybox(buffer, length);
return OEMCrypto_SUCCESS;
}