Skip to content

File syn_aes_cmac.h

FileList > crypto > syn_aes_cmac.h

Go to the source code of this file

AES-CMAC (Cipher-based Message Authentication Code, RFC 4493 / NIST SP 800-38B). More...

  • #include "../common/syn_defs.h"
  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>

Public Functions

Type Name
SYN_Status syn_aes_cmac (const uint8_t key, const uint8_t * msg, size_t msg_len, uint8_t mac)
Generate a 128-bit AES-CMAC authentication tag (RFC 4493).
bool syn_aes_cmac_verify (const uint8_t key, const uint8_t * msg, size_t msg_len, const uint8_t mac)
Verify an AES-CMAC authentication tag in constant time (RFC 4493).

Macros

Type Name
define SYN_AES_CMAC_BLOCK_SIZE 16U
AES-CMAC cipher block size in bytes (16 bytes / 128 bits).
define SYN_AES_CMAC_KEY_SIZE 16U
AES-CMAC key size in bytes (16 bytes / 128 bits).
define SYN_AES_CMAC_TAG_SIZE 16U
AES-CMAC generated authentication tag size in bytes (16 bytes / 128 bits).

Detailed Description

Constant-time, zero-heap message authentication code engine based on AES-128. Standard primitive for BLE Secure Connections, LoRaWAN, AUTOSAR SecOC, and COSE.

Public Functions Documentation

function syn_aes_cmac

Generate a 128-bit AES-CMAC authentication tag (RFC 4493).

SYN_Status syn_aes_cmac (
    const uint8_t key,
    const uint8_t * msg,
    size_t msg_len,
    uint8_t mac
) 

Parameters:

  • key 16-byte AES-128 secret key.
  • msg Pointer to message to authenticate (may be NULL if msg_len is 0).
  • msg_len Length of the message in bytes.
  • mac 16-byte buffer to receive the computed MAC tag.

Returns:

SYN_OK on success, or SYN_INVALID_PARAM on invalid/NULL parameters.


function syn_aes_cmac_verify

Verify an AES-CMAC authentication tag in constant time (RFC 4493).

bool syn_aes_cmac_verify (
    const uint8_t key,
    const uint8_t * msg,
    size_t msg_len,
    const uint8_t mac
) 

Parameters:

  • key 16-byte AES-128 secret key.
  • msg Pointer to message to verify (may be NULL if msg_len is 0).
  • msg_len Length of the message in bytes.
  • mac 16-byte expected MAC tag to verify against.

Returns:

true if valid and authentic, false on mismatch or invalid parameters.


Macro Definition Documentation

define SYN_AES_CMAC_BLOCK_SIZE

AES-CMAC cipher block size in bytes (16 bytes / 128 bits).

#define SYN_AES_CMAC_BLOCK_SIZE `16U`


define SYN_AES_CMAC_KEY_SIZE

AES-CMAC key size in bytes (16 bytes / 128 bits).

#define SYN_AES_CMAC_KEY_SIZE `16U`


define SYN_AES_CMAC_TAG_SIZE

AES-CMAC generated authentication tag size in bytes (16 bytes / 128 bits).

#define SYN_AES_CMAC_TAG_SIZE `16U`



The documentation for this class was generated from the following file src/syntropic/crypto/syn_aes_cmac.h