AES-CBC API.
More...
Go to the source code of this file.
|
| 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) |
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.
◆ 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] | ctx | AES-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] | ctx | AES-CBC context |
| [in] | key | AES 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] | ctx | AES-CBC context |
| [in] | iv | 16 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] | ctx | AES-CBC context |
| [out] | iv | application 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] | ctx | AES-CBC context |
| [in] | iv | 16 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] | ctx | AES-CBC context |
| [out] | ct | ciphertext |
| [in] | pt | plaintext |
| [in] | ptlen | plaintext 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] | ctx | AES-CBC context |
| [out] | pt | plaintext |
| [in] | ct | ciphertext |
| [in] | ctlen | ciphertext 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] | ctx | AES-CBC context |