|
Tor 0.4.9.8
|
Implementation for polyval universal hash function. More...
Go to the source code of this file.
Data Structures | |
| struct | polyval_key_t |
| struct | polyval_t |
Macros | |
| #define | POLYVAL_KEY_LEN 16 |
| #define | POLYVAL_BLOCK_LEN 16 |
| #define | POLYVAL_TAG_LEN 16 |
| #define | polyvalx_t polyval_t |
| #define | polyvalx_key_init polyval_key_init |
| #define | polyvalx_init polyval_init |
| #define | polyvalx_init_from_key polyval_init_from_key |
| #define | polyvalx_add_block polyval_add_block |
| #define | polyvalx_add_zpad polyval_add_zpad |
| #define | polyvalx_get_tag polyval_get_tag |
| #define | polyvalx_reset polyval_reset |
Functions | |
| void | polyval_key_init (polyval_key_t *, const uint8_t *key) |
| void | polyval_init (polyval_t *, const uint8_t *key) |
| void | polyval_init_from_key (polyval_t *, const polyval_key_t *key) |
| void | polyval_add_block (polyval_t *, const uint8_t *block) |
| void | polyval_add_zpad (polyval_t *, const uint8_t *data, size_t n) |
| void | polyval_get_tag (const polyval_t *, uint8_t *tag_out) |
| void | polyval_reset (polyval_t *) |
| void | polyval_detect_implementation (void) |
Implementation for polyval universal hash function.
APIs for polyval universal hash function.
Polyval, which was first defined for AES-GCM-SIV, is a universal hash based on multiplication in GF(2^128). Unlike the more familiar GHASH, it is defined to work on little-endian inputs, and so is more straightforward and efficient on little-endian architectures.
In Tor we use it as part of the Counter Galois Onion relay encryption format.
Definition in file polyval.h.
| #define POLYVAL_BLOCK_LEN 16 |
| #define POLYVAL_KEY_LEN 16 |
Length of a polyval key, in bytes.
Definition at line 100 of file polyval.h.
Referenced by cgo_uiv_init(), and cgo_uiv_update().
| #define POLYVAL_TAG_LEN 16 |
| #define polyvalx_add_block polyval_add_block |
| #define polyvalx_add_zpad polyval_add_zpad |
| #define polyvalx_get_tag polyval_get_tag |
| #define polyvalx_init polyval_init |
| #define polyvalx_init_from_key polyval_init_from_key |
| #define polyvalx_key_init polyval_key_init |
| #define polyvalx_reset polyval_reset |
| void polyval_add_block | ( | polyval_t * | , |
| const uint8_t * | block ) |
Update a polyval instance with a new 16-byte block.
Referenced by cgo_prf_gen_t1(), and cgo_prf_xor_t0().
| void polyval_add_zpad | ( | polyval_t * | , |
| const uint8_t * | data, | ||
| size_t | n ) |
Update a polyval instance with 'n' bytes from 'data'. If 'n' is not evenly divisible by 16, pad it at the end with zeros.
NOTE: This is not a general-purpose padding construction; it can be insecure if your are using it in context where the input length is variable.
| void polyval_detect_implementation | ( | void | ) |
| void polyval_get_tag | ( | const polyval_t * | , |
| uint8_t * | tag_out ) |
Copy the 16-byte tag from a polyval instance into 'tag_out'
Referenced by cgo_prf_gen_t1(), and cgo_prf_xor_t0().
| void polyval_init | ( | polyval_t * | , |
| const uint8_t * | key ) |
Initialize a polyval instance with a given key.
| void polyval_init_from_key | ( | polyval_t * | , |
| const polyval_key_t * | key ) |
Initialize a polyval instance with a preconstructed key.
Referenced by cgo_prf_gen_t1(), and cgo_prf_xor_t0().
| void polyval_key_init | ( | polyval_key_t * | , |
| const uint8_t * | key ) |
Do any necessary precomputation from a polyval key, and store it.
Referenced by cgo_prf_init(), and cgo_prf_set_key().
| void polyval_reset | ( | polyval_t * | ) |
Reset a polyval instance to its original state, retaining its key.