Add OEMCrypto_FactoryInstallBCCSignature API

This was requested by OEM and SOCs to support Prov 4 signing
model in the factory.

Bug: 275567037
Merged from https://widevine-internal-review.googlesource.com/176310

Change-Id: I2907841c4a16f37ae9a2241a6c9eaad73ff616af
This commit is contained in:
Fred Gylys-Colwell
2023-06-02 17:11:41 -07:00
committed by Robert Shih
parent dd1c01c9dd
commit f6c1879b4c
2 changed files with 51 additions and 1 deletions

View File

@@ -122,6 +122,8 @@ typedef OEMCryptoResult (*L1_WrapKeybox_t)(const uint8_t* keybox,
size_t transportKeyLength);
typedef OEMCryptoResult (*L1_InstallKeyboxOrOEMCert_t)(const uint8_t* keybox,
size_t keyBoxLength);
typedef OEMCryptoResult (*L1_FactoryInstallBCCSignature_t)(
const uint8_t* signature, size_t signature_length);
typedef OEMCryptoResult (*L1_LoadTestKeybox_t)(const uint8_t* buffer,
size_t length);
typedef OEMCryptoResult (*L1_IsKeyboxOrOEMCertValid_t)();
@@ -339,6 +341,7 @@ struct FunctionPointers {
L1_CopyBuffer_t CopyBuffer;
L1_WrapKeybox_t WrapKeybox;
L1_InstallKeyboxOrOEMCert_t InstallKeyboxOrOEMCert;
L1_FactoryInstallBCCSignature_t FactoryInstallBCCSignature;
L1_LoadTestKeybox_t LoadTestKeybox;
L1_IsKeyboxOrOEMCertValid_t IsKeyboxOrOEMCertValid;
L1_GetDeviceID_t GetDeviceID;
@@ -967,6 +970,7 @@ class Adapter {
LOOKUP_ALL(12, GetProvisioningMethod, OEMCrypto_GetProvisioningMethod);
LOOKUP_ALL( 8, GetRandom, OEMCrypto_GetRandom);
LOOKUP_ALL( 8, InstallKeyboxOrOEMCert, OEMCrypto_InstallKeyboxOrOEMCert);
LOOKUP_ALL(18, FactoryInstallBCCSignature, OEMCrypto_FactoryInstallBCCSignature);
LOOKUP_ALL(10, IsAntiRollbackHwPresent, OEMCrypto_IsAntiRollbackHwPresent);
LOOKUP_ALL( 8, IsKeyboxOrOEMCertValid, OEMCrypto_IsKeyboxOrOEMCertValid);
LOOKUP( 8, 15, LoadDeviceRSAKey, OEMCrypto_LoadDeviceRSAKey);
@@ -2252,6 +2256,16 @@ extern "C" OEMCryptoResult OEMCrypto_InstallKeyboxOrOEMCert(
return OEMCrypto_InstallKeyboxOrOEMCert(keybox, keyBoxLength, kLevelDefault);
}
extern "C" OEMCryptoResult OEMCrypto_FactoryInstallBCCSignature(
const uint8_t* signature, size_t signature_length) {
if (!gAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = gAdapter->GetFunctionPointers(kLevelDefault);
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
if (fcn->FactoryInstallBCCSignature == nullptr)
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
return fcn->FactoryInstallBCCSignature(signature, signature_length);
}
extern "C" OEMCryptoResult OEMCrypto_LoadTestKeybox(const uint8_t* buffer,
size_t length) {
if (!gAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;