3. CMOX_KMAC

3.1. KMAC single-call algorithms

group CMOX_KMAC_ALGO

Variables

const cmox_mac_algo_t CMOX_KMAC_128_ALGO

Identifier of the KMAC-128 mac algorithm for single-call function (Defined internally).

const cmox_mac_algo_t CMOX_KMAC_256_ALGO

Identifier of the KMAC-256 mac algorithm for single-call function (Defined internally).

3.2. KMAC implementations

group CMOX_KMAC_IMPL

Variables

const cmox_kmac_impl_t CMOX_KMAC_128

Implementation of KMAC-128 algorithm (Defined internally).

const cmox_kmac_impl_t CMOX_KMAC_256

Implementation of KMAC-256 algorithm (Defined internally).

3.3. KMAC public method prototypes

group CMOX_KMAC_PUBLIC_METHODS

Functions

cmox_mac_handle_t * cmox_kmac_construct ( cmox_kmac_handle_t * P_pThis , cmox_kmac_impl_t P_impl )

KMAC constructor.

The function is used for specifying which KMAC implementation to use in order to implement the MAC algorithm.

Parameters :
  • P_pThis – Pointer to the KMAC handle to initialize

  • P_impl – Constant that specifies the implementation to use. This parameter can be one of the following values:

    • CMOX_KMAC_128

    • CMOX_KMAC_256

Returns :

cmox_mac_handle_t* Pointer to a general MAC handle. This will be used by the general purpose MAC functions in order to perform the algorithm

3.4. KMAC public types

group CMOX_KMAC_PUBLIC_TYPES

Typedefs

typedef const struct cmox_kmac_implStruct_st * cmox_kmac_impl_t

KMAC implementation.

This type specifies the implementation to use for the KMAC construct. This type is defined as a pointer to a structure, that contains the functions needed for the specific implementation, defined in the library internally

typedef uint32_t cmox_keccak_phase_t

Keccak-P phases.

struct cmox_cshake_handle_t
#include <cmox_kmac.h>

Structure defining the cSHAKE context.

Public Members

cmox_sponge_handle_t sponge

Sponge context

uint32_t fixedOutputLength

Fixed output length in bits

uint32_t lastByteBitLen

Last byte bit length

uint8_t lastByteValue

Last byte value

cmox_keccak_phase_t phase

Phase

struct cmox_kmac_inner_t
#include <cmox_kmac.h>

Structure defining the KMAC inner context.

Public Members

cmox_cshake_handle_t csi

cSHAKE context

size_t outputBitLen

Output length in bits

struct cmox_kmac_handle_t
#include <cmox_kmac.h>

KMAC handle structure definition.

Public Members

cmox_mac_handle_t super

General MAC handle

const uint8_t * custom_data

Pointer to buffer containing custom data

size_t customDataLen

Size in bytes of the custom data

cmox_kmac_inner_t internal_ctx

Internal handle for KMAC

cmox_kmac_impl_t impl

Implementation of KMAC