GNU libmicrohttpd
0.9.63
|
Go to the source code of this file.
Macros | |
#define | SHA256_DATA_LENGTH 16 |
#define | Choice(x, y, z) ( (z) ^ ( (x) & ( (y) ^ (z) ) ) ) |
#define | Majority(x, y, z) ( ((x) & (y)) ^ ((z) & ((x) ^ (y))) ) |
#define | S0(x) (ROTL32(30,(x)) ^ ROTL32(19,(x)) ^ ROTL32(10,(x))) |
#define | S1(x) (ROTL32(26,(x)) ^ ROTL32(21,(x)) ^ ROTL32(7,(x))) |
#define | s0(x) (ROTL32(25,(x)) ^ ROTL32(14,(x)) ^ ((x) >> 3)) |
#define | s1(x) (ROTL32(15,(x)) ^ ROTL32(13,(x)) ^ ((x) >> 10)) |
#define | EXPAND(W, i) ( W[(i) & 15 ] += (s1(W[((i)-2) & 15]) + W[((i)-7) & 15] + s0(W[((i)-15) & 15])) ) |
#define | ROUND(a, b, c, d, e, f, g, h, k, data) |
#define | READ_UINT32(p) |
#define | WRITE_UINT32(p, i) |
#define | WRITE_UINT64(p, i) |
#define | ROTL32(n, x) (((x)<<(n)) | ((x)>>((-(n)&31)))) |
#define | COMPRESS(ctx, data) (_nettle_sha256_compress((ctx)->state, (data), K)) |
#define | MD_UPDATE(ctx, length, data, f, incr) |
#define | MD_PAD(ctx, size, f) |
Functions | |
static void | _nettle_sha256_compress (uint32_t *state, const uint8_t *input, const uint32_t *k) |
void | sha256_init (void *ctx_) |
void | sha256_update (void *ctx_, const uint8_t *data, size_t length) |
void | _nettle_write_be32 (size_t length, uint8_t *dst, const uint32_t *src) |
static void | sha256_write_digest (struct sha256_ctx *ctx, size_t length, uint8_t *digest) |
void | sha256_digest (void *ctx_, uint8_t *digest) |
Variables | |
static const uint32_t | K [64] |
#define Choice | ( | x, | |
y, | |||
z | |||
) | ( (z) ^ ( (x) & ( (y) ^ (z) ) ) ) |
#define COMPRESS | ( | ctx, | |
data | |||
) | (_nettle_sha256_compress((ctx)->state, (data), K)) |
#define Majority | ( | x, | |
y, | |||
z | |||
) | ( ((x) & (y)) ^ ((z) & ((x) ^ (y))) ) |
#define MD_PAD | ( | ctx, | |
size, | |||
f | |||
) |
#define READ_UINT32 | ( | p | ) |
#define ROUND | ( | a, | |
b, | |||
c, | |||
d, | |||
e, | |||
f, | |||
g, | |||
h, | |||
k, | |||
data | |||
) |
#define WRITE_UINT32 | ( | p, | |
i | |||
) |
#define WRITE_UINT64 | ( | p, | |
i | |||
) |
|
static |
Definition at line 164 of file sha256.c.
References data, EXPAND, READ_UINT32, ROUND, and SHA256_DATA_LENGTH.
void _nettle_write_be32 | ( | size_t | length, |
uint8_t * | dst, | ||
const uint32_t * | src | ||
) |
Definition at line 337 of file sha256.c.
References WRITE_UINT32.
Referenced by sha256_write_digest().
void sha256_digest | ( | void * | ctx_, |
uint8_t * | digest | ||
) |
Definition at line 398 of file sha256.c.
References SHA256_DIGEST_SIZE, sha256_init(), and sha256_write_digest().
void sha256_init | ( | void * | ctx_ | ) |
Start SHA256 calculation.
ctx_ | must be a struct sha256_ctx * |
Definition at line 238 of file sha256.c.
References _SHA256_DIGEST_LENGTH, sha256_ctx::count, sha256_ctx::index, and sha256_ctx::state.
Referenced by sha256_digest().
void sha256_update | ( | void * | ctx_, |
const uint8_t * | data, | ||
size_t | length | ||
) |
Update hash calculation.
ctx_ | must be a struct sha256_ctx * |
length | number of bytes in data |
data | bytes to add to hash |
Definition at line 326 of file sha256.c.
References COMPRESS, sha256_ctx::count, data, and MD_UPDATE.
|
static |
Definition at line 375 of file sha256.c.
References _nettle_write_be32(), sha256_ctx::block, COMPRESS, sha256_ctx::count, sha256_ctx::index, MD_PAD, SHA256_BLOCK_SIZE, SHA256_DIGEST_SIZE, sha256_ctx::state, and WRITE_UINT64.
Referenced by sha256_digest().
|
static |