 |
MAX32665 Peripheral Driver API
Peripheral Driver API for the MAX32665
|
47 #include "trng_regs.h"
62 #define MXC_TPU_CRC32_ETHERNET 0xEDB88320
63 #define MXC_TPU_CRC_CCITT 0x00008408
64 #define MXC_TPU_CRC16 0x0000A001
65 #define MXC_TPU_USBDATA 0x80050000
66 #define MXC_TPU_PARITY 0x00000001
69 #define DES_DATA_LEN 8 // The byte length for DES data block
70 #define AES_DATA_LEN 16 // The byte length for AES data block
71 #define MAX_KEY_SIZE 32 // Defines maximum key length
72 #define MXC_AES_DATA_LEN (128 / 8)
73 #define MXC_AES_KEY_128_LEN (128 / 8)
74 #define MXC_AES_KEY_192_LEN (192 / 8)
75 #define MXC_AES_KEY_256_LEN (256 / 8)
78 #define MAA_MAX_SIZE 256 // in bytes
79 #define MAA_MAX_WORD_SIZE 2048 // in bits
175 int MXC_TPU_CRC(
const uint8_t *src, uint32_t len, uint32_t poly, uint32_t *crc);
int MXC_TPU_Cipher_TDES_Decrypt(const char *ciphertext, const char *iv, const char *key, mxc_tpu_modesel_t mode, unsigned int data_size, char *outptr)
The TDES decryption process.
unsigned int MXC_TPU_Cipher_GetLength(mxc_tpu_ciphersel_t cipher, unsigned int data_size)
Get number of blocks.
#define MXC_V_TPU_MAA_CTRL_CLC_SQ
Definition: tpu_regs.h:370
int MXC_TPU_Ham(const uint8_t *src, uint32_t len, uint32_t *ecc)
Test the CRC process.
unsigned int MXC_TPU_Cipher_Get_Block_Size(mxc_tpu_ciphersel_t cipher)
Get cipher block's size.
#define MXC_V_TPU_CIPHER_CTRL_MODE_CFB
Definition: tpu_regs.h:257
int MXC_TPU_Hash_Config(mxc_tpu_hashfunsel_t func)
Configure crypto hash operation for different hash functions.
int MXC_TPU_Hash_SHA(const char *msg, mxc_tpu_hashfunsel_t fun, unsigned int byteLen, char *digest)
Test the SHA process.
#define MXC_V_TPU_CIPHER_CTRL_MODE_CTR
Definition: tpu_regs.h:261
int MXC_TPU_Cipher_TDES_Encrypt(const char *plaintext, const char *iv, const char *key, mxc_tpu_modesel_t mode, unsigned int data_size, char *outptr)
The TDES encryption process.
int MXC_TPU_CRC_Config(void)
Configure crypto CRC operation.
#define MXC_V_TPU_HASH_CTRL_HASH_SHA384
Definition: tpu_regs.h:288
int MXC_TPU_Cipher_AES_Encrypt(const char *plaintext, const char *iv, const char *key, mxc_tpu_ciphersel_t cipher, mxc_tpu_modesel_t mode, unsigned int data_size, char *outptr)
The AES encryption process.
#define MXC_V_TPU_MAA_CTRL_CLC_SQMUL
Definition: tpu_regs.h:374
int MXC_TPU_Shutdown(mxc_sys_periph_clock_t clock)
Shutdown CRYPTO system specific settings.
int MXC_TPU_Cipher_DoOperation(const char *src, const char *iv, const char *key, mxc_tpu_ciphersel_t cipher, mxc_tpu_modesel_t mode, unsigned int data_size, char *outptr)
Test Cipher Algorithm.
#define MXC_V_TPU_CIPHER_CTRL_CIPHER_DIS
Definition: tpu_regs.h:238
int MXC_TPU_MAA_Shutdown(void)
Release MAA.
int MXC_TPU_Cipher_Config(mxc_tpu_modesel_t mode, mxc_tpu_ciphersel_t cipher)
Configure crypto cipher operation for different modes.
#define MXC_V_TPU_HASH_CTRL_HASH_SHA224
Definition: tpu_regs.h:284
uint8_t MXC_TPU_TRNG_Read8BIT(mxc_trng_regs_t *trng)
Reads 8-bit value stored in the data register.
#define MXC_V_TPU_MAA_CTRL_CLC_SUB
Definition: tpu_regs.h:378
#define MXC_V_TPU_CIPHER_CTRL_CIPHER_TDES
Definition: tpu_regs.h:248
#define MXC_V_TPU_MAA_CTRL_CLC_ADD
Definition: tpu_regs.h:376
int MXC_TPU_Init(mxc_sys_periph_clock_t clock)
Init CRYPTO system settings.
int MXC_TPU_Ham_Config(void)
Configure crypto HAM operation.
#define MXC_V_TPU_CIPHER_CTRL_MODE_CBC
Definition: tpu_regs.h:255
#define MXC_V_TPU_CIPHER_CTRL_CIPHER_AES128
Definition: tpu_regs.h:240
Definition: trng_regs.h:88
#define MXC_V_TPU_CIPHER_CTRL_MODE_ECB
Definition: tpu_regs.h:253
#define MXC_V_TPU_HASH_CTRL_HASH_DIS
Definition: tpu_regs.h:280
unsigned int MXC_TPU_Hash_Get_Block_Size_SHA(mxc_tpu_hashfunsel_t func)
Get hash block's size.
int MXC_TPU_MAA_Init(unsigned int size)
Configure MAA operation with appropriate MAA word size.
#define MXC_V_TPU_CIPHER_CTRL_CIPHER_AES192
Definition: tpu_regs.h:242
int MXC_TPU_Cipher_AES_Decrypt(const char *ciphertext, const char *iv, const char *key, mxc_tpu_ciphersel_t cipher, mxc_tpu_modesel_t mode, unsigned int data_size, char *outptr)
The AES decryption process.
mxc_tpu_hashfunsel_t
Definition: tpu.h:109
int MXC_TPU_Cipher_DES_Decrypt(const char *ciphertext, const char *iv, const char *key, mxc_tpu_modesel_t mode, unsigned int data_size, char *outptr)
The DES decryption process.
int MXC_TPU_Cipher_DES_Encrypt(const char *plaintext, const char *iv, const char *key, mxc_tpu_modesel_t mode, unsigned int data_size, char *outptr)
The DES encryption process.
#define MXC_V_TPU_HASH_CTRL_HASH_SHA1
Definition: tpu_regs.h:282
void MXC_TPU_TRNG_Generate_AES(mxc_trng_regs_t *trng)
Generates 256-bits random number automatically.
#define MXC_V_TPU_HASH_CTRL_HASH_SHA256
Definition: tpu_regs.h:286
void MXC_TPU_Reset(void)
Reset the crypto accelerator.
uint32_t MXC_TPU_TRNG_Read32BIT(mxc_trng_regs_t *trng)
Reads 32-bit value stored in the data register.
unsigned int MXC_TPU_Hash_Get_Dgst_Size(mxc_tpu_hashfunsel_t func)
Get hash digest's size.
#define MXC_V_TPU_CIPHER_CTRL_CIPHER_AES256
Definition: tpu_regs.h:244
void MXC_TPU_Hash_SHA_Size(unsigned int *blocks, unsigned int *length, unsigned int *lbyte, mxc_tpu_hashfunsel_t fun)
Get SHA size.
uint16_t MXC_TPU_TRNG_Read16BIT(mxc_trng_regs_t *trng)
Reads 16-bit value stored in the data register.
#define MXC_V_TPU_CIPHER_CTRL_CIPHER_DES
Definition: tpu_regs.h:246
mxc_tpu_maa_clcsel_t
Definition: tpu.h:121
void MXC_TPU_Cipher_EncDecSelect(int enc)
Enable Encrypt/Decrypt Cipher Operation.
#define MXC_V_TPU_HASH_CTRL_HASH_SHA512
Definition: tpu_regs.h:290
#define MXC_V_TPU_MAA_CTRL_CLC_EXP
Definition: tpu_regs.h:368
unsigned int MXC_TPU_Cipher_Get_Key_Size(mxc_tpu_ciphersel_t cipher)
Get cipher key's size.
mxc_tpu_ciphersel_t
Definition: tpu.h:87
int MXC_TPU_CRC(const uint8_t *src, uint32_t len, uint32_t poly, uint32_t *crc)
Test the CRC process.
mxc_tpu_modesel_t
Definition: tpu.h:99
void MXC_TPU_MAA_Reset(void)
Reset the TPU accelerator.
void MXC_TPU_TRNG_Read(mxc_trng_regs_t *trng, uint8_t *data, int len)
Generates Random Number of variable length.
int MXC_TPU_MAA_Compute(mxc_tpu_maa_clcsel_t clc, char *multiplier, char *multiplicand, char *exp, char *mod, int *result, unsigned int len)
MAA operation.
#define MXC_V_TPU_MAA_CTRL_CLC_MUL
Definition: tpu_regs.h:372
void MXC_TPU_MAA_Mem_Clear(void)
Initialize memory used for MAA.