Usage Table for Level 3 OEMCrypto
This is a copy of the widevine CL. https://widevine-internal-review.googlesource.com/#/c/10174/ This CL adds the OEMCrypto v9 functionality to the level 3 haystack version of OEMCrypto. Mostly, this is to support usage tables. The code is feature complete, but the timing tests are a little flakey -- I'm not sure if the problem is in the code or if the test has too tight a tolerance. Also, the storage of the generation number needs to be made more secure. Change-Id: I73fecf8934b6a46785f1f8b6f40b40ffe39b88de
This commit is contained in:
@@ -2125,6 +2125,30 @@ TEST_F(DISABLED_TestKeybox, LoadKeyWithBadNonce) {
|
||||
ASSERT_NE(OEMCrypto_SUCCESS, sts);
|
||||
}
|
||||
|
||||
TEST_F(DISABLED_TestKeybox, LoadKeyWithRepeatNonce) {
|
||||
InstallKeybox(kDefaultKeybox, true);
|
||||
Session s;
|
||||
s.open();
|
||||
s.GenerateDerivedKeys();
|
||||
uint32_t nonce = s.get_nonce();
|
||||
s.FillSimpleMessage(0, wvoec_mock::kControlNonceEnabled, nonce);
|
||||
s.EncryptAndSign();
|
||||
s.LoadTestKeys();
|
||||
s.close();
|
||||
|
||||
s.open();
|
||||
s.GenerateDerivedKeys();
|
||||
s.FillSimpleMessage(0, wvoec_mock::kControlNonceEnabled,
|
||||
nonce); // same old nonce.
|
||||
s.EncryptAndSign();
|
||||
OEMCryptoResult sts = OEMCrypto_LoadKeys(
|
||||
s.session_id(), s.message_ptr(), sizeof(MessageData), &s.signature()[0],
|
||||
s.signature().size(), s.encrypted_license().mac_key_iv,
|
||||
s.encrypted_license().mac_keys, kNumKeys, s.key_array(), NULL, 0);
|
||||
|
||||
ASSERT_NE(OEMCrypto_SUCCESS, sts);
|
||||
}
|
||||
|
||||
TEST_F(DISABLED_TestKeybox, LoadKeyWithBadVerification) {
|
||||
InstallKeybox(kDefaultKeybox, true);
|
||||
Session s;
|
||||
@@ -4775,9 +4799,7 @@ TEST_P(DISABLED_UsageTableTest, GenericEncrypt) {
|
||||
wvoec_mock::kControlNonceRequired,
|
||||
nonce, pst);
|
||||
s.EncryptAndSign();
|
||||
printf("Getting ready to load keys.\n");
|
||||
s.LoadTestKeys(pst, new_mac_keys_);
|
||||
printf("done to load keys.\n");
|
||||
OEMCryptoResult sts;
|
||||
unsigned int key_index = 0;
|
||||
uint8_t expected_encrypted[kBufferSize];
|
||||
@@ -4791,7 +4813,6 @@ TEST_P(DISABLED_UsageTableTest, GenericEncrypt) {
|
||||
encrypted);
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, sts);
|
||||
EXPECT_EQ(0, memcmp(encrypted, expected_encrypted, kBufferSize));
|
||||
printf("doing the generate report");
|
||||
s.GenerateReport(pst);
|
||||
EXPECT_EQ(kActive, s.pst_report()->status);
|
||||
EXPECT_ALMOST(
|
||||
@@ -5145,6 +5166,7 @@ TEST_P(DISABLED_UsageTableTest, TimingTest) {
|
||||
OEMCrypto_Terminate();
|
||||
sleep(kShortSleep);
|
||||
OEMCrypto_Initialize();
|
||||
InstallKeybox(kDefaultKeybox, true);
|
||||
|
||||
// After a reboot, we should be able to reload keys, and generate reports.
|
||||
sleep(kLongSleep);
|
||||
|
||||
Reference in New Issue
Block a user