GNU libmicrohttpd 1.0.0
|
Calculation of SHA-512/256 digest as defined in FIPS PUB 180-4 (2015) More...
Go to the source code of this file.
Macros | |
#define | Ch(x, y, z) ( (z) ^ ((x) & ((y) ^ (z))) ) |
#define | Maj(x, y, z) ( ((x) & (y)) ^ ((z) & ((x) ^ (y))) ) |
#define | SIG0(x) ( _MHD_ROTR64 ((x), 28) ^ _MHD_ROTR64 ((x), 34) ^ _MHD_ROTR64 ((x), 39) ) |
#define | SIG1(x) ( _MHD_ROTR64 ((x), 14) ^ _MHD_ROTR64 ((x), 18) ^ _MHD_ROTR64 ((x), 41) ) |
#define | sig0(x) ( _MHD_ROTR64 ((x), 1) ^ _MHD_ROTR64 ((x), 8) ^ ((x) >> 7) ) |
#define | sig1(x) ( _MHD_ROTR64 ((x), 19) ^ _MHD_ROTR64 ((x), 61) ^ ((x) >> 6) ) |
#define | SHA2STEP64(vA, vB, vC, vD, vE, vF, vG, vH, kt, wt) |
#define | GET_W_FROM_DATA(buf, t) _MHD_GET_64BIT_BE (((const uint64_t*) (buf)) + (t)) |
#define | Wgen(w, t) |
#define | SHA512_256_SIZE_OF_LEN_ADD_BITS 128 |
#define | SHA512_256_SIZE_OF_LEN_ADD (SHA512_256_SIZE_OF_LEN_ADD_BITS / 8) |
Functions | |
void | MHD_SHA512_256_init (struct Sha512_256Ctx *ctx) |
static MHD_DATA_TRUNCATION_RUNTIME_CHECK_DISABLE_ void | sha512_256_transform (uint64_t H[SHA512_256_HASH_SIZE_WORDS], const void *data) |
void | MHD_SHA512_256_update (struct Sha512_256Ctx *ctx, const uint8_t *data, size_t length) |
void | MHD_SHA512_256_finish (struct Sha512_256Ctx *ctx, uint8_t digest[SHA512_256_DIGEST_SIZE]) |
Calculation of SHA-512/256 digest as defined in FIPS PUB 180-4 (2015)
Definition in file sha512_256.c.
#define Ch | ( | x, | |
y, | |||
z ) ( (z) ^ ((x) & ((y) ^ (z))) ) |
#define GET_W_FROM_DATA | ( | buf, | |
t ) _MHD_GET_64BIT_BE (((const uint64_t*) (buf)) + (t)) |
Referenced by sha512_256_transform().
#define Maj | ( | x, | |
y, | |||
z ) ( ((x) & (y)) ^ ((z) & ((x) ^ (y))) ) |
#define SHA2STEP64 | ( | vA, | |
vB, | |||
vC, | |||
vD, | |||
vE, | |||
vF, | |||
vG, | |||
vH, | |||
kt, | |||
wt ) |
#define SHA512_256_SIZE_OF_LEN_ADD (SHA512_256_SIZE_OF_LEN_ADD_BITS / 8) |
Size of "length" insertion in bytes.
Definition at line 526 of file sha512_256.c.
Referenced by MHD_SHA512_256_finish().
#define SHA512_256_SIZE_OF_LEN_ADD_BITS 128 |
Size of "length" insertion in bits. See FIPS PUB 180-4 clause 5.1.2.
Definition at line 521 of file sha512_256.c.
#define SIG0 | ( | x | ) | ( _MHD_ROTR64 ((x), 28) ^ _MHD_ROTR64 ((x), 34) ^ _MHD_ROTR64 ((x), 39) ) |
#define sig0 | ( | x | ) | ( _MHD_ROTR64 ((x), 1) ^ _MHD_ROTR64 ((x), 8) ^ ((x) >> 7) ) |
#define SIG1 | ( | x | ) | ( _MHD_ROTR64 ((x), 14) ^ _MHD_ROTR64 ((x), 18) ^ _MHD_ROTR64 ((x), 41) ) |
#define sig1 | ( | x | ) | ( _MHD_ROTR64 ((x), 19) ^ _MHD_ROTR64 ((x), 61) ^ ((x) >> 6) ) |
#define Wgen | ( | w, | |
t ) |
Referenced by sha512_256_transform().
void MHD_SHA512_256_finish | ( | struct Sha512_256Ctx * | ctx, |
uint8_t | digest[SHA512_256_DIGEST_SIZE] ) |
Finalise SHA-512/256 calculation, return digest.
ctx | the calculation context | |
[out] | digest | set to the hash, must be SHA512_256_DIGEST_SIZE bytes |
< Number of processed bits
< Number of bytes in the context buffer
Definition at line 535 of file sha512_256.c.
References _MHD_PUT_64BIT_BE, _MHD_UINT64_ALIGN, Sha512_256Ctx::buffer, Sha512_256Ctx::count, Sha512_256Ctx::count_bits_hi, Sha512_256Ctx::H, SHA512_256_BLOCK_SIZE, SHA512_256_BLOCK_SIZE_WORDS, SHA512_256_BYTES_IN_WORD, SHA512_256_DIGEST_SIZE, SHA512_256_DIGEST_SIZE_WORDS, SHA512_256_SIZE_OF_LEN_ADD, and sha512_256_transform().
Referenced by digest_calc_hash().
void MHD_SHA512_256_init | ( | struct Sha512_256Ctx * | ctx | ) |
Initialise structure for SHA-512/256 calculation.
ctx | the calculation context |
Definition at line 41 of file sha512_256.c.
References Sha512_256Ctx::count, Sha512_256Ctx::count_bits_hi, and Sha512_256Ctx::H.
Referenced by digest_init_one_time(), and digest_reset().
void MHD_SHA512_256_update | ( | struct Sha512_256Ctx * | ctx, |
const uint8_t * | data, | ||
size_t | length ) |
Process portion of bytes.
ctx | the calculation context |
data | bytes to add to hash |
length | number of bytes in data |
< Number of bytes in the context buffer
< The high part to be moved to another variable
Definition at line 460 of file sha512_256.c.
References Sha512_256Ctx::buffer, Sha512_256Ctx::count, Sha512_256Ctx::count_bits_hi, data, Sha512_256Ctx::H, mhd_assert, NULL, SHA512_256_BLOCK_SIZE, and sha512_256_transform().
Referenced by digest_update().
|
static |
Base of SHA-512/256 transformation. Gets full 128 bytes block of data and updates hash values;
H | hash values |
data | the data buffer with SHA512_256_BLOCK_SIZE bytes block |
Definition at line 70 of file sha512_256.c.
References _MHD_UINT64_ALIGN, data, GET_W_FROM_DATA, SHA2STEP64, and Wgen.
Referenced by MHD_SHA512_256_finish(), and MHD_SHA512_256_update().