RTEMS 6.3
Loading...
Searching...
No Matches
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)
#define be32dec_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 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

◆ be32dec_vect

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

◆ be32enc_vect

#define be32enc_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[(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])

◆ ROTR

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

◆ S0

#define S0 ( x)
Value:
(ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))

◆ s0

#define s0 ( x)
Value:
(ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3))

◆ S1

#define S1 ( x)
Value:
(ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))

◆ s1

#define s1 ( x)
Value:
(ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10))

◆ SHR

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