blob: 9525aba09cfb6c054bc4e8cb1c141aaf8cec2fd3 [file] [log] [blame]
#ifndef _ASR_CIPHER_H_
#define _ASR_CIPHER_H_
#include <common.h>
#define BYTES_TO_BITS 8
typedef struct {
uint32_t paddr;
uint32_t size;
uint32_t next_desc;
uint32_t reserved;
} DMA_DESC_T;
struct rijndael_key {
uint8_t K[(60 + 60 + 4) * sizeof(uint32_t)];
uint32_t *eK;
uint32_t *dK;
int Nr;
};
typedef union Symmetric_key {
struct rijndael_key rijndael;
} symmetric_key;
typedef enum {
EXT_KEY = 0,
RK_KEY,
SSK_KEY,
} AES_KEY_SELECT_T;
typedef enum {
AES_128 = 128/8,
AES_192 = 192/8,
AES_256 = 256/8,
} AES_KEY_LEN_T;
typedef enum {
AES_ECB_ALG = 0,
AES_CBC_ALG,
AES_CTR_ALG,
AES_XTS_ALG,
AES_KEYWRAP,
} AES_MODE_T;
typedef enum {
AES_DECRYPT_OP = 0,
AES_ENCRYPT_OP,
} AES_OP_MODE_T;
typedef enum {
ENG_AES = 0,
ENG_DES,
ENG_RC4,
} CRYPTO_ENG_SEL_T;
/* aes APIs*/
int aes_ecb_encrypt_bcm(uint8_t *key, uint32_t key_len, bool use_rkek,
void *in, void *out, uint32_t size);
int aes_ecb_decrypt_bcm(uint8_t *key, uint32_t key_len, bool use_rkek,
void *in, void *out, uint32_t size);
int aes_cbc_encrypt_bcm(uint8_t *iv, uint8_t *key, uint32_t key_len,
bool use_rkek, void *in, void *out, uint32_t size);
int aes_cbc_decrypt_bcm(uint8_t *iv, uint8_t *key, uint32_t key_len,
bool use_rkek, void *in, void *out, uint32_t size);
#endif