blob: 7bb8a866c120cbccc6c539adfe931d0011b4e292 [file] [log] [blame]
#ifndef H_TE200_CIPHER_OPTEE_H
#define H_TE200_CIPHER_OPTEE_H
#define OPTEE_AES_ACCESS_UUID \
{ \
0xba1b496f, 0xf07d, 0x466e, \
{ 0x99, 0x09, 0xeb, 0xe3, 0x55, 0x43, 0xa0, 0x1c } \
}
/*
* AES ECB encrypt/decrypt data with HWKEY(RKEK)
*
* [in] params[0].memref.buffer plain/cipher text to encrypt/decrypt
* [in] params[0].memref.size length of plain/cipher text
* [out] pParams[1].memref.buffer cipher/plain text after encrypt/decrypt
* [in] pParams[2].value.a keysize
* [in] pParams[2].value.b op_mode: 1--encrypt, 0--decrypt
*/
#define CMD_AES_HWKEY_ECB 0x1
/*
* AES CBC encrypt/decrypt data with HWKEY(RKEK)
*
* [in] params[0].memref.buffer plain/cipher text to encrypt/decrypt
* [in] params[0].memref.size length of plain/cipher text
* [out] pParams[1].memref.buffer cipher/plain text after encrypt/decrypt
* [in] pParams[2].value.a keysize
* [in] pParams[2].value.b op_mode: 1--encrypt, 0--decrypt
* [in] pParams[3].memref.buffer initial vector
*/
#define CMD_AES_HWKEY_CBC 0x2
/*
* Check AES RKEK status
* 0: RKEK(hwkey) is not burned
* 1: RKEK(hwkey) is burned and software access is disabled
* 2: RKEK(hwkey) is burned but software access is not disabled)
*
* [out] pParams[0].value.a status
*/
#define CMD_AES_HWKEY_STATUS 0x3
/*
* AES ECB encrypt/decrypt data with input key
*
* [in] params[0].memref.buffer plain/cipher text to encrypt/decrypt
* [in] params[0].memref.size length of plain/cipher text
* [out] pParams[1].memref.buffer cipher/plain text after encrypt/decrypt
* [in] pParams[2].value.a op_mode: 1--encrypt, 0--decrypt
* [in] pParams[3].memref.buffer input key
* [in] pParams[3].memref.size keysize
*/
#define CMD_AES_ECB 0x4
/*
* AES CBC encrypt/decrypt data with input key
*
* [in] params[0].memref.buffer plain/cipher text to encrypt/decrypt
* [in] params[0].memref.size length of plain/cipher text
* [out] pParams[1].memref.buffer cipher/plain text after encrypt/decrypt
* [in] pParams[2].value.a op_mode: 1--encrypt, 0--decrypt
* [in] pParams[2].value.b keysize
* [in] pParams[3].memref.buffer input key + initial vector
* [in] pParams[3].memref.size keysize + ivsize
*/
#define CMD_AES_CBC 0x5
int aes_ecb_encrypt_optee(uint8_t *key, uint32_t key_len, bool use_rkek,
void *in, void *out, uint32_t size);
int aes_ecb_decrypt_optee(uint8_t *key, uint32_t key_len, bool use_rkek,
void *in, void *out, uint32_t size);
int aes_cbc_encrypt_optee(uint8_t *iv, uint8_t *key, uint32_t key_len,
bool use_rkek, void *in, void *out, uint32_t size);
int aes_cbc_decrypt_optee(uint8_t *iv, uint8_t *key, uint32_t key_len,
bool use_rkek, void *in, void *out, uint32_t size);
#endif