AES full-xts key API.
More...
Go to the source code of this file.
|
| 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
} |
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.
◆ ZPC_AES_XTS_KEY_TYPE_PVSECRET
| #define ZPC_AES_XTS_KEY_TYPE_PVSECRET 9 |
◆ zpc_xtssecret_type_t
| enum zpc_xtssecret_type_t |
◆ 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
-
- 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] | key | AES-XTS key |
| [in] | size | 128 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] | key | AES-XTS key |
| [in] | type | currently 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] | key | AES full-xts key |
| [in] | seckey | AES full-xts protected key origin (secure-key or pvsecret ID) |
| [in] | seckeylen | AES 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] | key | AES-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] | clrkey | AES 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] | key | AES full-xts key |
| [out] | seckey | AES full-xts protected key origin (secure-key or pvsecret ID) |
| [in,out] | seckeylen | secure 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] | key | AES 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] | key | AES full-xts key |