AES-CCM API.
More...
Go to the source code of this file.
|
| int | zpc_aes_ccm_alloc (struct zpc_aes_ccm **ctx) |
| int | zpc_aes_ccm_set_key (struct zpc_aes_ccm *ctx, struct zpc_aes_key *key) |
| int | zpc_aes_ccm_set_iv (struct zpc_aes_ccm *ctx, const unsigned char *iv, size_t ivlen) |
| int | zpc_aes_ccm_encrypt (struct zpc_aes_ccm *ctx, unsigned char *ct, unsigned char *mac, size_t maclen, const unsigned char *aad, size_t aadlen, const unsigned char *pt, size_t ptlen) |
| int | zpc_aes_ccm_decrypt (struct zpc_aes_ccm *ctx, unsigned char *pt, const unsigned char *mac, size_t maclen, const unsigned char *aad, size_t aadlen, const unsigned char *ct, size_t ctlen) |
| void | zpc_aes_ccm_free (struct zpc_aes_ccm **ctx) |
AES-CCM API.
Authenticated encryption API for the Advanced Encryption Standard (AES) block cipher [1] in Counter with CBC-MAC mode of operation [2] .
Definition in file aes_ccm.h.
◆ zpc_aes_ccm_alloc()
| int zpc_aes_ccm_alloc |
( |
struct zpc_aes_ccm ** | ctx | ) |
|
Allocate a new context for an AES-CCM operation.
- Parameters
-
| [in,out] | ctx | AES-CCM context |
- Returns
- 0 on success. Otherwise, a non-zero error code is returned.
◆ zpc_aes_ccm_set_key()
| int zpc_aes_ccm_set_key |
( |
struct zpc_aes_ccm * | ctx, |
|
|
struct zpc_aes_key * | key ) |
Set the key to be used in the context of an AES-CCM operation.
- Parameters
-
| [in,out] | ctx | AES-CCM context |
| [in] | key | AES key |
- Returns
- 0 on success. Otherwise, a non-zero error code is returned.
◆ zpc_aes_ccm_set_iv()
| int zpc_aes_ccm_set_iv |
( |
struct zpc_aes_ccm * | ctx, |
|
|
const unsigned char * | iv, |
|
|
size_t | ivlen ) |
Set the initialization vector to be used in the context of an AES-CCM operation.
- Parameters
-
| [in,out] | ctx | AES-CCM context |
| [in] | iv | 7-13 byte initialization vector |
| [in] | ivlen | initialization vector length [bytes] |
- Returns
- 0 on success. Otherwise, a non-zero error code is returned.
◆ zpc_aes_ccm_encrypt()
| int zpc_aes_ccm_encrypt |
( |
struct zpc_aes_ccm * | ctx, |
|
|
unsigned char * | ct, |
|
|
unsigned char * | mac, |
|
|
size_t | maclen, |
|
|
const unsigned char * | aad, |
|
|
size_t | aadlen, |
|
|
const unsigned char * | pt, |
|
|
size_t | ptlen ) |
Do an AES-CCM authenticated encryption operation.
- Parameters
-
| [in,out] | ctx | AES-CCM context |
| [out] | ct | ciphertext |
| [out] | mac | message authentication code |
| [in] | maclen | message authentication code length [bytes] |
| [in] | aad | additional authenticated data |
| [in] | aadlen | additional authenticated data length [bytes] |
| [in] | pt | plaintext |
| [in] | ptlen | plaintext length [bytes] |
- Returns
- 0 on success. Otherwise, a non-zero error code is returned.
◆ zpc_aes_ccm_decrypt()
| int zpc_aes_ccm_decrypt |
( |
struct zpc_aes_ccm * | ctx, |
|
|
unsigned char * | pt, |
|
|
const unsigned char * | mac, |
|
|
size_t | maclen, |
|
|
const unsigned char * | aad, |
|
|
size_t | aadlen, |
|
|
const unsigned char * | ct, |
|
|
size_t | ctlen ) |
Do an AES-CCM authenticated decryption operation.
- Parameters
-
| [in,out] | ctx | AES-CCM context |
| [out] | pt | plaintext |
| [in] | mac | message authentication code |
| [in] | maclen | message authentication code length [bytes] |
| [in] | aad | additional authenticated data |
| [in] | aadlen | additional authenticated data length [bytes] |
| [in] | ct | ciphertext |
| [in] | ctlen | ciphertext length [bytes] |
- Returns
- 0 on success. Otherwise, a non-zero error code is returned.
◆ zpc_aes_ccm_free()
| void zpc_aes_ccm_free |
( |
struct zpc_aes_ccm ** | ctx | ) |
|
Free an AES-CCM context.
- Parameters
-
| [in,out] | ctx | AES-CCM context |