MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
Data Structures | |
struct | hashcrypt_handle_t |
Specify HASHCRYPT's key resource. More... | |
Macros | |
#define | HASHCRYPT_AES_BLOCK_SIZE 16U |
AES block size in bytes. | |
Enumerations | |
enum | hashcrypt_aes_mode_t { kHASHCRYPT_AesEcb = 0U, kHASHCRYPT_AesCbc = 1U, kHASHCRYPT_AesCtr = 2U } |
AES mode. More... | |
enum | hashcrypt_aes_keysize_t { kHASHCRYPT_Aes128 = 0U, kHASHCRYPT_Aes192 = 1U, kHASHCRYPT_Aes256 = 2U, kHASHCRYPT_InvalidKey = 3U } |
Size of AES key. More... | |
enum | hashcrypt_key_t { kHASHCRYPT_UserKey = 0xc3c3U, kHASHCRYPT_SecretKey = 0x3c3cU } |
HASHCRYPT key source selection. More... | |
Functions | |
status_t | HASHCRYPT_AES_SetKey (HASHCRYPT_Type *base, hashcrypt_handle_t *handle, const uint8_t *key, size_t keySize) |
Set AES key to hashcrypt_handle_t struct and optionally to HASHCRYPT. More... | |
status_t | HASHCRYPT_AES_EncryptEcb (HASHCRYPT_Type *base, hashcrypt_handle_t *handle, const uint8_t *plaintext, uint8_t *ciphertext, size_t size) |
Encrypts AES on one or multiple 128-bit block(s). More... | |
status_t | HASHCRYPT_AES_DecryptEcb (HASHCRYPT_Type *base, hashcrypt_handle_t *handle, const uint8_t *ciphertext, uint8_t *plaintext, size_t size) |
Decrypts AES on one or multiple 128-bit block(s). More... | |
status_t | HASHCRYPT_AES_EncryptCbc (HASHCRYPT_Type *base, hashcrypt_handle_t *handle, const uint8_t *plaintext, uint8_t *ciphertext, size_t size, const uint8_t iv[16]) |
Encrypts AES using CBC block mode. More... | |
status_t | HASHCRYPT_AES_DecryptCbc (HASHCRYPT_Type *base, hashcrypt_handle_t *handle, const uint8_t *ciphertext, uint8_t *plaintext, size_t size, const uint8_t iv[16]) |
Decrypts AES using CBC block mode. More... | |
status_t | HASHCRYPT_AES_CryptCtr (HASHCRYPT_Type *base, hashcrypt_handle_t *handle, const uint8_t *input, uint8_t *output, size_t size, uint8_t counter[HASHCRYPT_AES_BLOCK_SIZE], uint8_t counterlast[HASHCRYPT_AES_BLOCK_SIZE], size_t *szLeft) |
Encrypts or decrypts AES using CTR block mode. More... | |
struct _hashcrypt_handle |
Data Fields | |
uint32_t | keyWord [8] |
Copy of user key (set by HASHCRYPT_AES_SetKey(). More... | |
hashcrypt_key_t | keyType |
For operations with key (such as AES encryption/decryption), specify key type. More... | |
uint32_t hashcrypt_handle_t::keyWord[8] |
hashcrypt_key_t hashcrypt_handle_t::keyType |
enum hashcrypt_aes_mode_t |
enum hashcrypt_key_t |
status_t HASHCRYPT_AES_SetKey | ( | HASHCRYPT_Type * | base, |
hashcrypt_handle_t * | handle, | ||
const uint8_t * | key, | ||
size_t | keySize | ||
) |
Sets the AES key for encryption/decryption with the hashcrypt_handle_t structure. The hashcrypt_handle_t input argument specifies key source.
base | HASHCRYPT peripheral base address. |
handle | Handle used for the request. |
key | 0-mod-4 aligned pointer to AES key. |
keySize | AES key size in bytes. Shall equal 16, 24 or 32. |
status_t HASHCRYPT_AES_EncryptEcb | ( | HASHCRYPT_Type * | base, |
hashcrypt_handle_t * | handle, | ||
const uint8_t * | plaintext, | ||
uint8_t * | ciphertext, | ||
size_t | size | ||
) |
Encrypts AES. The source plaintext and destination ciphertext can overlap in system memory.
base | HASHCRYPT peripheral base address | |
handle | Handle used for this request. | |
plaintext | Input plain text to encrypt | |
[out] | ciphertext | Output cipher text |
size | Size of input and output data in bytes. Must be multiple of 16 bytes. |
status_t HASHCRYPT_AES_DecryptEcb | ( | HASHCRYPT_Type * | base, |
hashcrypt_handle_t * | handle, | ||
const uint8_t * | ciphertext, | ||
uint8_t * | plaintext, | ||
size_t | size | ||
) |
Decrypts AES. The source ciphertext and destination plaintext can overlap in system memory.
base | HASHCRYPT peripheral base address | |
handle | Handle used for this request. | |
ciphertext | Input plain text to encrypt | |
[out] | plaintext | Output cipher text |
size | Size of input and output data in bytes. Must be multiple of 16 bytes. |
status_t HASHCRYPT_AES_EncryptCbc | ( | HASHCRYPT_Type * | base, |
hashcrypt_handle_t * | handle, | ||
const uint8_t * | plaintext, | ||
uint8_t * | ciphertext, | ||
size_t | size, | ||
const uint8_t | iv[16] | ||
) |
base | HASHCRYPT peripheral base address | |
handle | Handle used for this request. | |
plaintext | Input plain text to encrypt | |
[out] | ciphertext | Output cipher text |
size | Size of input and output data in bytes. Must be multiple of 16 bytes. | |
iv | Input initial vector to combine with the first input block. |
status_t HASHCRYPT_AES_DecryptCbc | ( | HASHCRYPT_Type * | base, |
hashcrypt_handle_t * | handle, | ||
const uint8_t * | ciphertext, | ||
uint8_t * | plaintext, | ||
size_t | size, | ||
const uint8_t | iv[16] | ||
) |
base | HASHCRYPT peripheral base address | |
handle | Handle used for this request. | |
ciphertext | Input cipher text to decrypt | |
[out] | plaintext | Output plain text |
size | Size of input and output data in bytes. Must be multiple of 16 bytes. | |
iv | Input initial vector to combine with the first input block. |
status_t HASHCRYPT_AES_CryptCtr | ( | HASHCRYPT_Type * | base, |
hashcrypt_handle_t * | handle, | ||
const uint8_t * | input, | ||
uint8_t * | output, | ||
size_t | size, | ||
uint8_t | counter[HASHCRYPT_AES_BLOCK_SIZE], | ||
uint8_t | counterlast[HASHCRYPT_AES_BLOCK_SIZE], | ||
size_t * | szLeft | ||
) |
Encrypts or decrypts AES using CTR block mode. AES CTR mode uses only forward AES cipher and same algorithm for encryption and decryption. The only difference between encryption and decryption is that, for encryption, the input argument is plain text and the output argument is cipher text. For decryption, the input argument is cipher text and the output argument is plain text.
base | HASHCRYPT peripheral base address | |
handle | Handle used for this request. | |
input | Input data for CTR block mode | |
[out] | output | Output data for CTR block mode |
size | Size of input and output data in bytes | |
[in,out] | counter | Input counter (updates on return) |
[out] | counterlast | Output cipher of last counter, for chained CTR calls (statefull encryption). NULL can be passed if chained calls are not used. |
[out] | szLeft | Output number of bytes in left unused in counterlast block. NULL can be passed if chained calls are not used. |