Accelerated AES-CCM AEAD CipherCryptography Hardware Acceleration Plugins

Detailed Description

Accelerated AES-CCM AEAD cipher using the SE peripheral.

Data Structures

struct  mbedtls_ccm_context
 The CCM context-type definition. The CCM context is passed to the APIs called.
 

Functions

void mbedtls_ccm_init (mbedtls_ccm_context *ctx)
 This function initializes the specified CCM context, to make references valid, and prepare the context for mbedtls_ccm_setkey() or mbedtls_ccm_free().
 
int mbedtls_ccm_setkey (mbedtls_ccm_context *ctx, mbedtls_cipher_id_t cipher, const unsigned char *key, unsigned int keybits)
 This function initializes the CCM context set in the ctx parameter and sets the encryption key.
 
void mbedtls_ccm_free (mbedtls_ccm_context *ctx)
 This function releases and clears the specified CCM context and underlying cipher sub-context.
 
int mbedtls_ccm_encrypt_and_tag (mbedtls_ccm_context *ctx, size_t length, const unsigned char *iv, size_t iv_len, const unsigned char *add, size_t add_len, const unsigned char *input, unsigned char *output, unsigned char *tag, size_t tag_len)
 This function encrypts a buffer using CCM.
 
int mbedtls_ccm_auth_decrypt (mbedtls_ccm_context *ctx, size_t length, const unsigned char *iv, size_t iv_len, const unsigned char *add, size_t add_len, const unsigned char *input, unsigned char *output, const unsigned char *tag, size_t tag_len)
 This function performs a CCM authenticated decryption of a buffer.
 

Function Documentation

int mbedtls_ccm_auth_decrypt ( mbedtls_ccm_context ctx,
size_t  length,
const unsigned char *  iv,
size_t  iv_len,
const unsigned char *  add,
size_t  add_len,
const unsigned char *  input,
unsigned char *  output,
const unsigned char *  tag,
size_t  tag_len 
)

This function performs a CCM authenticated decryption of a buffer.

Parameters
ctxThe CCM context to use for decryption.
lengthThe length of the input data in Bytes.
ivInitialization vector.
iv_lenThe length of the IV in Bytes: 7, 8, 9, 10, 11, 12, or 13.
addThe additional data field.
add_lenThe length of additional data in Bytes. Must be less than 2^16 - 2^8.
inputThe buffer holding the input data.
outputThe buffer holding the output data. Must be at least length Bytes wide.
tagThe buffer holding the tag.
tag_lenThe length of the tag in Bytes. 4, 6, 8, 10, 12, 14 or 16.
Returns
0 if successful and authenticated, or MBEDTLS_ERR_CCM_AUTH_FAILED if the tag does not match.
int mbedtls_ccm_encrypt_and_tag ( mbedtls_ccm_context ctx,
size_t  length,
const unsigned char *  iv,
size_t  iv_len,
const unsigned char *  add,
size_t  add_len,
const unsigned char *  input,
unsigned char *  output,
unsigned char *  tag,
size_t  tag_len 
)

This function encrypts a buffer using CCM.

Parameters
ctxThe CCM context to use for encryption.
lengthThe length of the input data in Bytes.
ivInitialization vector (nonce).
iv_lenThe length of the IV in Bytes: 7, 8, 9, 10, 11, 12, or 13.
addThe additional data field.
add_lenThe length of additional data in Bytes. Must be less than 2^16 - 2^8.
inputThe buffer holding the input data.
outputThe buffer holding the output data. Must be at least length Bytes wide.
tagThe buffer holding the tag.
tag_lenThe length of the tag to generate in Bytes: 4, 6, 8, 10, 12, 14 or 16.
Note
The tag is written to a separate buffer. To concatenate the tag with the output, as done in RFC-3610: Counter with CBC-MAC (CCM), use tag = output + length, and make sure that the output buffer is at least length + tag_len wide.
Returns
0 on success.
void mbedtls_ccm_free ( mbedtls_ccm_context ctx)

This function releases and clears the specified CCM context and underlying cipher sub-context.

Parameters
ctxThe CCM context to clear.
void mbedtls_ccm_init ( mbedtls_ccm_context ctx)

This function initializes the specified CCM context, to make references valid, and prepare the context for mbedtls_ccm_setkey() or mbedtls_ccm_free().

Parameters
ctxThe CCM context to initialize.
int mbedtls_ccm_setkey ( mbedtls_ccm_context ctx,
mbedtls_cipher_id_t  cipher,
const unsigned char *  key,
unsigned int  keybits 
)

This function initializes the CCM context set in the ctx parameter and sets the encryption key.

Parameters
ctxThe CCM context to initialize.
cipherThe 128-bit block cipher to use.
keyThe encryption key.
keybitsThe key size in bits. This must be acceptable by the cipher.
Returns
0 on success, or a cipher-specific error code.