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

AES full-xts key API. More...

Go to the source code of this file.

Macros

#define ZPC_AES_XTS_KEY_TYPE_PVSECRET   9

Enumerations

enum  zpc_xtssecret_type_t { ZPC_XTS_SECRET_TYPE_NOT_SET = -2 , ZPC_XTS_SECRET_TYPE_INVALID = -1 , ZPC_XTS_SECRET_AES_XTS_128 = 0x07 , ZPC_XTS_SECRET_AES_XTS_256 = 0x08 }

Functions

int zpc_aes_xts_key_alloc (struct zpc_aes_xts_key **key)
int zpc_aes_xts_key_set_size (struct zpc_aes_xts_key *key, int size)
int zpc_aes_xts_key_set_type (struct zpc_aes_xts_key *key, int type)
int zpc_aes_xts_key_import (struct zpc_aes_xts_key *key, const unsigned char *seckey, size_t seckeylen)
int zpc_aes_xts_key_import_clear (struct zpc_aes_xts_key *key, const unsigned char *clrkey)
int zpc_aes_xts_key_export (struct zpc_aes_xts_key *key, unsigned char *seckey, size_t *seckeylen)
int zpc_aes_xts_key_generate (struct zpc_aes_xts_key *key)
void zpc_aes_xts_key_free (struct zpc_aes_xts_key **key)

Detailed Description

AES full-xts key API.

Manage advanced Encryption Standard (AES) block cipher [9] keys to be used in a full-xts context.

Definition in file aes_xts_key.h.

Macro Definition Documentation

◆ ZPC_AES_XTS_KEY_TYPE_PVSECRET

#define ZPC_AES_XTS_KEY_TYPE_PVSECRET   9

Definition at line 29 of file aes_xts_key.h.

Enumeration Type Documentation

◆ zpc_xtssecret_type_t

enum zpc_xtssecret_type_t

Definition at line 31 of file aes_xts_key.h.

Function Documentation

◆ zpc_aes_xts_key_alloc()

int zpc_aes_xts_key_alloc ( struct zpc_aes_xts_key ** key)

Allocate a new AES full-xts key object with reference count 1.

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

◆ zpc_aes_xts_key_set_size()

int zpc_aes_xts_key_set_size ( struct zpc_aes_xts_key * key,
int size )

Set the AES full-xts key size.

Parameters
[in,out]keyAES-XTS key
[in]size128 or 256 bit key size
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_xts_key_set_type()

int zpc_aes_xts_key_set_type ( struct zpc_aes_xts_key * key,
int type )

Set the AES full-xts key type.

Parameters
[in,out]keyAES-XTS key
[in]typecurrently only ZPC_AES_XTS_KEY_TYPE_PVSECRET
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_xts_key_import()

int zpc_aes_xts_key_import ( struct zpc_aes_xts_key * key,
const unsigned char * seckey,
size_t seckeylen )

Import an AES-XTS protected key origin (secure key or pvsecret ID).

Parameters
[in,out]keyAES full-xts key
[in]seckeyAES full-xts protected key origin (secure-key or pvsecret ID)
[in]seckeylenAES full-xts protected key origin length [bytes]
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_xts_key_import_clear()

int zpc_aes_xts_key_import_clear ( struct zpc_aes_xts_key * key,
const unsigned char * clrkey )

Import an AES-XTS clear-key.

Parameters
[in,out]keyAES-XTS key. If the key object has no type set, a full-xts protected key is created from the given key material. If the type is set to ZPC_AES_XTS_KEY_TYPE_PVSECRET then the import is not possible.
[in]clrkeyAES XTS clear-key. The application must provide concatenated key material for two single AES keys of the specified size, i.e. either 2 x 16 bytes or 2 x 32 bytes.
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_xts_key_export()

int zpc_aes_xts_key_export ( struct zpc_aes_xts_key * key,
unsigned char * seckey,
size_t * seckeylen )

Export an AES-XTS protected key origin (secure key or pvsecret ID).

Parameters
[in,out]keyAES full-xts key
[out]seckeyAES full-xts protected key origin (secure-key or pvsecret ID)
[in,out]seckeylensecure AES full-xts protected key origin length [bytes]
Returns
0 on success. Otherwise, a non-zero error code is returned.

◆ zpc_aes_xts_key_generate()

int zpc_aes_xts_key_generate ( struct zpc_aes_xts_key * key)

Generate an AES-XTS key. If the key object has no type set, a full-xts random protected key is created. If the type is set to ZPC_AES_XTS_KEY_TYPE_PVSECRET then generate is not possible.

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

◆ zpc_aes_xts_key_free()

void zpc_aes_xts_key_free ( struct zpc_aes_xts_key ** key)

Decrease the reference count of an AES full-xts key object and free it the count reaches 0.

Parameters
[in,out]keyAES full-xts key