Unit Test for OEMCrypto_ERROR_KEY_EXPIRED
This is a copy from the Widevine CDM repository: https://widevine-internal-review.googlesource.com/#/c/9177/4 This CL modifies some unit tests to make sure that OEMCrypto returns the correct error code when the key has expired. This behaviour is required for OEMCrypto version 9. It also updates the code for the reference implementation and the Level 3 implementation. This is half of b/9205119 The other half is for the CDM layer to respond to this error code. bug: 9205119 Change-Id: I60f934886f4ecdd1ee04825dea289fda1c0a4303
This commit is contained in:
@@ -3014,7 +3014,7 @@ TEST_F(DISABLED_TestKeybox, KeyDuration) {
|
||||
encryptedData.size(), true, &encryptionIv[0], 0,
|
||||
&destBuffer,
|
||||
OEMCrypto_FirstSubsample | OEMCrypto_LastSubsample);
|
||||
ASSERT_NE(OEMCrypto_SUCCESS, sts);
|
||||
ASSERT_EQ(OEMCrypto_ERROR_KEY_EXPIRED, sts);
|
||||
ASSERT_NE(0, memcmp(&unencryptedData[0], outputBuffer,
|
||||
unencryptedData.size()));
|
||||
|
||||
@@ -4975,7 +4975,7 @@ TEST_F(DISABLED_GenericDRMTest, KeyDurationEncrypt) {
|
||||
memset(encrypted, 0, kBufferSize);
|
||||
sts = OEMCrypto_Generic_Encrypt(s.session_id(), clear_buffer_, kBufferSize, iv_,
|
||||
OEMCrypto_AES_CBC_128_NO_PADDING, encrypted);
|
||||
ASSERT_NE(OEMCrypto_SUCCESS, sts);
|
||||
ASSERT_EQ(OEMCrypto_ERROR_KEY_EXPIRED, sts);
|
||||
ASSERT_NE(0, memcmp(encrypted, expected_encrypted, kBufferSize));
|
||||
s.close();
|
||||
testTearDown();
|
||||
@@ -5016,7 +5016,7 @@ TEST_F(DISABLED_GenericDRMTest, KeyDurationDecrypt) {
|
||||
memset(resultant, 0, kBufferSize);
|
||||
sts = OEMCrypto_Generic_Decrypt(s.session_id(), encrypted, kBufferSize, iv_,
|
||||
OEMCrypto_AES_CBC_128_NO_PADDING, resultant);
|
||||
ASSERT_NE(OEMCrypto_SUCCESS, sts);
|
||||
ASSERT_EQ(OEMCrypto_ERROR_KEY_EXPIRED, sts);
|
||||
ASSERT_NE(0, memcmp(clear_buffer_, resultant, kBufferSize));
|
||||
s.close();
|
||||
testTearDown();
|
||||
@@ -5063,7 +5063,7 @@ TEST_F(DISABLED_GenericDRMTest, KeyDurationSign) {
|
||||
sts = OEMCrypto_Generic_Sign(s.session_id(), clear_buffer_, kBufferSize,
|
||||
OEMCrypto_HMAC_SHA256,signature,
|
||||
&signature_length);
|
||||
ASSERT_NE(OEMCrypto_SUCCESS, sts);
|
||||
ASSERT_EQ(OEMCrypto_ERROR_KEY_EXPIRED, sts);
|
||||
ASSERT_NE(0, memcmp(signature, expected_signature, SHA256_DIGEST_LENGTH));
|
||||
|
||||
s.close();
|
||||
@@ -5104,7 +5104,7 @@ TEST_F(DISABLED_GenericDRMTest, KeyDurationVerify) {
|
||||
sts = OEMCrypto_Generic_Verify(s.session_id(), clear_buffer_, kBufferSize,
|
||||
OEMCrypto_HMAC_SHA256,signature,
|
||||
SHA256_DIGEST_LENGTH);
|
||||
ASSERT_NE(OEMCrypto_SUCCESS, sts);
|
||||
ASSERT_EQ(OEMCrypto_ERROR_KEY_EXPIRED, sts);
|
||||
|
||||
s.close();
|
||||
testTearDown();
|
||||
|
||||
Reference in New Issue
Block a user