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

AES-CCM API. More...

Go to the source code of this file.

Functions

int zpc_aes_ccm_alloc (struct zpc_aes_ccm **ctx)
int zpc_aes_ccm_set_key (struct zpc_aes_ccm *ctx, struct zpc_aes_key *key)
int zpc_aes_ccm_set_iv (struct zpc_aes_ccm *ctx, const unsigned char *iv, size_t ivlen)
int zpc_aes_ccm_encrypt (struct zpc_aes_ccm *ctx, unsigned char *ct, unsigned char *mac, size_t maclen, const unsigned char *aad, size_t aadlen, const unsigned char *pt, size_t ptlen)
int zpc_aes_ccm_decrypt (struct zpc_aes_ccm *ctx, unsigned char *pt, const unsigned char *mac, size_t maclen, const unsigned char *aad, size_t aadlen, const unsigned char *ct, size_t ctlen)
void zpc_aes_ccm_free (struct zpc_aes_ccm **ctx)

Detailed Description

AES-CCM API.

Authenticated encryption API for the Advanced Encryption Standard (AES) block cipher [1] in Counter with CBC-MAC mode of operation [2] .

Definition in file aes_ccm.h.

Function Documentation

◆ zpc_aes_ccm_alloc()

int zpc_aes_ccm_alloc ( struct zpc_aes_ccm ** ctx)

Allocate a new context for an AES-CCM operation.

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

◆ zpc_aes_ccm_set_key()

int zpc_aes_ccm_set_key ( struct zpc_aes_ccm * ctx,
struct zpc_aes_key * key )

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

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

◆ zpc_aes_ccm_set_iv()

int zpc_aes_ccm_set_iv ( struct zpc_aes_ccm * ctx,
const unsigned char * iv,
size_t ivlen )

Set the initialization vector to be used in the context of an AES-CCM operation.

Parameters
[in,out]ctxAES-CCM context
[in]iv7-13 byte initialization vector
[in]ivleninitialization vector length [bytes]
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_ccm_encrypt()

int zpc_aes_ccm_encrypt ( struct zpc_aes_ccm * ctx,
unsigned char * ct,
unsigned char * mac,
size_t maclen,
const unsigned char * aad,
size_t aadlen,
const unsigned char * pt,
size_t ptlen )

Do an AES-CCM authenticated encryption operation.

Parameters
[in,out]ctxAES-CCM context
[out]ctciphertext
[out]macmessage authentication code
[in]maclenmessage authentication code length [bytes]
[in]aadadditional authenticated data
[in]aadlenadditional authenticated data length [bytes]
[in]ptplaintext
[in]ptlenplaintext length [bytes]
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_ccm_decrypt()

int zpc_aes_ccm_decrypt ( struct zpc_aes_ccm * ctx,
unsigned char * pt,
const unsigned char * mac,
size_t maclen,
const unsigned char * aad,
size_t aadlen,
const unsigned char * ct,
size_t ctlen )

Do an AES-CCM authenticated decryption operation.

Parameters
[in,out]ctxAES-CCM context
[out]ptplaintext
[in]macmessage authentication code
[in]maclenmessage authentication code length [bytes]
[in]aadadditional authenticated data
[in]aadlenadditional authenticated data length [bytes]
[in]ctciphertext
[in]ctlenciphertext length [bytes]
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_ccm_free()

void zpc_aes_ccm_free ( struct zpc_aes_ccm ** ctx)

Free an AES-CCM context.

Parameters
[in,out]ctxAES-CCM context