|
|
@ -39,19 +39,6 @@ typedef struct SHA256Context { |
|
|
|
uint32_t buf[16]; |
|
|
|
uint32_t buf[16]; |
|
|
|
} SHA256_CTX; |
|
|
|
} SHA256_CTX; |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* Encode a length len/4 vector of (uint32_t) into a length len vector of |
|
|
|
|
|
|
|
* (unsigned char) in big-endian form. Assumes len is a multiple of 4. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
static inline void |
|
|
|
|
|
|
|
be32enc_vect(uint32_t *dst, const uint32_t *src, uint32_t len) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
uint32_t i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++) |
|
|
|
|
|
|
|
dst[i] = htobe32(src[i]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Elementary functions used by SHA256 */ |
|
|
|
/* Elementary functions used by SHA256 */ |
|
|
|
#define Ch(x, y, z) ((x & (y ^ z)) ^ z) |
|
|
|
#define Ch(x, y, z) ((x & (y ^ z)) ^ z) |
|
|
|
#define Maj(x, y, z) ((x & (y | z)) | (y & z)) |
|
|
|
#define Maj(x, y, z) ((x & (y | z)) | (y & z)) |
|
|
|