Separate OEMCrypto DASH from Legacy OEMCrypto

The file OEMCrypto.h was renamed to OEMCryptoDASH.h and all
functions that are only needed for legacy support were removed.

Change-Id: I3a7a6f8cbb3ee415b4a313416a25ed78785ecdd7
This commit is contained in:
Fred Gylys-Colwell
2012-12-03 14:39:31 -08:00
parent d74290cc9f
commit 4529037bd8
3 changed files with 127 additions and 406 deletions

View File

@@ -3,7 +3,7 @@
*
* (c) Copyright 2011-2012 Google, Inc.
*
* Mock implementation of OEMCrypto.h used for testing.
* Mock implementation of OEMCryptoDASH.h used for testing.
*********************************************************************/
#include <stdlib.h>
@@ -11,7 +11,7 @@
#define LOG_TAG "WV.MockOEMCrypto"
#include <utils/Log.h>
#include "OEMCrypto.h"
#include "OEMCryptoDASH.h"
#include "MockOEMCrypto.h"
void initializeMockOEMCrypto() {
@@ -118,8 +118,8 @@ OEMCryptoResult OEMCrypto_CloseSession(OEMCrypto_SESSION session) {
*/
OEMCryptoResult OEMCrypto_GenerateDerivedKeys(
OEMCrypto_SESSION session,
const OEMCrypto_UINT8 *context,
OEMCrypto_UINT32 context_length) {
const uint8_t *context,
size_t context_length) {
return OEMCrypto_SUCCESS;
}
/*
@@ -153,10 +153,10 @@ OEMCryptoResult OEMCrypto_GenerateDerivedKeys(
*/
OEMCryptoResult OEMCrypto_GenerateSignature(
OEMCrypto_SESSION session,
const OEMCrypto_UINT8* message,
OEMCrypto_UINT32 message_length,
OEMCrypto_UINT8* signature,
OEMCrypto_UINT32* signature_length) {
const uint8_t* message,
size_t message_length,
uint8_t* signature,
size_t* signature_length) {
return OEMCrypto_SUCCESS;
}
@@ -194,13 +194,13 @@ OEMCryptoResult OEMCrypto_GenerateSignature(
*/
OEMCryptoResult OEMCrypto_LoadKeys(
OEMCrypto_SESSION session,
const OEMCrypto_UINT8* message,
OEMCrypto_UINT32 message_length,
const OEMCrypto_UINT8* signature,
OEMCrypto_UINT32 signature_length,
OEMCrypto_UINT32 enc_mac_key_iv_offset,
OEMCrypto_UINT32 enc_mac_key_offset,
OEMCrypto_UINT32 num_keys,
const uint8_t* message,
size_t message_length,
const uint8_t* signature,
size_t signature_length,
size_t enc_mac_key_iv_offset,
size_t enc_mac_key_offset,
size_t num_keys,
const OEMCrypto_KeyObject* key_array) {
return OEMCrypto_SUCCESS;
}
@@ -238,11 +238,11 @@ OEMCryptoResult OEMCrypto_LoadKeys(
*/
OEMCryptoResult OEMCrypto_RefreshKeys(
OEMCrypto_SESSION session,
const OEMCrypto_UINT8* message,
OEMCrypto_UINT32 message_length,
const OEMCrypto_UINT8* signature,
OEMCrypto_UINT32 signature_length,
OEMCrypto_UINT32 num_keys,
const uint8_t* message,
size_t message_length,
const uint8_t* signature,
size_t signature_length,
size_t num_keys,
const OEMCrypto_KeyRefreshObject* key_array) {
return OEMCrypto_SUCCESS;
}
@@ -319,8 +319,8 @@ OEMCryptoResult OEMCrypto_ExitSecurePlayback(void) {
* OEMCrypto_ERROR_NO_ASSET_KEY failed to decrypt asset key
* OEMCrypto_ERROR_KEYBOX_INVALID cannot decrypt and read from Keybox
*/
OEMCryptoResult OEMCrypto_SetEntitlementKey(const OEMCrypto_UINT8* emmKey,
const OEMCrypto_UINT32 emmKeyLength) {
OEMCryptoResult OEMCrypto_SetEntitlementKey(const uint8_t* emmKey,
const size_t emmKeyLength) {
return OEMCrypto_SUCCESS;
}
@@ -344,9 +344,9 @@ OEMCryptoResult OEMCrypto_SetEntitlementKey(const OEMCrypto_UINT8* emmKey,
* OEMCrypto_SUCCESS success
* OEMCrypto_ERROR_NO_CW cannot decrypt control word
*/
OEMCryptoResult OEMCrypto_DeriveControlWord(const OEMCrypto_UINT8* ecm,
const OEMCrypto_UINT32 length,
OEMCrypto_UINT32* flags) {
OEMCryptoResult OEMCrypto_DeriveControlWord(const uint8_t* ecm,
const size_t length,
uint32_t* flags) {
return OEMCrypto_SUCCESS;
}
@@ -402,10 +402,10 @@ OEMCryptoResult OEMCrypto_DeriveControlWord(const OEMCrypto_UINT8* ecm,
* OEMCrypto_ERROR_KEYBOX_INVALID cannot decrypt and read from Keybox
*/
OEMCryptoResult OEMCrypto_SetContentKey(const OEMCrypto_SESSION session,
const OEMCrypto_UINT8* contentKey,
const OEMCrypto_UINT32 contentKeyLength,
const OEMCrypto_UINT8* control,
const OEMCrypto_UINT32 controlLength) {
const uint8_t* contentKey,
const size_t contentKeyLength,
const uint8_t* control,
const size_t controlLength) {
return OEMCrypto_SUCCESS;
}
@@ -439,12 +439,12 @@ OEMCryptoResult OEMCrypto_SetContentKey(const OEMCrypto_SESSION session,
* OEMCrypto_SUCCESS success
* OEMCrypto_ERROR_DECRYPT_FAILED failed decryption
*/
OEMCryptoResult OEMCrypto_DecryptVideo(const OEMCrypto_UINT8* iv,
const OEMCrypto_UINT8* input,
const OEMCrypto_UINT32 inputLength,
OEMCrypto_UINT32 output_handle,
OEMCrypto_UINT32 output_offset,
OEMCrypto_UINT32 *outputLength) {
OEMCryptoResult OEMCrypto_DecryptVideo(const uint8_t* iv,
const uint8_t* input,
const size_t inputLength,
uint32_t output_handle,
size_t output_offset,
size_t *outputLength) {
return OEMCrypto_SUCCESS;
}
@@ -481,11 +481,11 @@ OEMCryptoResult OEMCrypto_DecryptVideo(const OEMCrypto_UINT8* iv,
* OEMCrypto_SUCCESS success
* OEMCrypto_ERROR_DECRYPT_FAILED failed decryption
*/
OEMCryptoResult OEMCrypto_DecryptAudio(const OEMCrypto_UINT8* iv,
const OEMCrypto_UINT8* input,
const OEMCrypto_UINT32 inputLength,
OEMCrypto_UINT8 *output,
OEMCrypto_UINT32 *outputLength) {
OEMCryptoResult OEMCrypto_DecryptAudio(const uint8_t* iv,
const uint8_t* input,
const size_t inputLength,
uint8_t *output,
size_t *outputLength) {
return OEMCrypto_SUCCESS;
}
@@ -564,14 +564,14 @@ OEMCryptoResult OEMCrypto_DecryptAudio(const OEMCrypto_UINT8* iv,
*/
OEMCryptoResult OEMCrypto_DecryptCTR(OEMCrypto_SESSION session_id,
bool is_video,
const OEMCrypto_UINT8 *buffer_addr,
OEMCrypto_UINT32 buffer_length,
const uint8_t *buffer_addr,
size_t buffer_length,
bool is_encrypted,
const OEMCrypto_UINT8 *key_id,
OEMCrypto_UINT32 key_id_length,
const OEMCrypto_UINT8 *iv,
OEMCrypto_UINT32 offset,
OEMCrypto_UINT32 data_length) {
const uint8_t *key_id,
size_t key_id_length,
const uint8_t *iv,
size_t offset,
size_t data_length) {
return OEMCrypto_SUCCESS;
}
@@ -595,8 +595,8 @@ OEMCryptoResult OEMCrypto_DecryptCTR(OEMCrypto_SESSION session_id,
* OEMCrypto_SUCCESS success
* OEMCrypto_ERROR_WRITE_KEYBOX failed to handle and store Keybox
*/
OEMCryptoResult OEMCrypto_InstallKeybox(OEMCrypto_UINT8 *keybox,
OEMCrypto_UINT32 keyBoxLength) {
OEMCryptoResult OEMCrypto_InstallKeybox(uint8_t *keybox,
size_t keyBoxLength) {
return OEMCrypto_SUCCESS;
}
@@ -640,8 +640,8 @@ OEMCryptoResult OEMCrypto_IsKeyboxValid(void) {
* OEMCrypto_ERROR_SHORT_BUFFER if the buffer is too small to return the device ID
* OEMCrypto_ERROR_NO_DEVICEID failed to return Device Id
*/
OEMCryptoResult OEMCrypto_GetDeviceID(OEMCrypto_UINT8* deviceID,
OEMCrypto_UINT32 *idLength) {
OEMCryptoResult OEMCrypto_GetDeviceID(uint8_t* deviceID,
size_t *idLength) {
return OEMCrypto_SUCCESS;
}
@@ -667,8 +667,8 @@ OEMCryptoResult OEMCrypto_GetDeviceID(OEMCrypto_UINT8* deviceID,
* OEMCrypto_ERROR_SHORT_BUFFER if the buffer is too small to return the KeyData
* OEMCrypto_ERROR_NO_KEYDATA failed to return KeyData
*/
OEMCryptoResult OEMCrypto_GetKeyData(OEMCrypto_UINT8* keyData,
OEMCrypto_UINT32 *keyDataLength) {
OEMCryptoResult OEMCrypto_GetKeyData(uint8_t* keyData,
size_t *keyDataLength) {
return OEMCrypto_SUCCESS;
}
@@ -688,8 +688,8 @@ OEMCryptoResult OEMCrypto_GetKeyData(OEMCrypto_UINT8* keyData,
* OEMCrypto_ERROR_RNG_FAILED failed to generate random number
* OEMCrypto_ERROR_RNG_NOT_SUPPORTED function not supported
*/
OEMCryptoResult OEMCrypto_GetRandom(OEMCrypto_UINT8* randomData,
OEMCrypto_UINT32 dataLength) {
OEMCryptoResult OEMCrypto_GetRandom(uint8_t* randomData,
size_t dataLength) {
return OEMCrypto_SUCCESS;
}
@@ -716,12 +716,12 @@ OEMCryptoResult OEMCrypto_GetRandom(OEMCrypto_UINT8* randomData,
* OEMCrypto_SUCCESS success
* OEMCrypto_ERROR_WRAP_KEYBOX failed to wrap Keybox
*/
OEMCryptoResult OEMCrypto_WrapKeybox(OEMCrypto_UINT8 *keybox,
OEMCrypto_UINT32 keyBoxLength,
OEMCrypto_UINT8 *wrappedKeybox,
OEMCrypto_UINT32 *wrappedKeyBoxLength,
OEMCrypto_UINT8 *transportKey,
OEMCrypto_UINT32 transportKeyLength) {
OEMCryptoResult OEMCrypto_WrapKeybox(uint8_t *keybox,
size_t keyBoxLength,
uint8_t *wrappedKeybox,
size_t *wrappedKeyBoxLength,
uint8_t *transportKey,
size_t transportKeyLength) {
return OEMCrypto_SUCCESS;
}
@@ -748,9 +748,9 @@ OEMCryptoResult OEMCrypto_WrapKeybox(OEMCrypto_UINT8 *keybox,
* OEMCrypto_SUCCESS success
* OEMCrypto_ERROR_DECRYPT_FAILED,
*/
OEMCryptoResult OEMCrypto_DecryptCTS(OEMCrypto_UINT8 *pSrcBuf,
OEMCrypto_UINT8 *pDestBuf,
const OEMCrypto_UINT32 length,
const OEMCrypto_UINT8 bInitIvFlg) {
OEMCryptoResult OEMCrypto_DecryptCTS(uint8_t *pSrcBuf,
uint8_t *pDestBuf,
const size_t length,
const uint8_t bInitIvFlg) {
return OEMCrypto_SUCCESS;
}