MAX32665 SDK Documentation  0.2
Software Development Kit Overview and API Documentation

Macros

#define DES_DATA_LEN   8
 
#define AES_DATA_LEN   16
 
#define MAX_KEY_SIZE   32
 
#define MXC_AES_DATA_LEN   (128 / 8)
 Number of bytes in an AES plaintext or ciphertext block, which are always 128-bits long. More...
 
#define MXC_AES_KEY_128_LEN   (128 / 8)
 Number of bytes in a AES-128 key. More...
 
#define MXC_AES_KEY_192_LEN   (192 / 8)
 Number of bytes in a AES-192 key. More...
 
#define MXC_AES_KEY_256_LEN   (256 / 8)
 Number of bytes in a AES-256 key. More...
 

Enumerations

enum  tpu_ciphersel_t {
  TPU_CIPHER_DIS = MXC_V_TPU_CIPHER_CTRL_CIPHER_DIS,
  TPU_CIPHER_AES128 = MXC_V_TPU_CIPHER_CTRL_CIPHER_AES128,
  TPU_CIPHER_AES192 = MXC_V_TPU_CIPHER_CTRL_CIPHER_AES192,
  TPU_CIPHER_AES256 = MXC_V_TPU_CIPHER_CTRL_CIPHER_AES256,
  TPU_CIPHER_DES = MXC_V_TPU_CIPHER_CTRL_CIPHER_DES,
  TPU_CIPHER_TDES = MXC_V_TPU_CIPHER_CTRL_CIPHER_TDES
}
 Enumeration type for the Crypto Cipher Operation(128/192/256-bit key)
 
enum  tpu_modesel_t {
  TPU_MODE_ECB = MXC_V_TPU_CIPHER_CTRL_MODE_ECB,
  TPU_MODE_CBC = MXC_V_TPU_CIPHER_CTRL_MODE_CBC,
  TPU_MODE_CFB = MXC_V_TPU_CIPHER_CTRL_MODE_CFB,
  TPU_MODE_CTR = MXC_V_TPU_CIPHER_CTRL_MODE_CTR
}
 Enumeration type for the Crypto Mode Select.
 

Functions

void TPU_Cipher_Reset (void)
 Reset the crypto accelerator.
 
void TPU_Shutdown (void)
 Shutdown crypto controller.
 
int TPU_Cipher_Config (tpu_modesel_t mode, tpu_ciphersel_t cipher)
 Configure crypto cipher operation for different modes. More...
 
int TPU_DES_Encrypt (const char *plaintext, const char *iv, const char *key, tpu_modesel_t mode, unsigned int data_size, char *outptr)
 The DES encryption process. More...
 
int TPU_DES_Decrypt (const char *ciphertext, const char *iv, const char *key, tpu_modesel_t mode, unsigned int data_size, char *outptr)
 The DES decryption process. More...
 
int TPU_TDES_Encrypt (const char *plaintext, const char *iv, const char *key, tpu_modesel_t mode, unsigned int data_size, char *outptr)
 The TDES encryption process. More...
 
int TPU_TDES_Decrypt (const char *ciphertext, const char *iv, const char *key, tpu_modesel_t mode, unsigned int data_size, char *outptr)
 The TDES decryption process. More...
 
int TPU_AES_Encrypt (const char *plaintext, const char *iv, const char *key, tpu_ciphersel_t cipher, tpu_modesel_t mode, unsigned int data_size, char *outptr)
 The AES encryption process. More...
 
int TPU_AES_Decrypt (const char *ciphertext, const char *iv, const char *key, tpu_ciphersel_t cipher, tpu_modesel_t mode, unsigned int data_size, char *outptr)
 The AES decryption process. More...
 

Detailed Description

Macro Definition Documentation

◆ MXC_AES_DATA_LEN

#define MXC_AES_DATA_LEN   (128 / 8)

◆ MXC_AES_KEY_128_LEN

#define MXC_AES_KEY_128_LEN   (128 / 8)

◆ MXC_AES_KEY_192_LEN

#define MXC_AES_KEY_192_LEN   (192 / 8)

◆ MXC_AES_KEY_256_LEN

#define MXC_AES_KEY_256_LEN   (256 / 8)

Function Documentation

◆ TPU_Cipher_Config()

