ccm.h File Reference

Counter with CBC-MAC mode of operation for block ciphers. More...

Detailed Description

Counter with CBC-MAC mode of operation for block ciphers.

Author
Freie Universitaet Berlin, Computer Systems & Telematics
Nico von Geyso nico..nosp@m.geys.nosp@m.o@fu-.nosp@m.berl.nosp@m.in.de

Definition in file ccm.h.

#include "crypto/ciphers.h"
+ Include dependency graph for ccm.h:

Go to the source code of this file.

#define CCM_ERR_INVALID_NONCE_LENGTH   -2
 
#define CCM_ERR_INVALID_CBC_MAC   -3
 
#define CCM_ERR_INVALID_DATA_LENGTH   -3
 
#define CCM_ERR_INVALID_LENGTH_ENCODING   -4
 
#define CCM_ERR_INVALID_MAC_LENGTH   -5
 
int cipher_encrypt_ccm (cipher_t *cipher, uint8_t *auth_data, uint32_t auth_data_len, uint8_t mac_length, uint8_t length_encoding, uint8_t *nonce, size_t nonce_len, uint8_t *input, size_t input_len, uint8_t *output)
 Encrypt and authenticate data of arbitrary length in ccm mode. More...
 
int cipher_decrypt_ccm (cipher_t *cipher, uint8_t *auth_data, uint32_t auth_data_len, uint8_t mac_length, uint8_t length_encoding, uint8_t *nonce, size_t nonce_len, uint8_t *input, size_t input_len, uint8_t *output)
 Decrypt data of arbitrary length in ccm mode. More...
 

Function Documentation

◆ cipher_decrypt_ccm()

int cipher_decrypt_ccm ( cipher_t cipher,
uint8_t *  auth_data,
uint32_t  auth_data_len,
uint8_t  mac_length,
uint8_t  length_encoding,
uint8_t *  nonce,
size_t  nonce_len,
uint8_t *  input,
size_t  input_len,
uint8_t *  output 
)

Decrypt data of arbitrary length in ccm mode.

Parameters
cipherAlready initialized cipher struct
auth_dataAdditional data to authenticate in MAC
auth_data_lenLength of additional data
mac_lengthlength of the appended MAC (between 4 and 16 - only even values)
length_encodingmaximal supported length of plaintext (2^(8*length_enc)).
nonceNounce for ctr mode encryption
nonce_lenLength of the nonce in octets (maximum: 16-length_encoding)
inputpointer to input data to decrypt
input_lenlength of the input data
outputpointer to allocated memory for decrypted data. It has to be of size data_len - mac_length.
Returns
length of encrypted data or error code

◆ cipher_encrypt_ccm()

int cipher_encrypt_ccm ( cipher_t cipher,
uint8_t *  auth_data,
uint32_t  auth_data_len,
uint8_t  mac_length,
uint8_t  length_encoding,
uint8_t *  nonce,
size_t  nonce_len,
uint8_t *  input,
size_t  input_len,
uint8_t *  output 
)

Encrypt and authenticate data of arbitrary length in ccm mode.

Parameters
cipherAlready initialized cipher struct
auth_dataAdditional data to authenticate in MAC
auth_data_lenLength of additional data
mac_lengthlength of the appended MAC (between 4 and 16 - only even values)
length_encodingmaximal supported length of plaintext (2^(8*length_enc)).
nonceNounce for ctr mode encryption
nonce_lenLength of the nonce in octets (maximum: 16-length_encoding)
inputpointer to input data to encrypt
input_lenlength of the input data
outputpointer to allocated memory for encrypted data. It has to be of size data_len + mac_length.
Returns
length of encrypted data or error code