Changes from Widevine CDM repo
Squashed commit of these CLs from the widevine cdm repo: Update YT CP server URI to point to the UAT server https://widevine-internal-review.googlesource.com/#/c/9327/ OEMCrypto Version 9 API https://widevine-internal-review.googlesource.com/#/c/9142/ Correct Device ID length in OEMCrypto reference version https://widevine-internal-review.googlesource.com/#/c/8723/ Modify tests to prevent intermittent failures https://widevine-internal-review.googlesource.com/#/c/8982/ Generate a unique license request ID https://widevine-internal-review.googlesource.com/#/c/8721/ Re-enable android timer mechanisms https://widevine-internal-review.googlesource.com/#/c/8833/ Do not close CDM session on removeKeys https://widevine-internal-review.googlesource.com/#/c/8703/ And numerous changes required by Eureka, Steel, and CTE versions of Widevine CDM, as highlighted here: https://widevine-internal-review.googlesource.com/#/c/8596/ https://widevine-internal-review.googlesource.com/#/c/8955/ https://widevine-internal-review.googlesource.com/#/c/8922/ https://widevine-internal-review.googlesource.com/#/c/8890/ https://widevine-internal-review.googlesource.com/#/c/8871/ https://widevine-internal-review.googlesource.com/#/c/8706/ https://widevine-internal-review.googlesource.com/#/c/8425/ Change-Id: Iafd33905227e74eb2132c240b929d2282ab68042
This commit is contained in:
@@ -192,7 +192,8 @@ typedef enum OEMCrypto_Algorithm {
|
||||
#define OEMCrypto_FirstSubsample 1
|
||||
#define OEMCrypto_LastSubsample 2
|
||||
|
||||
/* OEMCrypto_Usage_Entry_Status.
|
||||
/*
|
||||
* OEMCrypto_Usage_Entry_Status.
|
||||
* Valid values for status in the usage table.
|
||||
*/
|
||||
typedef enum OEMCrypto_Usage_Entry_Status {
|
||||
@@ -215,7 +216,8 @@ typedef struct {
|
||||
uint8_t pst[];
|
||||
} OEMCrypto_PST_Report;
|
||||
|
||||
/* OEMCrypto_Clock_Security_Level.
|
||||
/*
|
||||
* OEMCrypto_Clock_Security_Level.
|
||||
* Valid values for clock_security_level in OEMCrypto_PST_Report.
|
||||
*/
|
||||
typedef enum OEMCrypto_Clock_Security_Level {
|
||||
@@ -231,7 +233,9 @@ typedef enum RSA_Padding_Scheme {
|
||||
} RSA_Padding_Scheme;
|
||||
|
||||
|
||||
/* Obfuscation Renames. */
|
||||
/*
|
||||
* Obfuscation Renames.
|
||||
*/
|
||||
#define OEMCrypto_Initialize _oecc01
|
||||
#define OEMCrypto_Terminate _oecc02
|
||||
#define OEMCrypto_InstallKeybox _oecc03
|
||||
@@ -270,23 +274,22 @@ typedef enum RSA_Padding_Scheme {
|
||||
/*
|
||||
* OEMCrypto_Initialize
|
||||
*
|
||||
|
||||
Initializes the crypto hardware.
|
||||
|
||||
Parameters:
|
||||
None
|
||||
|
||||
Returns:
|
||||
OEMCrypto_SUCCESS success
|
||||
OEMCrypto_ERROR_INIT_FAILED failed to initialize crypto hardware
|
||||
|
||||
Threading:
|
||||
No other function calls will be made while this function is running. This
|
||||
function will not be called again before OEMCrypto_Terminate().
|
||||
|
||||
Version:
|
||||
This method is supported by all API versions.
|
||||
|
||||
* Description:
|
||||
* Initialize the crypto firmware/hardware.
|
||||
*
|
||||
* Parameters:
|
||||
* N/A
|
||||
*
|
||||
* Threading:
|
||||
* No other function calls will be made while this function is running. This
|
||||
* function will not be called again before OEMCrypto_Terminate.
|
||||
*
|
||||
* Returns:
|
||||
* OEMCrypto_SUCCESS success
|
||||
* OEMCrypto_ERROR_INIT_FAILED failed to initialize crypto hardware
|
||||
*
|
||||
* Version:
|
||||
* This method is supported by all API versions.
|
||||
*/
|
||||
OEMCryptoResult OEMCrypto_Initialize(void);
|
||||
|
||||
@@ -428,8 +431,12 @@ OEMCryptoResult OEMCrypto_GenerateDerivedKeys(
|
||||
*
|
||||
* Because the nonce will be used to prevent replay attacks, it is desirable
|
||||
* that a rogue application cannot rapidly call this function until a
|
||||
* repeated nonce is created randomly. With this in mind, we require that
|
||||
* creation of more than 20 nonces will take at least one full second.
|
||||
* repeated nonce is created randomly. With this in mind, if more than 20
|
||||
* nonces are requested within one second, OEMCrypto will return an error
|
||||
* after the 20th and not generate any more nonces for the rest of the
|
||||
* second. After an error, if the application waits at least one second
|
||||
* before requesting more nonces, then OEMCrypto will reset the error
|
||||
* condition and generate valid nonces again.
|
||||
*
|
||||
* Parameters:
|
||||
* session (in) - crypto session identifier.
|
||||
@@ -1028,52 +1035,52 @@ OEMCryptoResult OEMCrypto_InstallKeybox(const uint8_t *keybox,
|
||||
/*
|
||||
* OEMCrypto_IsKeyboxValid
|
||||
*
|
||||
Validates the Widevine Keybox loaded into the security processor device. This
|
||||
method verifies two fields in the keybox:
|
||||
|
||||
Verify the MAGIC field contains a valid signature (such as, ‘k’’b’’o’’x’).
|
||||
|
||||
Compute the CRC using CRC-32-POSIX-1003.2 standard and compare the checksum
|
||||
to the CRC stored in the Keybox. The CRC is computed over the entire Keybox
|
||||
excluding the 4 bytes of the CRC (for example, Keybox[0..123]). For a
|
||||
description of the fields stored in the keybox, see Keybox Definition.
|
||||
|
||||
Parameters:
|
||||
none
|
||||
|
||||
Returns:
|
||||
OEMCrypto_SUCCESS
|
||||
OEMCrypto_ERROR_BAD_MAGIC
|
||||
OEMCrypto_ERROR_BAD_CRC
|
||||
|
||||
Threading:
|
||||
This function may be called simultaneously with any session functions.
|
||||
|
||||
Version:
|
||||
This method is supported in all API versions.
|
||||
* Description:
|
||||
* Validate the Widevine Keybox stored on the device.
|
||||
*
|
||||
* The API performs two verification steps on the Keybox. It first verifies
|
||||
* the MAGIC field contains a valid signature (must be 'kbox'). The API then
|
||||
* computes the CRC using CRC-32 (Posix 1003.2 standard) and compares the
|
||||
* checksum to the CRC stored in the Keybox. The CRC is computed over the
|
||||
* entire Keybox excluding the 4 CRC bytes (i.e. Keybox[0..123]).
|
||||
*
|
||||
* Parameters:
|
||||
* none
|
||||
*
|
||||
* Threading:
|
||||
* This function may be called simultaneously with any session functions.
|
||||
*
|
||||
* Returns:
|
||||
* OEMCrypto_SUCCESS
|
||||
* OEMCrypto_ERROR_BAD_MAGIC
|
||||
* OEMCrypto_ERROR_BAD_CRC
|
||||
*
|
||||
* Version:
|
||||
* This method is supported by all API versions.
|
||||
*/
|
||||
OEMCryptoResult OEMCrypto_IsKeyboxValid(void);
|
||||
|
||||
/*
|
||||
* OEMCrypto_GetDeviceID
|
||||
*
|
||||
Retrieve DeviceID from the Keybox.
|
||||
|
||||
Parameters:
|
||||
[out] deviceId - pointer to the buffer that receives the Device ID
|
||||
[in/out] idLength – on input, size of the caller’s device ID buffer. On
|
||||
output, the number of bytes written into the buffer.
|
||||
|
||||
Returns:
|
||||
OEMCrypto_SUCCESS success
|
||||
OEMCrypto_ERROR_SHORT_BUFFER if the buffer is too small to return device ID
|
||||
OEMCrypto_ERROR_NO_DEVICEID failed to return Device Id
|
||||
|
||||
Threading:
|
||||
This function may be called simultaneously with any session functions.
|
||||
|
||||
Version:
|
||||
This method is supported in all API versions.
|
||||
* Description:
|
||||
* Retrieve the device's unique identifier from the Keybox.
|
||||
*
|
||||
* Parameters:
|
||||
* deviceId (out) - pointer to the buffer that receives the Device ID
|
||||
* idLength (in/out) - on input, size of the caller's device ID buffer.
|
||||
* On output, the number of bytes written into the buffer.
|
||||
*
|
||||
* Threading:
|
||||
* This function may be called simultaneously with any session functions.
|
||||
*
|
||||
* Returns:
|
||||
* OEMCrypto_SUCCESS success
|
||||
* OEMCrypto_ERROR_SHORT_BUFFER buffer is too small to return the device ID
|
||||
* OEMCrypto_ERROR_NO_DEVICEID failed to return Device Id
|
||||
*
|
||||
* Version:
|
||||
* This method is supported by all API versions.
|
||||
*/
|
||||
OEMCryptoResult OEMCrypto_GetDeviceID(uint8_t* deviceID,
|
||||
size_t *idLength);
|
||||
@@ -1081,24 +1088,31 @@ OEMCryptoResult OEMCrypto_GetDeviceID(uint8_t* deviceID,
|
||||
/*
|
||||
* OEMCrypto_GetKeyData
|
||||
*
|
||||
Return the Key Data field from the Keybox.
|
||||
|
||||
Parameters:
|
||||
[out] keyData - pointer to the buffer to hold the Key Data field from the
|
||||
Keybox
|
||||
[in/out] keyDataLength – on input, the allocated buffer size. On output, the
|
||||
number of bytes in Key Data
|
||||
|
||||
Returns:
|
||||
OEMCrypto_SUCCESS success
|
||||
OEMCrypto_ERROR_SHORT_BUFFER if the buffer is too small to return KeyData
|
||||
OEMCrypto_ERROR_NO_KEYDATA
|
||||
|
||||
Threading:
|
||||
This function may be called simultaneously with any session functions.
|
||||
|
||||
Version:
|
||||
This method is supported in all API versions.
|
||||
* Description:
|
||||
* Returns the Key Data field from the Keybox. The Key Data field does not
|
||||
* need to be encrypted by an OEM root key, but may be if desired.
|
||||
*
|
||||
* If the Key Data field was encrypted with an OEM root key when the Keybox
|
||||
* was stored on the device, then this function should decrypt it and return
|
||||
* the clear Key Data. If the Key Data was not encrypted, then this function
|
||||
* should just access and return the clear Key data.
|
||||
*
|
||||
* Parameters:
|
||||
* keyData (out) - pointer to a caller-managed buffer to hold the Key Data
|
||||
* field from the Keybox
|
||||
* dataLength (in/out) - on input, the allocated buffer size. On output,
|
||||
* the number of bytes in KeyData.
|
||||
*
|
||||
* Threading:
|
||||
* This function may be called simultaneously with any session functions.
|
||||
*
|
||||
* Returns:
|
||||
* OEMCrypto_SUCCESS success
|
||||
* OEMCrypto_ERROR_SHORT_BUFFER the buffer is too small to return the KeyData
|
||||
* OEMCrypto_ERROR_NO_KEYDATA failed to return KeyData
|
||||
*
|
||||
* Version:
|
||||
* This method is supported by all API versions.
|
||||
*/
|
||||
OEMCryptoResult OEMCrypto_GetKeyData(uint8_t* keyData,
|
||||
size_t *keyDataLength);
|
||||
@@ -1106,23 +1120,25 @@ OEMCryptoResult OEMCrypto_GetKeyData(uint8_t* keyData,
|
||||
/*
|
||||
* OEMCrypto_GetRandom
|
||||
*
|
||||
Returns a buffer filled with hardware-generated random bytes, if supported by
|
||||
the hardware.
|
||||
|
||||
Parameters:
|
||||
[out] randomData - pointer to the buffer that receives random data
|
||||
[in] dataLength - length of the random data buffer in bytes
|
||||
|
||||
Returns:
|
||||
OEMCrypto_SUCCESS success
|
||||
OEMCrypto_ERROR_RNG_FAILED failed to generate random number
|
||||
OEMCrypto_ERROR_RNG_NOT_SUPPORTED function not supported
|
||||
|
||||
Threading:
|
||||
This function may be called simultaneously with any session functions.
|
||||
|
||||
Version:
|
||||
This method is supported in all API versions.
|
||||
* Description:
|
||||
* Return a buffer filled with hardware-generated random bytes. If the
|
||||
* hardware feature does not exist, return OEMCrypto_ERROR_RNG_NOT_SUPPORTED.
|
||||
*
|
||||
* Parameters:
|
||||
* randomData (out) - Pointer to caller-manager buffer that will receive the
|
||||
* random data.
|
||||
* dataLength (in) - Length of the random data buffer in bytes.
|
||||
*
|
||||
* Threading:
|
||||
* This function may be called simultaneously with any session functions.
|
||||
*
|
||||
* Returns:
|
||||
* OEMCrypto_SUCCESS success
|
||||
* OEMCrypto_ERROR_RNG_FAILED failed to generate random number
|
||||
* OEMCrypto_ERROR_RNG_NOT_SUPPORTED function not supported
|
||||
*
|
||||
* Version:
|
||||
* This method is supported by all API versions.
|
||||
*/
|
||||
OEMCryptoResult OEMCrypto_GetRandom(uint8_t* randomData,
|
||||
size_t dataLength);
|
||||
@@ -1263,8 +1279,6 @@ OEMCryptoResult OEMCrypto_RewrapDeviceRSAKey(OEMCrypto_SESSION session,
|
||||
* - padding. This is the wrapped key generated
|
||||
* - by OEMCrypto_RewrapDeviceRSAKey.
|
||||
* wrapped_rsa_key_length (in) - length of the wrapped key buffer, in bytes.
|
||||
* wrapped_rsa_key_iv (in) - The initialization vector used to encrypt
|
||||
* - wrapped_rsa_key.
|
||||
*
|
||||
* Threading:
|
||||
* This function may be called simultaneously with functions on other sessions,
|
||||
@@ -1546,41 +1560,25 @@ bool OEMCrypto_SupportsUsageTable();
|
||||
* that entry is “inactive”, then return OEMCrypto_ERROR_INVALID_SESSION.
|
||||
*
|
||||
* Parameters:
|
||||
* current (out) - this is the current HDCP version, based on the device itself,
|
||||
* and the display to which it is connected.
|
||||
* maximum (out) - this is the maximum supported HDCP version for the device,
|
||||
* ignoring any attached device.
|
||||
*
|
||||
* Threading:
|
||||
* This function may be called simultaneously with any other functions.
|
||||
* session (in) - crypto session identifier.
|
||||
* in_buffer (in) - pointer to memory containing data to be encrypted.
|
||||
* buffer_length (in) - length of the buffer, in bytes.
|
||||
* iv (in) - IV for encrypting data. Size is specified by the algorithm.
|
||||
* algorithm (in) - Specifies which encryption algorithm to use. See
|
||||
* OEMCrypto_Algorithm for valid values.
|
||||
* out_buffer (out) - pointer to buffer in which encrypted data should be stored.
|
||||
*
|
||||
* Returns:
|
||||
* OEMCrypto_SUCCESS
|
||||
* OEMCrypto_ERROR_UNKNOWN_FAILURE
|
||||
*
|
||||
* Version:
|
||||
* This method changed in API version 9.
|
||||
*/
|
||||
typedef uint8_t OEMCrypto_HDCP_Capability;
|
||||
OEMCryptoResult OEMCrypto_GetHDCPCapability(OEMCrypto_HDCP_Capability *current,
|
||||
OEMCrypto_HDCP_Capability *maximum);
|
||||
|
||||
/*
|
||||
* OEMCrypto_SupportsUsageTable()
|
||||
*
|
||||
* Description:
|
||||
* This is used to determine if the device can support a usage table. Since this
|
||||
* function is spoofable, it is not relied on for security purposes. It is for
|
||||
* information only. The usage table is described in the section above.
|
||||
*
|
||||
* Parameters:
|
||||
* none
|
||||
* OEMCrypto_SUCCESS success
|
||||
* OEMCrypto_ERROR_KEY_EXPIRED
|
||||
* OEMCrypto_ERROR_NO_DEVICE_KEY
|
||||
* OEMCrypto_ERROR_INVALID_SESSION
|
||||
* OEMCrypto_ERROR_INSUFFICIENT_RESOURCES
|
||||
* OEMCrypto_ERROR_UNKNOWN_FAILURE
|
||||
*
|
||||
* Threading:
|
||||
* This function may be called simultaneously with any other functions.
|
||||
*
|
||||
* Returns:
|
||||
* Returns true if the device can maintain a usage table. Returns false otherwise.
|
||||
* This function may be called simultaneously with functions on other sessions,
|
||||
* but not with other functions on this session.
|
||||
*
|
||||
* Version:
|
||||
* This method changed in API version 9.
|
||||
|
||||
@@ -125,7 +125,7 @@ OEMCryptoResult Level3_GenerateRSASignature(OEMCrypto_SESSION session,
|
||||
size_t message_length,
|
||||
uint8_t* signature,
|
||||
size_t *signature_length,
|
||||
RSA_Padding_Scheme algorithm);
|
||||
RSA_Padding_Scheme padding_scheme);
|
||||
OEMCryptoResult Level3_DeriveKeysFromSessionKey(OEMCrypto_SESSION session,
|
||||
const uint8_t* enc_session_key,
|
||||
size_t enc_session_key_length,
|
||||
|
||||
Reference in New Issue
Block a user