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

AES-XTS API. More...

Go to the source code of this file.

Functions

int zpc_aes_xts_alloc (struct zpc_aes_xts **ctx)
int zpc_aes_xts_set_key (struct zpc_aes_xts *ctx, struct zpc_aes_key *key1, struct zpc_aes_key *key2)
int zpc_aes_xts_set_iv (struct zpc_aes_xts *ctx, const unsigned char *iv)
int zpc_aes_xts_get_intermediate_iv (struct zpc_aes_xts *ctx, unsigned char iv[16])
int zpc_aes_xts_set_intermediate_iv (struct zpc_aes_xts *ctx, const unsigned char iv[16])
int zpc_aes_xts_encrypt (struct zpc_aes_xts *ctx, unsigned char *ct, const unsigned char *pt, size_t ptlen)
int zpc_aes_xts_decrypt (struct zpc_aes_xts *ctx, unsigned char *pt, const unsigned char *ct, size_t ctlen)
void zpc_aes_xts_free (struct zpc_aes_xts **ctx)

Detailed Description

AES-XTS API.

Encryption API for the Advanced Encryption Standard (AES) block cipher [1] in XEX-based Tweaked-codebook mode with ciphertext Stealing (XTS) mode of operation [9] .

Definition in file aes_xts.h.

Function Documentation

◆ zpc_aes_xts_alloc()

int zpc_aes_xts_alloc ( struct zpc_aes_xts ** ctx)

Allocate a new context for an AES-XTS operation.

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

◆ zpc_aes_xts_set_key()

int zpc_aes_xts_set_key ( struct zpc_aes_xts * ctx,
struct zpc_aes_key * key1,
struct zpc_aes_key * key2 )

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

Parameters
[in,out]ctxAES-XTS context
[in]key1first AES key
[in]key2second AES key
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_xts_set_iv()

int zpc_aes_xts_set_iv ( struct zpc_aes_xts * ctx,
const unsigned char * iv )

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

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

◆ zpc_aes_xts_get_intermediate_iv()

int zpc_aes_xts_get_intermediate_iv ( struct zpc_aes_xts * ctx,
unsigned char iv[16] )

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

Parameters
[in,out]ctxAES-XTS 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_xts_set_intermediate_iv()

int zpc_aes_xts_set_intermediate_iv ( struct zpc_aes_xts * ctx,
const unsigned char iv[16] )

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

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

◆ zpc_aes_xts_encrypt()

int zpc_aes_xts_encrypt ( struct zpc_aes_xts * ctx,
unsigned char * ct,
const unsigned char * pt,
size_t ptlen )

Do an AES-XTS encryption operation.

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

◆ zpc_aes_xts_decrypt()

int zpc_aes_xts_decrypt ( struct zpc_aes_xts * ctx,
unsigned char * pt,
const unsigned char * ct,
size_t ctlen )

Do an AES-XTS decryption operation.

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

◆ zpc_aes_xts_free()

void zpc_aes_xts_free ( struct zpc_aes_xts ** ctx)

Free an AES-XTS context.

Parameters
[in,out]ctxAES-XTS context