#include "lc_aead.h"
#include "lc_aes.h"
#include "lc_sym.h"
Go to the source code of this file.
◆ LC_AES_GCM_CTX_ON_STACK
| #define LC_AES_GCM_CTX_ON_STACK |
( |
|
name | ) |
|
Value: _Pragma("GCC diagnostic push") _Pragma( \
"GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
LC_MEM_COMMON_ALIGNMENT); \
struct lc_aead_ctx *name = (struct lc_aead_ctx *)name##_ctx_buf; \
LC_AES_GCM_SET_CTX(name); \
lc_aead_zero(name); \
_Pragma("GCC diagnostic pop")
#define LC_ALIGNED_BUFFER(name, size, alignment)
Allocate aligned stack memory.
Allocate stack memory for the AES GCM cryptor context.
- Parameters
-
| [in] | name | Name of the stack variable |
Definition at line 128 of file lc_aes_gcm.h.
◆ lc_aes_gcm_iv_type
| Enumerator |
|---|
| lc_aes_gcm_iv_generate_new | |
Definition at line 92 of file lc_aes_gcm.h.
◆ lc_aes_gcm_alloc()
| int lc_aes_gcm_alloc |
( |
struct lc_aead_ctx ** |
ctx | ) |
|
Allocate AES GCM cryptor context on heap.
- Parameters
-
| [out] | ctx | Allocated AES GCM cryptor context |
- Returns
- 0 on success, < 0 on error
◆ lc_aes_gcm_generate_iv()
| int lc_aes_gcm_generate_iv |
( |
struct lc_aead_ctx * |
ctx, |
|
|
const uint8_t * |
fixed_field, |
|
|
size_t |
fixed_field_len, |
|
|
uint8_t * |
iv, |
|
|
size_t |
ivlen, |
|
|
enum lc_aes_gcm_iv_type |
type |
|
) |
| |
Generate IV, set the IV to the GCM state and return it to the caller.
The operation copies the fixed_field data into the IV.
- Note
- If fixed_field and iv are the same pointer, the fixed field data is not copied to the iv buffer.
-
If this API is used then the lc_aead_setkey should be invoked with NULL as IV.
-
If this API is to be used, it must be invoked after the API call of lc_aead_setkey.
- Parameters
-
| [in] | ctx | GCM context to set IV with |
| [in] | fixed_field | Fixed field data |
| [in] | fixed_field_len | Length of fixed field |
| [out] | iv | buffer with fixed_field || random number |
| [in] | ivlen | of the IV to be generated |
| [in] | type | IV generation type |
- Returns
- 0 on succes, < 0 on error