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

AES-CBC API. More...

Go to the source code of this file.

Functions

int zpc_aes_cbc_alloc (struct zpc_aes_cbc **ctx)
int zpc_aes_cbc_set_key (struct zpc_aes_cbc *ctx, struct zpc_aes_key *key)
int zpc_aes_cbc_set_iv (struct zpc_aes_cbc *ctx, const unsigned char *iv)
int zpc_aes_cbc_get_intermediate_iv (struct zpc_aes_cbc *ctx, unsigned char iv[16])
int zpc_aes_cbc_set_intermediate_iv (struct zpc_aes_cbc *ctx, const unsigned char iv[16])
int zpc_aes_cbc_encrypt (struct zpc_aes_cbc *ctx, unsigned char *ct, const unsigned char *pt, size_t ptlen)
int zpc_aes_cbc_decrypt (struct zpc_aes_cbc *ctx, unsigned char *pt, const unsigned char *ct, size_t ctlen)
void zpc_aes_cbc_free (struct zpc_aes_cbc **ctx)

Detailed Description

AES-CBC API.

Encryption API for the Advanced Encryption Standard (AES) block cipher [1] in Cipher Block Chaining (CBC) mode of operation [8] .

Definition in file aes_cbc.h.

Function Documentation

◆ zpc_aes_cbc_alloc()

int zpc_aes_cbc_alloc ( struct zpc_aes_cbc ** ctx)

Allocate a new context for an AES-CBC operation.

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

◆ zpc_aes_cbc_set_key()

int zpc_aes_cbc_set_key ( struct zpc_aes_cbc * ctx,
struct zpc_aes_key * key )

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

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

◆ zpc_aes_cbc_set_iv()

int zpc_aes_cbc_set_iv ( struct zpc_aes_cbc * ctx,
const unsigned char * iv )

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

Parameters
[in,out]ctxAES-CBC context
[in]iv16 byte initialization vector
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_cbc_get_intermediate_iv()

int zpc_aes_cbc_get_intermediate_iv ( struct zpc_aes_cbc * ctx,
unsigned char iv[16] )

Get the intermediate initialization vector to be used in the context of an AES-CBC operation.

Parameters
[in,out]ctxAES-CBC context
[out]ivapplication provided buffer with 16 bytes size to receive the 16 byte intermediate iv
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_cbc_set_intermediate_iv()

int zpc_aes_cbc_set_intermediate_iv ( struct zpc_aes_cbc * ctx,
const unsigned char iv[16] )

Set the intermediate initialization vector to be used in the context of an AES-CBC operation. An initial iv must be set before via zpc_aes_cbc_set_iv.

Parameters
[in,out]ctxAES-CBC context
[in]iv16 byte intermediate iv
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_cbc_encrypt()

int zpc_aes_cbc_encrypt ( struct zpc_aes_cbc * ctx,
unsigned char * ct,
const unsigned char * pt,
size_t ptlen )

Do an AES-CBC encryption operation.

Parameters
[in,out]ctxAES-CBC context
[out]ctciphertext
[in]ptplaintext
[in]ptlenplaintext length [bytes]
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_cbc_decrypt()

int zpc_aes_cbc_decrypt ( struct zpc_aes_cbc * ctx,
unsigned char * pt,
const unsigned char * ct,
size_t ctlen )

Do an AES-CBC decryption operation.

Parameters
[in,out]ctxAES-CBC context
[out]ptplaintext
[in]ctciphertext
[in]ctlenciphertext length [bytes]
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_cbc_free()

void zpc_aes_cbc_free ( struct zpc_aes_cbc ** ctx)

Free an AES-CBC context.

Parameters
[in,out]ctxAES-CBC context