55 #define MBEDTLS_CCM_DECRYPT 0
56 #define MBEDTLS_CCM_ENCRYPT 1
57 #define MBEDTLS_CCM_STAR_DECRYPT 2
58 #define MBEDTLS_CCM_STAR_ENCRYPT 3
61 #define MBEDTLS_ERR_CCM_BAD_INPUT -0x000D
63 #define MBEDTLS_ERR_CCM_AUTH_FAILED -0x000F
69 #if !defined(MBEDTLS_CCM_ALT)
77 typedef struct mbedtls_ccm_context
131 const unsigned char *key,
132 unsigned int keybits );
180 const unsigned char *iv,
size_t iv_len,
181 const unsigned char *ad,
size_t ad_len,
182 const unsigned char *input,
unsigned char *output,
183 unsigned char *tag,
size_t tag_len );
229 const unsigned char *iv,
size_t iv_len,
230 const unsigned char *ad,
size_t ad_len,
231 const unsigned char *input,
unsigned char *output,
232 unsigned char *tag,
size_t tag_len );
266 const unsigned char *iv,
size_t iv_len,
267 const unsigned char *ad,
size_t ad_len,
268 const unsigned char *input,
unsigned char *output,
269 const unsigned char *tag,
size_t tag_len );
312 const unsigned char *iv,
size_t iv_len,
313 const unsigned char *ad,
size_t ad_len,
314 const unsigned char *input,
unsigned char *output,
315 const unsigned char *tag,
size_t tag_len );
347 const unsigned char *iv,
379 size_t plaintext_len,
413 const unsigned char *ad,
480 const unsigned char *input,
size_t input_len,
481 unsigned char *output,
size_t output_size,
482 size_t *output_len );
516 unsigned char *tag,
size_t tag_len );
518 #if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
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_update(mbedtls_ccm_context *ctx, const unsigned char *input, size_t input_len, unsigned char *output, size_t output_size, size_t *output_len)
This function feeds an input buffer into an ongoing CCM encryption or decryption operation.
#define MBEDTLS_PRIVATE(member)
int mbedtls_ccm_encrypt_and_tag(mbedtls_ccm_context *ctx, size_t length, const unsigned char *iv, size_t iv_len, const unsigned char *ad, size_t ad_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_finish(mbedtls_ccm_context *ctx, unsigned char *tag, size_t tag_len)
This function finishes the CCM operation and generates the authentication tag.
int mbedtls_ccm_star_encrypt_and_tag(mbedtls_ccm_context *ctx, size_t length, const unsigned char *iv, size_t iv_len, const unsigned char *ad, size_t ad_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_update_ad(mbedtls_ccm_context *ctx, const unsigned char *ad, size_t ad_len)
This function feeds an input buffer as associated data (authenticated but not encrypted data) in a CC...
int mbedtls_ccm_auth_decrypt(mbedtls_ccm_context *ctx, size_t length, const unsigned char *iv, size_t iv_len, const unsigned char *ad, size_t ad_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.
mbedtls_cipher_id_t
Supported cipher types.
int mbedtls_ccm_set_lengths(mbedtls_ccm_context *ctx, size_t total_ad_len, size_t plaintext_len, size_t tag_len)
This function declares the lengths of the message and additional data for a CCM encryption or decrypt...
int mbedtls_ccm_starts(mbedtls_ccm_context *ctx, int mode, const unsigned char *iv, size_t iv_len)
This function starts a CCM encryption or decryption operation.
Macro wrapper for struct's memebrs.
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
Build-time configuration info.
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...
int mbedtls_ccm_star_auth_decrypt(mbedtls_ccm_context *ctx, size_t length, const unsigned char *iv, size_t iv_len, const unsigned char *ad, size_t ad_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.
int mbedtls_ccm_self_test(int verbose)
The CCM checkup routine.
void mbedtls_ccm_init(mbedtls_ccm_context *ctx)
This function initializes the specified CCM context, to make references valid, and prepare the contex...