Added an oemcrypto test for OPK versioning

Merge from Widevine repo of http://go/wvgerrit/125645

bug: 158857733
test: opk_linux_ipc_ta
Change-Id: Ibcbb143fa0eb7d2b4e14e3cc9afbe3a219c7c727
This commit is contained in:
Fred Gylys-Colwell
2021-10-13 22:00:06 +00:00
parent d7b377f976
commit 882d3ed075
2 changed files with 125 additions and 0 deletions

View File

@@ -319,6 +319,10 @@ typedef OEMCryptoResult (*L1_LoadProvisioning_t)(
size_t signature_length, uint8_t* wrapped_private_key,
size_t* wrapped_private_key_length);
typedef uint32_t (*L1_MinorAPIVersion_t)();
typedef OEMCryptoResult (*L1_OPK_SerializationVersion_t)(uint32_t* ree_major,
uint32_t* ree_minor,
uint32_t* tee_major,
uint32_t* tee_minor);
typedef OEMCryptoResult (*L1_GenerateOTARequest_t)(OEMCrypto_SESSION session,
uint8_t* buffer,
size_t* buffer_length,
@@ -411,6 +415,7 @@ struct FunctionPointers {
L1_MaximumUsageTableHeaderSize_t MaximumUsageTableHeaderSize;
L1_LoadProvisioning_t LoadProvisioning;
L1_MinorAPIVersion_t MinorAPIVersion;
L1_OPK_SerializationVersion_t OPK_SerializationVersion;
L1_LoadKeys_V8_t LoadKeys_V8;
L1_GenerateRSASignature_V8_t GenerateRSASignature_V8;
@@ -961,6 +966,7 @@ class Adapter {
LOOKUP_ALL(16, MaximumUsageTableHeaderSize, OEMCrypto_MaximumUsageTableHeaderSize);
LOOKUP_ALL(16, LoadProvisioning, OEMCrypto_LoadProvisioning);
LOOKUP_ALL(16, MinorAPIVersion, OEMCrypto_MinorAPIVersion);
LOOKUP_ALL(16, OPK_SerializationVersion, OEMCrypto_OPK_SerializationVersion);
LOOKUP_ALL(16, GenerateOTARequest, OEMCrypto_GenerateOTARequest);
LOOKUP_ALL(16, ProcessOTAKeybox, OEMCrypto_ProcessOTAKeybox);
// clang-format on
@@ -2873,6 +2879,18 @@ extern "C" OEMCryptoResult OEMCrypto_FreeSecureBuffer(
return pair.fcn->FreeSecureBuffer(pair.session, output_descriptor, secure_fd);
}
extern "C" OEMCryptoResult OEMCrypto_OPK_SerializationVersion(
uint32_t* ree_major, uint32_t* ree_minor, uint32_t* tee_major,
uint32_t* tee_minor) {
if (!gAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = gAdapter->GetFunctionPointers(kLevelDefault);
if (!fcn || fcn->OPK_SerializationVersion == nullptr) {
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
}
return fcn->OPK_SerializationVersion(ree_major, ree_minor, tee_major,
tee_minor);
}
extern "C" OEMCryptoResult OEMCrypto_GenerateOTARequest(
OEMCrypto_SESSION session, uint8_t* buffer, size_t* buffer_length,
uint32_t use_test_key) {