tinydtls  0.8.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Functions
ccm.h File Reference
#include "aes/rijndael.h"

Go to the source code of this file.

Macros

#define DTLS_CCM_BLOCKSIZE   16
 
#define DTLS_CCM_MAX   16
 
#define DTLS_CCM_NONCE_SIZE   12
 

Functions

long int dtls_ccm_encrypt_message (rijndael_ctx *ctx, size_t M, size_t L, unsigned char nonce[DTLS_CCM_BLOCKSIZE], unsigned char *msg, size_t lm, const unsigned char *aad, size_t la)
 
long int dtls_ccm_decrypt_message (rijndael_ctx *ctx, size_t M, size_t L, unsigned char nonce[DTLS_CCM_BLOCKSIZE], unsigned char *msg, size_t lm, const unsigned char *aad, size_t la)
 

Macro Definition Documentation

#define DTLS_CCM_BLOCKSIZE   16

size of hmac blocks

Definition at line 33 of file ccm.h.

#define DTLS_CCM_MAX   16

max number of bytes in digest

Definition at line 34 of file ccm.h.

#define DTLS_CCM_NONCE_SIZE   12

size of nonce

Definition at line 35 of file ccm.h.

Function Documentation

long int dtls_ccm_decrypt_message ( rijndael_ctx *  ctx,
size_t  M,
size_t  L,
unsigned char  nonce[DTLS_CCM_BLOCKSIZE],
unsigned char *  msg,
size_t  lm,
const unsigned char *  aad,
size_t  la 
)

Definition at line 240 of file ccm.c.

long int dtls_ccm_encrypt_message ( rijndael_ctx *  ctx,
size_t  M,
size_t  L,
unsigned char  nonce[DTLS_CCM_BLOCKSIZE],
unsigned char *  msg,
size_t  lm,
const unsigned char *  aad,
size_t  la 
)

Authenticates and encrypts a message using AES in CCM mode. Please see also RFC 3610 for the meaning of M, L, lm and la.

Parameters
ctxThe initialized rijndael_ctx object to be used for AES operations.
MThe number of authentication octets.
LThe number of bytes used to encode the message length.
NThe nonce value to use. You must provide DTLS_CCM_BLOCKSIZE nonce octets, although only the first 16 - L are used.
msgThe message to encrypt. The first la octets are additional authentication data that will be cleartext. Note that the encryption operation modifies the contents of msg and adds M bytes MAC. Therefore, the buffer must be at least lm + M bytes large.
lmThe actual length of msg.
aadA pointer to the additional authentication data (can be NULL if la is zero).
laThe number of additional authentication octets (may be zero).
Returns
FIXME

Definition at line 176 of file ccm.c.