Add OEMCrypto_WrapClearPrivateKey()
Bug: 306059409 Test: WVTS Change-Id: Ifce5824b455c276c6fc0753de7932a5b69dffd1f (cherry picked from commit f4679aac18de5dbe2bc22501294e719a55d51199)
This commit is contained in:
committed by
Rahul Frias
parent
df29c42108
commit
77e8597bf9
@@ -313,6 +313,9 @@ typedef OEMCryptoResult (*L1_Generic_Verify_t)(
|
||||
typedef OEMCryptoResult (*L1_GetSignatureHashAlgorithm_t)(
|
||||
OEMCrypto_SESSION session, OEMCrypto_SignatureHashAlgorithm* algorithm);
|
||||
typedef OEMCryptoResult (*L1_EnterTestMode_t)(void);
|
||||
typedef OEMCryptoResult (*L1_WrapClearPrivateKey_t)(
|
||||
const uint8_t* clear_private_key_bytes, size_t clear_private_key_length,
|
||||
uint8_t* wrapped_private_key, size_t* wrapped_private_key_length);
|
||||
|
||||
struct FunctionPointers {
|
||||
wvcdm::CdmSecurityLevel security_level;
|
||||
@@ -417,6 +420,7 @@ struct FunctionPointers {
|
||||
L1_Generic_Verify_t Generic_Verify;
|
||||
L1_GetSignatureHashAlgorithm_t GetSignatureHashAlgorithm;
|
||||
L1_EnterTestMode_t EnterTestMode;
|
||||
L1_WrapClearPrivateKey_t WrapClearPrivateKey;
|
||||
};
|
||||
|
||||
// The WatchDog looks after a worker thread that is trying to initialize L3.
|
||||
@@ -1028,6 +1032,7 @@ class Adapter {
|
||||
LOOKUP_ALL(18, Generic_Verify, OEMCrypto_Generic_Verify);
|
||||
LOOKUP_ALL(18, GetSignatureHashAlgorithm, OEMCrypto_GetSignatureHashAlgorithm);
|
||||
LOOKUP_ALL(18, EnterTestMode, OEMCrypto_EnterTestMode);
|
||||
LOOKUP_ALL(18, WrapClearPrivateKey, OEMCrypto_WrapClearPrivateKey);
|
||||
|
||||
// clang-format on
|
||||
|
||||
@@ -2940,3 +2945,16 @@ extern "C" OEMCrypto_WatermarkingSupport OEMCrypto_GetWatermarkingSupport(
|
||||
extern "C" OEMCryptoResult OEMCrypto_ProductionReady(void) {
|
||||
return wvcdm::OEMCrypto_ProductionReady(kLevelDefault);
|
||||
}
|
||||
|
||||
extern "C" OEMCryptoResult OEMCrypto_WrapClearPrivateKey(
|
||||
const uint8_t* clear_private_key_bytes, size_t clear_private_key_length,
|
||||
uint8_t* wrapped_private_key, size_t* wrapped_private_key_length) {
|
||||
if (!gAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
|
||||
const FunctionPointers* fcn = gAdapter->GetFunctionPointers(kLevelDefault);
|
||||
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
|
||||
if (fcn->WrapClearPrivateKey == nullptr)
|
||||
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||
return fcn->WrapClearPrivateKey(clear_private_key_bytes,
|
||||
clear_private_key_length, wrapped_private_key,
|
||||
wrapped_private_key_length);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user