RTEMS 6.1-rc1
Macros | Functions
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)    memcpy((void *)dst, (const void *)src, (size_t)len)
 
#define be64dec_vect(dst, src, len)    memcpy((void *)dst, (const void *)src, (size_t)len)
 
#define Ch(x, y, z)   ((x & (y ^ z)) ^ z)
 
#define Maj(x, y, z)   ((x & (y | z)) | (y & z))
 
#define SHR(x, n)   (x >> n)
 
#define ROTR(x, n)   ((x >> n) | (x << (64 - n)))
 
#define S0(x)   (ROTR(x, 28) ^ ROTR(x, 34) ^ ROTR(x, 39))
 
#define S1(x)   (ROTR(x, 14) ^ ROTR(x, 18) ^ ROTR(x, 41))
 
#define s0(x)   (ROTR(x, 1) ^ ROTR(x, 8) ^ SHR(x, 7))
 
#define s1(x)   (ROTR(x, 19) ^ ROTR(x, 61) ^ SHR(x, 6))
 
#define RND(a, b, c, d, e, f, g, h, k)
 
#define RNDr(S, W, i, ii)
 
#define MSCH(W, ii, i)    W[i + ii + 16] = s1(W[i + ii + 14]) + W[i + ii + 9] + s0(W[i + ii + 1]) + W[i + ii]
 

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

◆ RND

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

◆ 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])