RTEMS 6.1-rc1
Macros | Functions
sha256c.c File Reference

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

#include <sys/cdefs.h>
#include <sys/endian.h>
#include <sys/types.h>
#include <string.h>
#include "sha224.h"
#include "sha256.h"

Macros

#define be32enc_vect(dst, src, len)    memcpy((void *)dst, (const void *)src, (size_t)len)
 
#define be32dec_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 << (32 - n)))
 
#define S0(x)   (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
 
#define S1(x)   (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
 
#define s0(x)   (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3))
 
#define s1(x)   (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10))
 
#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 SHA256_Init (SHA256_CTX *ctx)
 
void SHA256_Update (SHA256_CTX *ctx, const void *in, size_t len)
 
void SHA256_Final (unsigned char digest[static SHA256_DIGEST_LENGTH], SHA256_CTX *ctx)
 
void SHA224_Init (SHA224_CTX *ctx)
 
void SHA224_Update (SHA224_CTX *ctx, const void *in, size_t len)
 
void SHA224_Final (unsigned char digest[static SHA224_DIGEST_LENGTH], SHA224_CTX *ctx)
 

Detailed Description

This source file contains the implemention of the SHA256 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[(64 - i) % 8], S[(65 - i) % 8], \
S[(66 - i) % 8], S[(67 - i) % 8], \
S[(68 - i) % 8], S[(69 - i) % 8], \
S[(70 - i) % 8], S[(71 - i) % 8], \
W[i + ii] + K[i + ii])