Mbed OS Reference
Loading...
Searching...
No Matches
ccm.h File Reference

This file provides an API for the CCM authenticated encryption mode for block ciphers. More...

#include "mbedtls/config.h"
#include "mbedtls/cipher.h"

Go to the source code of this file.

Data Structures

struct  mbedtls_ccm_context
 The CCM context-type definition. More...
 

Macros

#define MBEDTLS_ERR_CCM_BAD_INPUT   -0x000D
 Bad input parameters to the function. More...
 
#define MBEDTLS_ERR_CCM_AUTH_FAILED   -0x000F
 Authenticated decryption failed. More...
 
#define MBEDTLS_ERR_CCM_HW_ACCEL_FAILED   -0x0011
 CCM hardware accelerator failed. More...
 

Typedefs

typedef struct mbedtls_ccm_context mbedtls_ccm_context
 The CCM context-type definition. More...
 

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(). More...
 
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. More...
 
void mbedtls_ccm_free (mbedtls_ccm_context *ctx)
 This function releases and clears the specified CCM context and underlying cipher sub-context. More...
 
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. More...
 
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 *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*. More...
 
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. More...
 
int mbedtls_ccm_star_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. More...
 

Detailed Description

This file provides an API for the CCM authenticated encryption mode for block ciphers.

CCM combines Counter mode encryption with CBC-MAC authentication for 128-bit block ciphers.

Input to CCM includes the following elements:

  • Payload - data that is both authenticated and encrypted.
  • Associated data (Adata) - data that is authenticated but not encrypted, For example, a header.
  • Nonce - A unique value that is assigned to the payload and the associated data.

Definition of CCM: http://csrc.nist.gov/publications/nistpubs/800-38C/SP800-38C_updated-July20_2007.pdf RFC 3610 "Counter with CBC-MAC (CCM)"

Related: RFC 5116 "An Interface and Algorithms for Authenticated Encryption"

Definition of CCM*: IEEE 802.15.4 - IEEE Standard for Local and metropolitan area networks Integer representation is fixed most-significant-octet-first order and the representation of octets is most-significant-bit-first order. This is consistent with RFC 3610.

Definition in file ccm.h.

Macro Definition Documentation

◆ MBEDTLS_ERR_CCM_BAD_INPUT

#define MBEDTLS_ERR_CCM_BAD_INPUT   -0x000D

Bad input parameters to the function.

Definition at line 58 of file ccm.h.

◆ MBEDTLS_ERR_CCM_AUTH_FAILED

#define MBEDTLS_ERR_CCM_AUTH_FAILED   -0x000F

Authenticated decryption failed.

Definition at line 59 of file ccm.h.

◆ MBEDTLS_ERR_CCM_HW_ACCEL_FAILED

#define MBEDTLS_ERR_CCM_HW_ACCEL_FAILED   -0x0011

CCM hardware accelerator failed.

Definition at line 62 of file ccm.h.