Full decrypt path testing
Merge from master branch of Widevine repo of http://go/wvgerrit/66080 Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/64002 This CL updates OEMCrypto reference code and unit tests to support full decrypt path testing. Test: unit tests Test: tested as part of http://go/ag/5501993 Bug: 34078913 Change-Id: Ia67374599d6619698a336f41513068ad04294e7f
This commit is contained in:
@@ -1617,4 +1617,52 @@ extern "C" OEMCryptoResult OEMCrypto_CreateOldUsageEntry(
|
||||
pst_length);
|
||||
}
|
||||
|
||||
extern "C" uint32_t OEMCrypto_SupportsDecryptHash() {
|
||||
return OEMCrypto_CRC_Clear_Buffer;
|
||||
}
|
||||
|
||||
extern "C" OEMCryptoResult OEMCrypto_InitializeDecryptHash(
|
||||
OEMCrypto_SESSION session) {
|
||||
if (!crypto_engine) {
|
||||
LOGE("OEMCrypto_InitializeDecryptHash: OEMCrypto Not Initialized.");
|
||||
return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
}
|
||||
SessionContext* session_ctx = crypto_engine->FindSession(session);
|
||||
if (!session_ctx || !session_ctx->isValid()) {
|
||||
LOGE("[OEMCrypto_InitializeDecryptHash(): ERROR_INVALID_SESSION]");
|
||||
return OEMCrypto_ERROR_INVALID_SESSION;
|
||||
}
|
||||
return session_ctx->InitializeDecryptHash();
|
||||
}
|
||||
|
||||
extern "C" OEMCryptoResult OEMCrypto_SetDecryptHash(OEMCrypto_SESSION session,
|
||||
uint32_t frame_number,
|
||||
const uint8_t* hash,
|
||||
size_t hash_length) {
|
||||
if (!crypto_engine) {
|
||||
LOGE("OEMCrypto_SetDecryptHash: OEMCrypto Not Initialized.");
|
||||
return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
}
|
||||
SessionContext* session_ctx = crypto_engine->FindSession(session);
|
||||
if (!session_ctx || !session_ctx->isValid()) {
|
||||
LOGE("[OEMCrypto_SetDecryptHash(): ERROR_INVALID_SESSION]");
|
||||
return OEMCrypto_ERROR_INVALID_SESSION;
|
||||
}
|
||||
return session_ctx->SetDecryptHash(frame_number, hash, hash_length);
|
||||
}
|
||||
|
||||
extern "C" OEMCryptoResult OEMCrypto_GetHashErrorCode(
|
||||
OEMCrypto_SESSION session, uint32_t* failed_frame_number) {
|
||||
if (!crypto_engine) {
|
||||
LOGE("OEMCrypto_GetHashErrorCode: OEMCrypto Not Initialized.");
|
||||
return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
}
|
||||
SessionContext* session_ctx = crypto_engine->FindSession(session);
|
||||
if (!session_ctx || !session_ctx->isValid()) {
|
||||
LOGE("[OEMCrypto_GetHashErrorCode(): ERROR_INVALID_SESSION]");
|
||||
return OEMCrypto_ERROR_INVALID_SESSION;
|
||||
}
|
||||
return session_ctx->GetHashErrorCode(failed_frame_number);
|
||||
}
|
||||
|
||||
} // namespace wvoec_ref
|
||||
|
||||
Reference in New Issue
Block a user