Unit Test for OEMCrypto to Reject Future Key Control Block
Merge from widevine repo of http://go/wvgerrit/16250 The verification string in the key control block has an obvious pattern that is incremented every time we update the API. This CL adds a unit test to make sure an implementation of OEMCrypto is not casually accepting a future version of the key control block before the API has even been defined. Change-Id: I3f837f7346ef7de399441f5fcda9b13b65fa51f4
This commit is contained in:
@@ -2022,6 +2022,22 @@ TEST_F(OEMCryptoSessionTests, LoadKeyWithBadVerification) {
|
||||
ASSERT_NE(OEMCrypto_SUCCESS, sts);
|
||||
}
|
||||
|
||||
TEST_F(OEMCryptoSessionTests, LoadKeyWithFutureVerification) {
|
||||
Session s;
|
||||
s.open();
|
||||
|
||||
s.GenerateTestSessionKeys();
|
||||
s.FillSimpleMessage(0, 0, 0);
|
||||
// OEMCrypto should reject API12 until the spec has been defined.
|
||||
memcpy(s.license().keys[1].control.verification, "kc12", 4);
|
||||
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(OEMCryptoSessionTests, LoadKeysBadSignature) {
|
||||
Session s;
|
||||
s.open();
|
||||
|
||||
Reference in New Issue
Block a user