int TPU_Cipher_Config ( tpu_modesel_t  mode,
tpu_ciphersel_t  cipher 
)
Parameters
modeSelects the Crypto operation mode
cipherSelects the Cipher Operation mode
Returns
E_SUCCESS Cipher algorithm configured successfully

◆ TPU_DES_Encrypt()

int TPU_DES_Encrypt ( const char *  plaintext,
const char *  iv,
const char *  key,
tpu_modesel_t  mode,
unsigned int  data_size,
char *  outptr 
)
Parameters
plaintextPointer to the plaintext data
ivPointer to the initial vector data
keyPointer to the crypto key
modeSelects the Crypto operation mode
data_sizeSpecifies length of data in bytes
outptrOutput buffer
Returns
E_NULL_PTR Specified pointers plaintext; iv; key points to null
E_INVALID DES Encryption process failed
E_SUCCESS DES Encryption process completed successfully

◆ TPU_DES_Decrypt()

int TPU_DES_Decrypt ( const char *  ciphertext,
const char *  iv,
const char *  key,
tpu_modesel_t  mode,
unsigned int  data_size,
char *  outptr 
)
Parameters
ciphertextPointer to the ciphertext data
ivPointer to the initial vector data
keyPointer to the crypto key
modeSelects the Crypto operation mode
data_sizeSpecifies length of data in bytes
outptrOutput buffer
Returns
E_NULL_PTR Specified pointers plaintext; iv; key points to null
E_INVALID DES Decryption process failed
E_SUCCESS DES Decryption process completed successfully

◆ TPU_TDES_Encrypt()

int TPU_TDES_Encrypt ( const char *  plaintext,
const char *  iv,
const char *  key,
tpu_modesel_t  mode,
unsigned int  data_size,
char *  outptr 
)
Parameters
plaintextPointer to the plaintext data
ivPointer to the initial vector data
keyPointer to the crypto key
modeSelects the Crypto operation mode
data_sizeSpecifies length of data in bytes
outptrOutput buffer
Returns
E_NULL_PTR Specified pointers plaintext; iv; key points to null
E_INVALID TDES Encryption process failed
E_SUCCESS TDES Encryption process completed successfully

◆ TPU_TDES_Decrypt()

int TPU_TDES_Decrypt ( const char *  ciphertext,
const char *  iv,
const char *  key,
tpu_modesel_t  mode,
unsigned int  data_size,
char *  outptr 
)
Parameters
ciphertextPointer to the ciphertext data
ivPointer to the initial vector data
keyPointer to the crypto key
modeSelects the Crypto operation mode
data_sizeSpecifies length of data in bytes
outptrOutput buffer
Returns
E_NULL_PTR Specified pointers plaintext; iv; key points to null
E_INVALID TDES Decryption process failed
E_SUCCESS TDES Decryption process completed successfully

◆ TPU_AES_Encrypt()

int TPU_AES_Encrypt ( const char *  plaintext,
const char *  iv,
const char *  key,
tpu_ciphersel_t  cipher,
tpu_modesel_t  mode,
unsigned int  data_size,
char *  outptr 
)
Parameters
plaintextPointer to the plaintext data
ivPointer to the initial vector data
keyPointer to the crypto key
cipherSelects the Cipher Operation mode
modeSelects the Crypto operation mode
data_sizeSpecifies length of data in bytes
outptrOutput buffer
Returns
E_NULL_PTR Specified pointers plaintext; iv; key points to null
E_BAD_PARAM Specified Cipher operation mode cipher is invalid, see tpu_ciphersel_t
E_INVALID AES Encryption process failed
E_SUCCESS AES Encryption process completed successfully

◆ TPU_AES_Decrypt()

int TPU_AES_Decrypt ( const char *  ciphertext,
const char *  iv,
const char *  key,
tpu_ciphersel_t  cipher,
tpu_modesel_t  mode,
unsigned int  data_size,
char *  outptr 
)
Parameters
ciphertextPointer to the ciphertext data
ivPointer to the initial vector data
keyPointer to the crypto key
cipherSelects the Cipher Operation mode
modeSelects the Crypto operation mode
data_sizeSpecifies length of data in bytes
outptrOutput buffer
Returns
E_NULL_PTR Specified pointers plaintext; iv; key points to null
E_BAD_PARAM Specified Cipher operation mode cipher is invalid, see tpu_ciphersel_t
E_INVALID AES Encryption process failed
E_SUCCESS AES Encryption process completed successfully