OpenSSL  1.0.1c
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Macros | Functions | Variables
sha512.c File Reference
#include <openssl/opensslconf.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/crypto.h>
#include <openssl/sha.h>
#include <openssl/opensslv.h>
#include "cryptlib.h"

Go to the source code of this file.

Macros

#define B(x, j)   (((SHA_LONG64)(*(((const unsigned char *)(&x))+j)))<<((7-j)*8))
 
#define PULL64(x)   (B(x,0)|B(x,1)|B(x,2)|B(x,3)|B(x,4)|B(x,5)|B(x,6)|B(x,7))
 
#define ROTR(x, s)   (((x)>>s) | (x)<<(64-s))
 
#define Sigma0(x)   (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39))
 
#define Sigma1(x)   (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41))
 
#define sigma0(x)   (ROTR((x),1) ^ ROTR((x),8) ^ ((x)>>7))
 
#define sigma1(x)   (ROTR((x),19) ^ ROTR((x),61) ^ ((x)>>6))
 
#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)
 

Functions

 fips_md_init_ctx (SHA384, SHA512)
 
 fips_md_init (SHA512)
 
int SHA512_Final (unsigned char *md, SHA512_CTX *c)
 
int SHA384_Final (unsigned char *md, SHA512_CTX *c)
 
int SHA512_Update (SHA512_CTX *c, const void *_data, size_t len)
 
int SHA384_Update (SHA512_CTX *c, const void *data, size_t len)
 
void SHA512_Transform (SHA512_CTX *c, const unsigned char *data)
 
unsigned char * SHA384 (const unsigned char *d, size_t n, unsigned char *md)
 
unsigned char * SHA512 (const unsigned char *d, size_t n, unsigned char *md)
 

Variables

const char SHA512_version [] ="SHA-512" OPENSSL_VERSION_PTEXT
 

Macro Definition Documentation

#define B (   x,
 
)    (((SHA_LONG64)(*(((const unsigned char *)(&x))+j)))<<((7-j)*8))

Definition at line 378 of file sha512.c.

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

Definition at line 391 of file sha512.c.

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

Definition at line 392 of file sha512.c.

#define PULL64 (   x)    (B(x,0)|B(x,1)|B(x,2)|B(x,3)|B(x,4)|B(x,5)|B(x,6)|B(x,7))

Definition at line 379 of file sha512.c.

#define ROTR (   x,
 
)    (((x)>>s) | (x)<<(64-s))

Definition at line 383 of file sha512.c.

#define ROUND_00_15 (   i,
  a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)
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 501 of file sha512.c.

#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 506 of file sha512.c.

#define Sigma0 (   x)    (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39))

Definition at line 386 of file sha512.c.

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

Definition at line 388 of file sha512.c.

#define Sigma1 (   x)    (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41))

Definition at line 387 of file sha512.c.

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

Definition at line 389 of file sha512.c.

Function Documentation

fips_md_init ( SHA512  )

Definition at line 78 of file sha512.c.

fips_md_init_ctx ( SHA384  ,
SHA512   
)

Definition at line 62 of file sha512.c.

unsigned char* SHA384 ( const unsigned char *  d,
size_t  n,
unsigned char *  md 
)

Definition at line 237 of file sha512.c.

int SHA384_Final ( unsigned char *  md,
SHA512_CTX c 
)

Definition at line 177 of file sha512.c.

int SHA384_Update ( SHA512_CTX c,
const void data,
size_t  len 
)

Definition at line 231 of file sha512.c.

unsigned char* SHA512 ( const unsigned char *  d,
size_t  n,
unsigned char *  md 
)

Definition at line 250 of file sha512.c.

int SHA512_Final ( unsigned char *  md,
SHA512_CTX c 
)

Definition at line 99 of file sha512.c.

void SHA512_Transform ( SHA512_CTX c,
const unsigned char *  data 
)

Definition at line 234 of file sha512.c.

int SHA512_Update ( SHA512_CTX c,
const void _data,
size_t  len 
)

Definition at line 180 of file sha512.c.

Variable Documentation

const char SHA512_version[] ="SHA-512" OPENSSL_VERSION_PTEXT

Definition at line 53 of file sha512.c.