Go to the documentation of this file.
64 #include "../../internal.h"
100 sha->
h[6] =
UINT64_C(0x1f83d9abfb41bd6b);
101 sha->
h[7] =
UINT64_C(0x5be0cd19137e2179);
111 sha->
h[0] =
UINT64_C(0x22312194fc2bf72c);
112 sha->
h[1] =
UINT64_C(0x9f555fa3c84c64c2);
113 sha->
h[2] =
UINT64_C(0x2393b86b6f53b151);
114 sha->
h[3] =
UINT64_C(0x963877195940eabd);
115 sha->
h[4] =
UINT64_C(0x96283ee2a88effe3);
116 sha->
h[5] =
UINT64_C(0xbe5e1e2553863992);
117 sha->
h[6] =
UINT64_C(0x2b0199fc2c85b8aa);
118 sha->
h[7] =
UINT64_C(0x0eb72ddc81c52ca2);
157 #if !defined(SHA512_ASM)
202 if (
sizeof(
len) >= 8) {
208 size_t n =
sizeof(
c->p) -
c->num;
222 if (
len >=
sizeof(
c->p)) {
252 if (
n > (
sizeof(sha->
p) - 16)) {
270 assert(sha->
md_len % 8 == 0);
271 const size_t out_words = sha->
md_len / 8;
272 for (
size_t i = 0;
i < out_words;
i++) {
325 (CRYPTO_rotr_u64((x), 28) ^ CRYPTO_rotr_u64((x), 34) ^ \
326 CRYPTO_rotr_u64((x), 39))
328 (CRYPTO_rotr_u64((x), 14) ^ CRYPTO_rotr_u64((x), 18) ^ \
329 CRYPTO_rotr_u64((x), 41))
331 (CRYPTO_rotr_u64((x), 1) ^ CRYPTO_rotr_u64((x), 8) ^ ((x) >> 7))
333 (CRYPTO_rotr_u64((x), 19) ^ CRYPTO_rotr_u64((x), 61) ^ ((x) >> 6))
335 #define Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z)))
336 #define Maj(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
339 #if defined(__i386) || defined(__i386__) || defined(_M_IX86)
359 for (
i = 0;
i < 16;
i++,
F--) {
369 for (;
i < 80;
i++,
F--) {
372 T +=
F[8 + 16] +
F[8 + 16 - 9];
397 #define ROUND_00_15(i, a, b, c, d, e, f, g, h) \
399 T1 += h + Sigma1(e) + Ch(e, f, g) + K512[i]; \
400 h = Sigma0(a) + Maj(a, b, c); \
405 #define ROUND_16_80(i, j, a, b, c, d, e, f, g, h, X) \
407 s0 = X[(j + 1) & 0x0f]; \
409 s1 = X[(j + 14) & 0x0f]; \
411 T1 = X[(j) & 0x0f] += s0 + s1 + X[(j + 9) & 0x0f]; \
412 ROUND_00_15(i + j, a, b, c, d, e, f, g, h); \
417 uint64_t a,
b,
c,
d, e,
f,
g, h, s0, s1,
T1;
465 for (
i = 16;
i < 80;
i += 16) {
466 ROUND_16_80(
i, 0,
a,
b,
c,
d, e,
f,
g, h,
X);
467 ROUND_16_80(
i, 1, h,
a,
b,
c,
d, e,
f,
g,
X);
468 ROUND_16_80(
i, 2,
g, h,
a,
b,
c,
d, e,
f,
X);
469 ROUND_16_80(
i, 3,
f,
g, h,
a,
b,
c,
d, e,
X);
470 ROUND_16_80(
i, 4, e,
f,
g, h,
a,
b,
c,
d,
X);
471 ROUND_16_80(
i, 5,
d, e,
f,
g, h,
a,
b,
c,
X);
472 ROUND_16_80(
i, 6,
c,
d, e,
f,
g, h,
a,
b,
X);
473 ROUND_16_80(
i, 7,
b,
c,
d, e,
f,
g, h,
a,
X);
474 ROUND_16_80(
i, 8,
a,
b,
c,
d, e,
f,
g, h,
X);
475 ROUND_16_80(
i, 9, h,
a,
b,
c,
d, e,
f,
g,
X);
476 ROUND_16_80(
i, 10,
g, h,
a,
b,
c,
d, e,
f,
X);
477 ROUND_16_80(
i, 11,
f,
g, h,
a,
b,
c,
d, e,
X);
478 ROUND_16_80(
i, 12, e,
f,
g, h,
a,
b,
c,
d,
X);
479 ROUND_16_80(
i, 13,
d, e,
f,
g, h,
a,
b,
c,
X);
480 ROUND_16_80(
i, 14,
c,
d, e,
f,
g, h,
a,
b,
X);
481 ROUND_16_80(
i, 15,
b,
c,
d, e,
f,
g, h,
a,
X);
499 #endif // !SHA512_ASM
static uint64_t CRYPTO_load_u64_be(const void *ptr)
int SHA512_256_Final(uint8_t out[SHA512_256_DIGEST_LENGTH], SHA512_CTX *sha)
static void CRYPTO_store_u64_be(void *out, uint64_t v)
static int sha512_final_impl(uint8_t *out, SHA512_CTX *sha)
#define ROUND_00_15(i, a, b, c, d, e, f, g, h)
static struct test_ctx ctx
static void * OPENSSL_memset(void *dst, int c, size_t n)
int SHA384_Final(uint8_t out[SHA384_DIGEST_LENGTH], SHA512_CTX *sha)
#define T(upbtypeconst, upbtype, ctype, default_value)
int SHA384_Init(SHA512_CTX *sha)
#define SHA384_DIGEST_LENGTH
static void sha512_block_data_order(uint64_t *state, const uint8_t *in, size_t num_blocks)
static const uint64_t K512[80]
int SHA512_Init(SHA512_CTX *sha)
unsigned __int64 uint64_t
static void * OPENSSL_memcpy(void *dst, const void *src, size_t n)
int SHA384_Update(SHA512_CTX *sha, const void *data, size_t len)
#define SHA512_256_DIGEST_LENGTH
#define SHA512_DIGEST_LENGTH
int SHA512_Update(SHA512_CTX *c, const void *in_data, size_t len)
void SHA512_Transform(SHA512_CTX *c, const uint8_t block[SHA512_CBLOCK])
int SHA512_256_Update(SHA512_CTX *sha, const void *data, size_t len)
int SHA512_256_Init(SHA512_CTX *sha)
int SHA512_Final(uint8_t out[SHA512_DIGEST_LENGTH], SHA512_CTX *sha)
uint8_t * SHA512(const uint8_t *data, size_t len, uint8_t out[SHA512_DIGEST_LENGTH])
uint8_t * SHA512_256(const uint8_t *data, size_t len, uint8_t out[SHA512_256_DIGEST_LENGTH])
uint8_t * SHA384(const uint8_t *data, size_t len, uint8_t out[SHA384_DIGEST_LENGTH])
if(p->owned &&p->wrapped !=NULL)
#define ROUND_16_80(i, j, a, b, c, d, e, f, g, h, X)
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:12