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:
@@ -582,14 +582,9 @@ OEMCryptoResult OEMCrypto_DecryptCTR(OEMCrypto_SESSION session,
|
||||
return OEMCrypto_ERROR_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
if (!crypto_engine->DecryptCTR(session_ctx, iv, block_offset,
|
||||
data_addr, data_length, is_encrypted,
|
||||
destination, buffer_type)) {
|
||||
LOGE("[OEMCrypto_DecryptCTR(): OEMCrypto_ERROR_DECRYPT_FAILED]");
|
||||
return OEMCrypto_ERROR_DECRYPT_FAILED;
|
||||
}
|
||||
|
||||
return OEMCrypto_SUCCESS;
|
||||
return crypto_engine->DecryptCTR(session_ctx, iv, block_offset, data_addr,
|
||||
data_length, is_encrypted, destination,
|
||||
buffer_type);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
@@ -1053,12 +1048,8 @@ OEMCryptoResult OEMCrypto_Generic_Encrypt(OEMCrypto_SESSION session,
|
||||
LOGE("[OEMCrypto_Generic_Enrypt(): OEMCrypto_ERROR_INVALID_CONTEXT]");
|
||||
return OEMCrypto_ERROR_INVALID_CONTEXT;
|
||||
}
|
||||
if (!session_ctx->Generic_Encrypt(in_buffer, buffer_length, iv, algorithm,
|
||||
out_buffer)) {
|
||||
LOGE("[OEMCrypto_Generic_Enrypt(): OEMCrypto_ERROR_UNKNOWN_FAILURE]");
|
||||
return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
}
|
||||
return OEMCrypto_SUCCESS;
|
||||
return session_ctx->Generic_Encrypt(in_buffer, buffer_length, iv, algorithm,
|
||||
out_buffer);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
@@ -1077,16 +1068,13 @@ OEMCryptoResult OEMCrypto_Generic_Decrypt(OEMCrypto_SESSION session,
|
||||
LOGE("[OEMCrypto_Generic_Decrypt(): ERROR_INVALID_SESSION]");
|
||||
return OEMCrypto_ERROR_INVALID_SESSION;
|
||||
}
|
||||
if (!session_ctx->Generic_Decrypt(in_buffer, buffer_length, iv, algorithm,
|
||||
out_buffer)) {
|
||||
return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
}
|
||||
if (in_buffer == NULL || buffer_length == 0 ||
|
||||
iv == NULL || out_buffer == NULL) {
|
||||
LOGE("[OEMCrypto_Generic_Decrypt(): OEMCrypto_ERROR_INVALID_CONTEXT]");
|
||||
return OEMCrypto_ERROR_INVALID_CONTEXT;
|
||||
}
|
||||
return OEMCrypto_SUCCESS;
|
||||
return session_ctx->Generic_Decrypt(in_buffer, buffer_length, iv, algorithm,
|
||||
out_buffer);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
@@ -1113,11 +1101,8 @@ OEMCryptoResult OEMCrypto_Generic_Sign(OEMCrypto_SESSION session,
|
||||
LOGE("[OEMCrypto_Generic_Sign(): OEMCrypto_ERROR_INVALID_CONTEXT]");
|
||||
return OEMCrypto_ERROR_INVALID_CONTEXT;
|
||||
}
|
||||
if (!session_ctx->Generic_Sign(in_buffer, buffer_length, algorithm,
|
||||
signature, signature_length)) {
|
||||
return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
}
|
||||
return OEMCrypto_SUCCESS;
|
||||
return session_ctx->Generic_Sign(in_buffer, buffer_length, algorithm,
|
||||
signature, signature_length);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
@@ -1143,11 +1128,8 @@ OEMCryptoResult OEMCrypto_Generic_Verify(OEMCrypto_SESSION session,
|
||||
LOGE("[OEMCrypto_Generic_Verify(): OEMCrypto_ERROR_INVALID_CONTEXT]");
|
||||
return OEMCrypto_ERROR_INVALID_CONTEXT;
|
||||
}
|
||||
if (!session_ctx->Generic_Verify(in_buffer, buffer_length, algorithm,
|
||||
signature, signature_length)) {
|
||||
return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
}
|
||||
return OEMCrypto_SUCCESS;
|
||||
return session_ctx->Generic_Verify(in_buffer, buffer_length, algorithm,
|
||||
signature, signature_length);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
|
||||
Reference in New Issue
Block a user