Macros | Functions | Variables
sha512.c File Reference
#include <openssl/sha.h>
#include <string.h>
#include <openssl/mem.h>
#include "internal.h"
#include "../../internal.h"
Include dependency graph for sha512.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define Ch(x, y, z)   (((x) & (y)) ^ ((~(x)) & (z)))
 
#define Maj(x, y, z)   (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
 
#define ROUND_00_15(i, a, b, c, d, e, f, g, h)
 
#define ROUND_16_80(i, j, a, b, c, d, e, f, g, h, X)
 
#define Sigma0(x)
 
#define sigma0(x)   (CRYPTO_rotr_u64((x), 1) ^ CRYPTO_rotr_u64((x), 8) ^ ((x) >> 7))
 
#define Sigma1(x)
 
#define sigma1(x)   (CRYPTO_rotr_u64((x), 19) ^ CRYPTO_rotr_u64((x), 61) ^ ((x) >> 6))
 

Functions

uint8_tSHA384 (const uint8_t *data, size_t len, uint8_t out[SHA384_DIGEST_LENGTH])
 
int SHA384_Final (uint8_t out[SHA384_DIGEST_LENGTH], SHA512_CTX *sha)
 
int SHA384_Init (SHA512_CTX *sha)
 
int SHA384_Update (SHA512_CTX *sha, const void *data, size_t len)
 
uint8_tSHA512 (const uint8_t *data, size_t len, uint8_t out[SHA512_DIGEST_LENGTH])
 
uint8_tSHA512_256 (const uint8_t *data, size_t len, uint8_t out[SHA512_256_DIGEST_LENGTH])
 
int SHA512_256_Final (uint8_t out[SHA512_256_DIGEST_LENGTH], SHA512_CTX *sha)
 
int SHA512_256_Init (SHA512_CTX *sha)
 
int SHA512_256_Update (SHA512_CTX *sha, const void *data, size_t len)
 
static void sha512_block_data_order (uint64_t *state, const uint8_t *in, size_t num_blocks)
 
int SHA512_Final (uint8_t out[SHA512_DIGEST_LENGTH], SHA512_CTX *sha)
 
static int sha512_final_impl (uint8_t *out, SHA512_CTX *sha)
 
int SHA512_Init (SHA512_CTX *sha)
 
void SHA512_Transform (SHA512_CTX *c, const uint8_t block[SHA512_CBLOCK])
 
int SHA512_Update (SHA512_CTX *c, const void *in_data, size_t len)
 

Variables

static const uint64_t K512 [80]
 

Macro Definition Documentation

◆ Ch

#define Ch (   x,
  y,
  z 
)    (((x) & (y)) ^ ((~(x)) & (z)))

Definition at line 335 of file sha512.c.

◆ Maj

#define Maj (   x,
  y,
  z 
)    (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))

Definition at line 336 of file sha512.c.

◆ ROUND_00_15

#define ROUND_00_15 (   i,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
 
)
Value:
do { \
T1 += h + Sigma1(e) + Ch(e, f, g) + K512[i]; \
h = Sigma0(a) + Maj(a, b, c); \
d += T1; \
h += T1; \
} while (0)

Definition at line 397 of file sha512.c.

◆ ROUND_16_80

#define ROUND_16_80 (   i,
  j,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  X 
)
Value:
do { \
s0 = X[(j + 1) & 0x0f]; \
s0 = sigma0(s0); \
s1 = X[(j + 14) & 0x0f]; \
s1 = sigma1(s1); \
T1 = X[(j) & 0x0f] += s0 + s1 + X[(j + 9) & 0x0f]; \
ROUND_00_15(i + j, a, b, c, d, e, f, g, h); \
} while (0)

Definition at line 405 of file sha512.c.

◆ Sigma0

#define Sigma0 (   x)
Value:
(CRYPTO_rotr_u64((x), 28) ^ CRYPTO_rotr_u64((x), 34) ^ \
CRYPTO_rotr_u64((x), 39))

Definition at line 324 of file sha512.c.

◆ sigma0

#define sigma0 (   x)    (CRYPTO_rotr_u64((x), 1) ^ CRYPTO_rotr_u64((x), 8) ^ ((x) >> 7))

Definition at line 330 of file sha512.c.

◆ Sigma1

#define Sigma1 (   x)
Value:
(CRYPTO_rotr_u64((x), 14) ^ CRYPTO_rotr_u64((x), 18) ^ \
CRYPTO_rotr_u64((x), 41))

