Galois/Counter Mode (GCM)
Definition in file gcm.h.
Construct tag.
- Parameters
-
Definition at line 408 of file gcm.c.
421 DBGC2 ( context,
"GCM %p E(K,Y[0]):\n", context );
426 DBGC2 ( context,
"GCM %p T:\n", context );
union gcm_block len
Accumulated lengths.
uint8_t raw_ctx[0]
Underlying block cipher context.
struct gcm_lengths len
Lengths.
static void gcm_hash(struct gcm_context *context, union gcm_block *hash)
Construct hash.
static void gcm_xor_block(const union gcm_block *src, union gcm_block *dst)
XOR whole data block in situ.
struct cipher_algorithm * raw_cipher
Underlying block cipher.
#define cipher_encrypt(cipher, ctx, src, dst, len)
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static userptr_t size_t offset
Offset of the first segment within the content.
uint64_t data
Data length.
union gcm_block ctr
Counter (Y)
uint64_t tag
Identity tag.
References cipher_encrypt, gcm_context::ctr, gcm_lengths::data, DBGC2, DBGC2_HDA, gcm_hash(), gcm_xor_block(), gcm_context::len, gcm_block::len, memcpy(), offset, gcm_context::raw_cipher, gcm_context::raw_ctx, tag, and tmp.
Set key.
- Parameters
-
context | Context |
key | Key |
keylen | Key length |
raw_cipher | Underlying cipher |
- Return values
-
Definition at line 439 of file gcm.c.
444 memset ( context, 0,
sizeof ( *context ) );
448 if ( (
rc = cipher_setkey ( raw_cipher, context->
raw_ctx,
key,
454 &context->
key, sizeof ( context->
key ) );
455 DBGC2 ( context,
"GCM %p H:\n", context );
struct arbelprm_rc_send_wqe rc
uint8_t raw_ctx[0]
Underlying block cipher context.
static void gcm_cache(const union gcm_block *key)
Construct cached tables.
uint32_t value
Counter value.
struct cipher_algorithm * raw_cipher
Underlying block cipher.
#define cipher_encrypt(cipher, ctx, src, dst, len)
static void const void size_t keylen
union gcm_block key
Hash key (H)
struct gcm_counter ctr
Counter.
#define cpu_to_be32(value)
union gcm_block ctr
Counter (Y)
void * memset(void *dest, int character, size_t len) __nonnull
References cipher_encrypt, cpu_to_be32, gcm_context::ctr, gcm_block::ctr, DBGC2, DBGC2_HDA, gcm_cache(), gcm_context::key, key, keylen, memset(), gcm_context::raw_cipher, gcm_context::raw_ctx, rc, and gcm_counter::value.
Set initialisation vector.
- Parameters
-
ctx | Context |
iv | Initialisation vector |
ivlen | Initialisation vector length |
Definition at line 474 of file gcm.c.
509 DBGC2 ( context,
"GCM %p Y[0]:\n", context );
union gcm_block len
Accumulated lengths.
struct gcm_lengths len
Lengths.
uint8_t iv[12]
Initialisation vector.
static void gcm_hash(struct gcm_context *context, union gcm_block *hash)
Construct hash.
#define GCM_FL_IV
Calculate hash over an initialisation vector value.
uint32_t value
Counter value.
static void const void size_t ivlen
void * memcpy(void *dest, const void *src, size_t len) __nonnull
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define build_assert(condition)
Assert a condition at build time (after dead code elimination)
static void gcm_process(struct gcm_context *context, const void *src, void *dst, size_t len, unsigned int flags)
Encrypt/decrypt/authenticate data.
struct gcm_counter ctr
Counter.
pseudo_bit_t hash[0x00010]
Hash algorithm.
#define gcm_offset(field)
Offset of a field within GCM context.
#define cpu_to_be32(value)
union gcm_block ctr
Counter (Y)
static void const void * iv
struct gcm_counter ctr
Counter.
uint64_t add
Additional data length.
#define NULL
NULL pointer (VOID *)
void * memset(void *dest, int character, size_t len) __nonnull
References gcm_lengths::add, assert(), build_assert, cpu_to_be32, gcm_context::ctr, ctr, gcm_block::ctr, DBGC2, DBGC2_HDA, GCM_FL_IV, gcm_hash(), gcm_offset, gcm_process(), hash, gcm_counter::iv, iv, ivlen, key, len, gcm_context::len, gcm_block::len, memcpy(), memset(), NULL, and gcm_counter::value.