Improve OEMCrypto unit tests
This is a merge of http://go/wvgerrit/13701 and http://go/wvgerrit/13780. I added a new set of engine properties for the mock oemcrypto. This set pretends to be level 1. This allows the widevine build bot to test the dual security level path: a level 1 liboemcrypto.so and a fall back to L3. I also adjusted the failing test in oemcrypto_test.cpp. A correct fix requires us to rewrite some of the oemcrypto mock code so that it returns real error codes instead of just 'false' on error. Change-Id: I9cdbfc23c87ad2fb6068eac1394ce4c5b6a32dae
This commit is contained in:
@@ -1593,23 +1593,6 @@ class OEMCryptoClientTest : public ::testing::Test {
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(OEMCryptoClientTest, AntiRollbackHardwareRequired) {
|
||||
Session s;
|
||||
s.open();
|
||||
s.GenerateDerivedKeys();
|
||||
s.FillSimpleMessage(0, wvoec_mock::kControlRequireAntiRollbackHardware, 0);
|
||||
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);
|
||||
if (OEMCrypto_IsAntiRollbackHwPresent()) {
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, sts);
|
||||
} else {
|
||||
ASSERT_EQ(OEMCrypto_ERROR_UNKNOWN_FAILURE, sts);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Keybox Tests
|
||||
// These two tests are first, becuase it might give an idea why other
|
||||
@@ -2347,6 +2330,23 @@ TEST_F(DISABLED_TestKeybox, LoadKeysWithNoDerivedKeys) {
|
||||
ASSERT_NE(OEMCrypto_SUCCESS, sts);
|
||||
}
|
||||
|
||||
TEST_F(DISABLED_TestKeybox, AntiRollbackHardwareRequired) {
|
||||
Session s;
|
||||
s.open();
|
||||
s.GenerateDerivedKeys();
|
||||
s.FillSimpleMessage(0, wvoec_mock::kControlRequireAntiRollbackHardware, 0);
|
||||
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);
|
||||
if (OEMCrypto_IsAntiRollbackHwPresent()) {
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, sts);
|
||||
} else {
|
||||
ASSERT_EQ(OEMCrypto_ERROR_UNKNOWN_FAILURE, sts);
|
||||
}
|
||||
}
|
||||
|
||||
class DISABLED_DecryptWithHDCP : public DISABLED_TestKeybox,
|
||||
public WithParamInterface<int> {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user