iPXE
|
Galois/Counter Mode (GCM) More...
Go to the source code of this file.
Data Structures | |
struct | gcm_counter |
A GCM counter. More... | |
struct | gcm_lengths |
A GCM length pair. More... | |
union | gcm_block |
A GCM block. More... | |
struct | gcm_context |
GCM context. More... | |
Macros | |
#define | GCM_CIPHER(_gcm_name, _gcm_cipher, _raw_cipher, _raw_context, _blocksize) |
Create a GCM mode of behaviour of an existing cipher. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
void | gcm_tag (struct gcm_context *context, union gcm_block *tag) |
Construct tag. More... | |
int | gcm_setkey (struct gcm_context *context, const void *key, size_t keylen, struct cipher_algorithm *raw_cipher) |
Set key. More... | |
void | gcm_setiv (struct gcm_context *context, const void *iv, size_t ivlen) |
Set initialisation vector. More... | |
void | gcm_encrypt (struct gcm_context *context, const void *src, void *dst, size_t len) |
Encrypt data. More... | |
void | gcm_decrypt (struct gcm_context *context, const void *src, void *dst, size_t len) |
Decrypt data. More... | |
Galois/Counter Mode (GCM)
Definition in file gcm.h.
#define GCM_CIPHER | ( | _gcm_name, | |
_gcm_cipher, | |||
_raw_cipher, | |||
_raw_context, | |||
_blocksize | |||
) |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
void gcm_tag | ( | struct gcm_context * | context, |
union gcm_block * | tag | ||
) |
Construct tag.
context | Context |
tag | Tag |
Definition at line 408 of file gcm.c.
References cipher_encrypt, gcm_context::ctr, gcm_lengths::data, DBGC2, DBGC2_HDA, gcm_count(), gcm_hash(), gcm_xor_block(), gcm_block::len, gcm_context::len, memcpy(), offset, gcm_context::raw_cipher, gcm_context::raw_ctx, tag, and tmp.
int gcm_setkey | ( | struct gcm_context * | context, |
const void * | key, | ||
size_t | keylen, | ||
struct cipher_algorithm * | raw_cipher | ||
) |
Set key.
context | Context |
key | Key |
keylen | Key length |
raw_cipher | Underlying cipher |
rc | Return status code |
Definition at line 439 of file gcm.c.
References cipher_encrypt, cipher_setkey(), cpu_to_be32, gcm_context::ctr, gcm_block::ctr, DBGC2, DBGC2_HDA, gcm_cache(), key, gcm_context::key, memset(), gcm_context::raw_cipher, gcm_context::raw_ctx, rc, and gcm_counter::value.
void gcm_setiv | ( | struct gcm_context * | context, |
const void * | iv, | ||
size_t | ivlen | ||
) |
Set initialisation vector.
ctx | Context |
iv | Initialisation vector |
ivlen | Initialisation vector length |
Definition at line 474 of file gcm.c.
References gcm_lengths::add, assert(), build_assert, cpu_to_be32, gcm_context::ctr, gcm_block::ctr, DBGC2, DBGC2_HDA, GCM_FL_IV, gcm_hash(), gcm_offset, gcm_process(), hash, gcm_counter::iv, iv, key, len, gcm_context::len, gcm_block::len, memcpy(), memset(), NULL, and gcm_counter::value.
void gcm_encrypt | ( | struct gcm_context * | context, |
const void * | src, | ||
void * | dst, | ||
size_t | len | ||
) |
Encrypt data.
context | Context |
src | Data to encrypt |
dst | Buffer for encrypted data, or NULL for additional data |
len | Length of data |
Definition at line 521 of file gcm.c.
References GCM_FL_ENCRYPT, gcm_process(), len, and src.
void gcm_decrypt | ( | struct gcm_context * | context, |
const void * | src, | ||
void * | dst, | ||
size_t | len | ||
) |
Decrypt data.
context | Context |
src | Data to decrypt |
dst | Buffer for decrypted data, or NULL for additional data |
len | Length of data |
Definition at line 536 of file gcm.c.
References gcm_process(), len, and src.