Refactor OEMCrypto_SetDecryptHash

The current implementation of OEMCrypto_SetDecryptHash gives developers
flexibility to use different types of hashes. However, all the
implementations we have seen thus far use crc32. Because of this, crc32
should be sufficient and we can refactor OEMCrypto_SetDecryptHash to
only use the crc32 hash.

Bug: 287706586
Change-Id: I4aaa253b2656dfd9c984f77dfb08fe160b23b47c
This commit is contained in:
Vicky Min
2023-08-01 17:29:41 +00:00
committed by Robert Shih
parent c26d6d3c97
commit 18369730b9
8 changed files with 51 additions and 43 deletions

View File

@@ -55,15 +55,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
uint32_t* const failed_frame_number =
fuzzed_data.ConsumeBool() ? &failed_frame_number_data : nullptr;
const std::vector<uint8_t> hash =
fuzzed_data.ConsumeRemainingBytes<uint8_t>();
const uint32_t crc32 = fuzzed_data.ConsumeIntegral<uint32_t>();
license_api_fuzz.LoadLicense();
std::vector<uint8_t> key_handle;
wvoec::GetKeyHandleIntoVector(session_id, content_key_id.data(),
content_key_id.size(),
OEMCrypto_CipherMode_CENC, key_handle);
OEMCrypto_SetDecryptHash(session_id, frame_number, hash.data(), hash.size());
OEMCrypto_SetDecryptHash(session_id, frame_number, crc32);
OEMCrypto_DecryptCENC(key_handle.data(), key_handle.size(), &sample, 1,
&pattern);
OEMCrypto_GetHashErrorCode(session_id, failed_frame_number);