Definition at line 327 of file sha512.c.

◆ sigma1

#define sigma1 (   x)    (CRYPTO_rotr_u64((x), 19) ^ CRYPTO_rotr_u64((x), 61) ^ ((x) >> 6))

Definition at line 332 of file sha512.c.

Function Documentation

◆ SHA384()

uint8_t* SHA384 ( const uint8_t data,
size_t  len,
uint8_t  out[SHA384_DIGEST_LENGTH] 
)

Definition at line 127 of file sha512.c.

◆ SHA384_Final()

int SHA384_Final ( uint8_t  out[SHA384_DIGEST_LENGTH],
SHA512_CTX sha 
)

Definition at line 163 of file sha512.c.

◆ SHA384_Init()

int SHA384_Init ( SHA512_CTX sha)

Definition at line 75 of file sha512.c.

◆ SHA384_Update()

int SHA384_Update ( SHA512_CTX sha,
const void *  data,
size_t  len 
)

Definition at line 170 of file sha512.c.

◆ SHA512()

uint8_t* SHA512 ( const uint8_t data,
size_t  len,
uint8_t  out[SHA512_DIGEST_LENGTH] 
)

Definition at line 137 of file sha512.c.

◆ SHA512_256()

uint8_t* SHA512_256 ( const uint8_t data,
size_t  len,
uint8_t  out[SHA512_256_DIGEST_LENGTH] 
)

Definition at line 147 of file sha512.c.

◆ SHA512_256_Final()

int SHA512_256_Final ( uint8_t  out[SHA512_256_DIGEST_LENGTH],
SHA512_CTX sha 
)

Definition at line 178 of file sha512.c.

◆ SHA512_256_Init()

int SHA512_256_Init ( SHA512_CTX sha)

Definition at line 110 of file sha512.c.

◆ SHA512_256_Update()

int SHA512_256_Update ( SHA512_CTX sha,
const void *  data,
size_t  len 
)

Definition at line 174 of file sha512.c.

◆ sha512_block_data_order()

static void sha512_block_data_order ( uint64_t state,
const uint8_t in,
size_t  num_blocks 
)
static

Definition at line 415 of file sha512.c.

◆ SHA512_Final()

int SHA512_Final ( uint8_t  out[SHA512_DIGEST_LENGTH],
SHA512_CTX sha 
)

Definition at line 237 of file sha512.c.

◆ sha512_final_impl()

static int sha512_final_impl ( uint8_t out,
SHA512_CTX sha 
)
static

Definition at line 246 of file sha512.c.

◆ SHA512_Init()

int SHA512_Init ( SHA512_CTX sha)

Definition at line 93 of file sha512.c.

◆ SHA512_Transform()

void SHA512_Transform ( SHA512_CTX c,
const uint8_t  block[SHA512_CBLOCK] 
)

Definition at line 185 of file sha512.c.

◆ SHA512_Update()

int SHA512_Update ( SHA512_CTX c,
const void *  in_data,
size_t  len 
)

Definition at line 189 of file sha512.c.

Variable Documentation

◆ K512

const uint64_t K512[80]
static

Definition at line 281 of file sha512.c.

absl::str_format_internal::LengthMod::j
@ j
X
#define X(c)
Sigma0
#define Sigma0(x)
Definition: sha512.c:324
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
Maj
#define Maj(x, y, z)
Definition: sha512.c:336
re2::T1
@ T1
Definition: bloaty/third_party/re2/util/rune.cc:31
K512
static const uint64_t K512[80]
Definition: sha512.c:281
c
void c(T a)
Definition: miscompile_with_no_unique_address_test.cc:40
autogen_x86imm.f
f
Definition: autogen_x86imm.py:9
x
int x
Definition: bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3610
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
Sigma1
#define Sigma1(x)
Definition: sha512.c:327
g
struct @717 g
d
static const fe d
Definition: curve25519_tables.h:19
sigma1
#define sigma1(x)
Definition: sha512.c:332
Ch
#define Ch(x, y, z)
Definition: sha512.c:335
CRYPTO_rotr_u64
static uint64_t CRYPTO_rotr_u64(uint64_t value, int shift)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:923
absl::str_format_internal::LengthMod::h
@ h
sigma0
#define sigma0(x)
Definition: sha512.c:330
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:31