ODK unit tests for release request

PiperOrigin-RevId: 584427947
Change-Id: I7a131739c5ea0d27c2f9e9c5ecb7b138176ce049
This commit is contained in:
Vicky Min
2023-11-21 14:21:06 -08:00
committed by Robert Shih
parent 91e573f574
commit 726f2d51e9
7 changed files with 160 additions and 15 deletions

View File

@@ -295,8 +295,6 @@ OEMCryptoResult ODK_PrepareCoreLicenseRequest(
* of the message. (in) size of buffer reserved for the core message, in
* bytes. (out) actual length of the core message, in bytes.
* @param[in] nonce_values: pointer to the session's nonce data.
* @param[in] message_count_info: information used for server-side anomaly
* detection
* @param[in] status: the enumeration of OEMCrypto_Usage_Entry_Status
* @param[in] clock_security_level: the enumeration of
* OEMCryto_Clock_Security_Level
@@ -304,6 +302,9 @@ OEMCryptoResult ODK_PrepareCoreLicenseRequest(
* being requested and the release being generated in seconds
* @param[in] seconds_since_first_decrypt: The time since playback has started
* in seconds
* @param[in,out] clock_values: the session's clock values.
* @param[in] system_time_seconds: the current time on OEMCrypto's clock, in
* seconds.
*
* @retval OEMCrypto_SUCCESS
* @retval OEMCrypto_ERROR_SHORT_BUFFER: core_message_size is too small
@@ -314,10 +315,10 @@ OEMCryptoResult ODK_PrepareCoreLicenseRequest(
*/
OEMCryptoResult ODK_PrepareCoreReleaseRequest(
uint8_t* message, size_t message_length, size_t* core_message_size,
const ODK_NonceValues* nonce_values,
const ODK_MessageCounterInfo* counter_info, uint32_t status,
ODK_NonceValues* nonce_values, uint32_t status,
uint32_t clock_security_level, int64_t seconds_since_license_requested,
int64_t seconds_since_first_decrypt);
int64_t seconds_since_first_decrypt, ODK_ClockValues* clock_values,
uint64_t system_time_seconds);
/**
* Modifies the message to include a core renewal request at the beginning of
@@ -666,6 +667,7 @@ OEMCryptoResult ODK_ParseLicense(
* value is ODK_SET_TIMER. This must be non-null if OEMCrypto uses a
* hardware timer.
*
* @retval OEMCrypto_SUCCESS
* @retval ODK_ERROR_CORE_MESSAGE: the message did not parse correctly, or there
* were other incorrect values. An error should be returned to the CDM
* layer.
@@ -690,6 +692,39 @@ OEMCryptoResult ODK_ParseRenewal(const uint8_t* message, size_t message_length,
ODK_ClockValues* clock_values,
uint64_t* timer_value);
/**
* The function ODK_ParseRelease will parse the message and verify its
* header contents. If the message does not parse correctly, an error of
* ODK_ERROR_CORE_MESSAGE is returned. This function is mostly a placeholder
* function since there is no information needed in the release response.
*
* @param[in] message: pointer to the message buffer.
* @param[in] message_length: length of the entire message buffer.
* @param[in] core_message_size: length of the core message, at the beginning of
* the message buffer.
* @param[in,out] nonce_values: pointer to the session's nonce data. These might
* be updated if the server returns a lower API version.
* @param[in] seconds_since_license_requested: the time between the license
* being requested and the release being generated in seconds.
* @param[in] seconds_since_first_decrypt: The time since playback has started
* in seconds.
*
* @retval OEMCrypto_SUCCESS
* @retval ODK_ERROR_CORE_MESSAGE: the message did not parse correctly, or there
* were other incorrect values. An error should be returned to the CDM
* layer.
* @retval ODK_UNSUPPORTED_API
* @retval OEMCrypto_ERROR_INVALID_NONCE
*
* @version
* This method is new in version 19 of the API.
*/
OEMCryptoResult ODK_ParseRelease(const uint8_t* message, size_t message_length,
size_t core_message_length,
ODK_NonceValues* nonce_values,
int64_t seconds_since_license_requested,
int64_t seconds_since_first_decrypt);
/**
* The function ODK_ParseProvisioning will parse the message and verify the
* nonce values match those in the license.

View File

@@ -19,7 +19,7 @@ extern "C" {
#define ODK_MINOR_VERSION 0
/* ODK Version string. Date changed automatically on each release. */
#define ODK_RELEASE_DATE "ODK v19.0 2023-11-10"
#define ODK_RELEASE_DATE "ODK v19.0 2023-11-21"
/* The lowest version number for an ODK message. */
#define ODK_FIRST_VERSION 16