29#ifndef PROTOCORE_AESGCM_H
30#define PROTOCORE_AESGCM_H
38#define PC_AESGCM_KEY_LEN 32
40#define PC_AESGCM_IV_LEN 12
42#define PC_AESGCM_TAG_LEN 16
71 const uint8_t *pt,
size_t pt_len, uint8_t *ct_out, uint8_t tag_out[
PC_AESGCM_TAG_LEN]);
78 const uint8_t *ct,
size_t ct_len,
const uint8_t tag[
PC_AESGCM_TAG_LEN], uint8_t *out);
bool pc_aesgcm_open(pc_aesgcm_key *k, const uint8_t nonce[PC_AESGCM_IV_LEN], const uint8_t *aad, size_t aad_len, const uint8_t *ct, size_t ct_len, const uint8_t tag[PC_AESGCM_TAG_LEN], uint8_t *out)
Open one record: verify tag over aad || ct in constant time, then (only on success) decrypt ct into o...
pc_aesgcm_key * pc_aesgcm_key_init(void *storage, const uint8_t key[PC_AESGCM_KEY_LEN])
Bind storage as a context keyed with key.
pc_cspan pc_aesgcm_seal(pc_aesgcm_key *k, const uint8_t nonce[PC_AESGCM_IV_LEN], const uint8_t *aad, size_t aad_len, const uint8_t *pt, size_t pt_len, uint8_t *ct_out, uint8_t tag_out[PC_AESGCM_TAG_LEN])
Seal one record under k and nonce.
#define PC_AESGCM_TAG_LEN
GCM authentication tag length (bytes).
void pc_aesgcm_key_wipe(pc_aesgcm_key *k)
Wipe the expanded schedule. Call on rekey and on close; the storage stays the caller's.
#define PC_AESGCM_IV_LEN
GCM nonce length (bytes) = fixed_field(4) || invocation_counter(8).
void pc_aesgcm_iv_increment(uint8_t iv[PC_AESGCM_IV_LEN])
Advance the RFC 5647 invocation counter: the low 8 bytes of the 12-byte nonce as a big-endian integer...
#define PC_AESGCM_KEY_LEN
AES-256-GCM key length (bytes).
User-facing configuration for ProtoCore.
A byte region whose run length is bound in both directions.