libzpc 1.5
IBM Z Protected-key Crypto library
Loading...
Searching...
No Matches
aes_cmac.h File Reference

AES-CMAC API. More...

Go to the source code of this file.

Functions

int zpc_aes_cmac_alloc (struct zpc_aes_cmac **ctx)
int zpc_aes_cmac_set_key (struct zpc_aes_cmac *ctx, struct zpc_aes_key *key)
int zpc_aes_cmac_sign (struct zpc_aes_cmac *ctx, unsigned char *mac, size_t maclen, const unsigned char *msg, size_t msglen)
int zpc_aes_cmac_verify (struct zpc_aes_cmac *ctx, const unsigned char *mac, size_t maclen, const unsigned char *msg, size_t msglen)
void zpc_aes_cmac_free (struct zpc_aes_cmac **ctx)

Detailed Description

AES-CMAC API.

Message authentication API for the Cipher-based Message Authentication Code (CMAC) [3] based on the Advanced Encryption Standard (AES) block cipher [1] .

Definition in file aes_cmac.h.

Function Documentation

◆ zpc_aes_cmac_alloc()

int zpc_aes_cmac_alloc ( struct zpc_aes_cmac ** ctx)

Allocate a new context for an AES-CMAC operation.

Parameters
[in,out]ctxAES-CMAC context
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_cmac_set_key()

int zpc_aes_cmac_set_key ( struct zpc_aes_cmac * ctx,
struct zpc_aes_key * key )

Set the key to be used in the context of an AES-CMAC operation.

Parameters
[in,out]ctxAES-CMAC context
[in]keyAES key
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_cmac_sign()

int zpc_aes_cmac_sign ( struct zpc_aes_cmac * ctx,
unsigned char * mac,
size_t maclen,
const unsigned char * msg,
size_t msglen )

Do an AES-CMAC signing operation.

Parameters
[in,out]ctxAES-CMAC context
[out]macmessage authentication code
[in]maclenmessage authentication code length [bytes]
[in]msgmessage
[in]msglenmessage length [bytes]
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_cmac_verify()

int zpc_aes_cmac_verify ( struct zpc_aes_cmac * ctx,
const unsigned char * mac,
size_t maclen,
const unsigned char * msg,
size_t msglen )

Do an AES-CMAC verify operation.

Parameters
[in,out]ctxAES-CMAC context
[in]macmessage authentication code
[in]maclenmessage authentication code length [bytes]
[in]msgmessage
[in]msglenmessage length [bytes]
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_cmac_free()

void zpc_aes_cmac_free ( struct zpc_aes_cmac ** ctx)

Free an AES-CMAC context.

Parameters
[in,out]ctxAES-CMAC context