ProtoCore v0.0.2
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
aes_cmac.cpp File Reference

AES-128-CMAC implementation (see aes_cmac.h). More...

#include "crypto/mac/aes_cmac.h"
#include "crypto/crypto_opt.h"
#include <string.h>
#include <mbedtls/aes.h>

Go to the source code of this file.

Classes

struct  PC_CRYPTO_HOT::AesBlk
 

Namespaces

namespace  PC_CRYPTO_HOT
 

Functions

void PC_CRYPTO_HOT::blk_init (AesBlk *b, const uint8_t key[16])
 
void PC_CRYPTO_HOT::blk_enc (AesBlk *b, const uint8_t in[16], uint8_t out[16])
 
void PC_CRYPTO_HOT::blk_free (AesBlk *b)
 
void pc_aes_cmac (const uint8_t key[16], const uint8_t *msg, size_t msg_len, uint8_t mac[PC_AES_CMAC_LEN])
 Compute the AES-128-CMAC of msg under key (RFC 4493).
 

Detailed Description

AES-128-CMAC implementation (see aes_cmac.h).

Arduino path: the AES-128 block runs on mbedtls_aes_crypt_ecb() (HW AES accelerator on ESP32). Native path: the shared table-free software AES-128 (crypto/cipher/aes_block.h). The CMAC construction (subkey derivation + CBC-MAC + last-block handling) is identical on both.

Definition in file aes_cmac.cpp.

Function Documentation

◆ pc_aes_cmac()

void pc_aes_cmac ( const uint8_t  key[16],
const uint8_t *  msg,
size_t  msg_len,
uint8_t  mac[PC_AES_CMAC_LEN] 
)

Compute the AES-128-CMAC of msg under key (RFC 4493).

Parameters
keythe 16-byte AES-128 key.
msgthe message (may be null iff msg_len is 0).
msg_lenmessage length in bytes (0 is valid - the empty-message CMAC).
macreceives the 16-byte tag.

Definition at line 110 of file aes_cmac.cpp.