RTEMS 6.3
Loading...
Searching...
No Matches
sha512c.c File Reference

This source file contains the implemention of the SHA512 hash algorithm and variants. More...

#include <sys/cdefs.h>
#include <sys/endian.h>
#include <sys/types.h>
#include <string.h>
#include "sha512.h"
#include "sha512t.h"
#include "sha384.h"

Macros

#define be64enc_vect(dst, src, len)
#define be64dec_vect(dst, src, len)
#define Ch(x, y, z)
#define Maj(x, y, z)
#define SHR(x, n)
#define ROTR(x, n)
#define S0(x)
#define S1(x)
#define s0(x)
#define s1(x)
#define RND(a, b, c, d, e, f, g, h, k)
#define RNDr(S, W, i, ii)
#define MSCH(W, ii, i)

Functions

 __FBSDID ("$FreeBSD$")
void SHA512_Init (SHA512_CTX *ctx)
void SHA512_Update (SHA512_CTX *ctx, const void *in, size_t len)
void SHA512_Final (unsigned char digest[static SHA512_DIGEST_LENGTH], SHA512_CTX *ctx)
void SHA512_224_Init (SHA512_CTX *ctx)
void SHA512_224_Update (SHA512_CTX *ctx, const void *in, size_t len)
void SHA512_224_Final (unsigned char digest[static SHA512_224_DIGEST_LENGTH], SHA512_CTX *ctx)
void SHA512_256_Init (SHA512_CTX *ctx)
void SHA512_256_Update (SHA512_CTX *ctx, const void *in, size_t len)
void SHA512_256_Final (unsigned char digest[static SHA512_256_DIGEST_LENGTH], SHA512_CTX *ctx)
void SHA384_Init (SHA384_CTX *ctx)
void SHA384_Update (SHA384_CTX *ctx, const void *in, size_t len)
void SHA384_Final (unsigned char digest[static SHA384_DIGEST_LENGTH], SHA384_CTX *ctx)

Detailed Description

This source file contains the implemention of the SHA512 hash algorithm and variants.

Macro Definition Documentation

◆ be64dec_vect

#define be64dec_vect ( dst,
src,
len )
Value:
memcpy((void *)dst, (const void *)src, (size_t)len)

◆ be64enc_vect

#define be64enc_vect ( dst,
src,
len )
Value:
memcpy((void *)dst, (const void *)src, (size_t)len)

◆ Ch

#define Ch ( x,
y,
z )
Value:
((x & (y ^ z)) ^ z)

◆ Maj

#define Maj ( x,
y,
z )
Value:
((x & (y | z)) | (y & z))

◆ MSCH

#define MSCH ( W,
ii,
i )
Value:
W[i + ii + 16] = s1(W[i + ii + 14]) + W[i + ii + 9] + s0(W[i + ii + 1]) + W[i + ii]

◆ RND

#define RND ( a,
b,
c,
d,
e,
f,
g,
h,
k )
Value:
h += S1(e) + Ch(e, f, g) + k; \
d += h; \
h += S0(a) + Maj(a, b, c);
unsigned e
Definition tlb.h:13

◆ RNDr

#define RNDr ( S,
W,
i,
ii )
Value:
RND(S[(80 - i) % 8], S[(81 - i) % 8], \
S[(82 - i) % 8], S[(83 - i) % 8], \
S[(84 - i) % 8], S[(85 - i) % 8], \
S[(86 - i) % 8], S[(87 - i) % 8], \
W[i + ii] + K[i + ii])

◆ ROTR

#define ROTR ( x,
n )
Value:
((x >> n) | (x << (64 - n)))

◆ S0

#define S0 ( x)
Value:
(ROTR(x, 28) ^ ROTR(x, 34) ^ ROTR(x, 39))

◆ s0

#define s0 ( x)
Value:
(ROTR(x, 1) ^ ROTR(x, 8) ^ SHR(x, 7))

◆ S1

#define S1 ( x)
Value:
(ROTR(x, 14) ^ ROTR(x, 18) ^ ROTR(x, 41))

◆ s1

#define s1 ( x)
Value:
(ROTR(x, 19) ^ ROTR(x, 61) ^ SHR(x, 6))

◆ SHR

#define SHR ( x,
n )
Value:
(x >> n)