OEMCrypto unit tests for license release

Bug: 295956275
Change-Id: I3c8fc5fcadeae051cc734a64378e473492437c34
This commit is contained in:
Vicky Min
2023-12-05 01:36:58 +00:00
committed by Robert Shih
parent f94a8dfac9
commit d5157c536d
7 changed files with 233 additions and 21 deletions

View File

@@ -732,6 +732,7 @@ typedef enum OEMCrypto_SignatureHashAlgorithm {
#define OEMCrypto_PrepAndSignReleaseRequest _oecc147
#define OEMCrypto_GetUsageEntryInfo _oecc148
#define OEMCrypto_GetBCCType _oecc149
#define OEMCrypto_LoadRelease _oecc150
// clang-format on
/// @addtogroup initcontrol
@@ -1582,6 +1583,53 @@ OEMCryptoResult OEMCrypto_LoadRenewal(OEMCrypto_SESSION session,
const uint8_t* signature,
size_t signature_length);
/**
* If the signature passes, OEMCrypto shall use the function
* ODK_ParseRelease, as described in the document "Widevine Core Message
* Serialization" to parse and verify the message. If ODK_ParseRelease
* returns an error, OEMCrypto returns the error to the CDM layer.
*
* NOTE: OEMCrypto_LoadLicense() must be called first to load the keys into
* the session.
*
* @verification
* The signature of the message shall be computed using mac_key[server], and
* the API shall verify the computed signature matches the signature passed
* in. If not, return OEMCrypto_ERROR_SIGNATURE_FAILURE. The signature
* verification shall use a constant-time algorithm (a signature mismatch
* will always take the same time as a successful comparison).
*
* @param[in] session: handle for the session to be used.
* @param[in] message: pointer to memory containing message to be verified.
* @param[in] message_length: length of the message, in bytes.
* @param[in] core_message_length: length of the core submessage, in bytes.
* @param[in] signature: pointer to memory containing the signature.
* @param[in] signature_length: length of the signature, in bytes.
*
* @retval OEMCrypto_SUCCESS success
* @retval OEMCrypto_ERROR_INVALID_SESSION
* @retval OEMCrypto_ERROR_INVALID_CONTEXT
* @retval OEMCrypto_ERROR_UNKNOWN_FAILURE
* @retval OEMCrypto_ERROR_BUFFER_TOO_LARGE
* @retval OEMCrypto_ERROR_SIGNATURE_FAILURE
*
* @threading
* This is a "Session Function" and may be called simultaneously with session
* functions for other sessions but not simultaneously with other functions
* for this session. It will not be called simultaneously with initialization
* or usage table functions. It is as if the CDM holds a write lock for this
* session, and a read lock on the OEMCrypto system.
*
* @version
* This method is new in API version 19.
*/
OEMCryptoResult OEMCrypto_LoadRelease(OEMCrypto_SESSION session,
const uint8_t* message,
size_t message_length,
size_t core_message_length,
const uint8_t* signature,
size_t signature_length);
/**
* Returns the decrypted key control block for the given content_key_id. This
* function is for application developers to debug license server and key

View File

@@ -121,6 +121,9 @@ namespace wvoec3 {
#define Level3_EnterTestMode _lcc140
#define Level3_GetDeviceSignedCsrPayload _lcc141
#define Level3_SetDecryptHash _lcc143
#define Level3_PrepAndSignReleaseRequest _lcc147
#define Level3_GetUsageEntryInfo _lcc148
#define Level3_LoadRelease _lcc150
#else
#define Level3_Initialize _oecc01
#define Level3_Terminate _oecc02
@@ -223,6 +226,10 @@ namespace wvoec3 {
#define Level3_EnterTestMode _oecc140
#define Level3_GetDeviceSignedCsrPayload _oecc141
#define Level3_SetDecryptHash _oecc143
#define Level3_PrepAndSignReleaseRequest _oecc147
#define Level3_GetUsageEntryInfo _oecc148
#define Level3_LoadRelease _oecc150
#endif
#define Level3_GetInitializationState _oecl3o01