libmoost
/home/mhx/git/github/libmoost/src/digest/rfc6234/sha224-256.c File Reference
#include "sha.h"
#include "sha-private.h"
Include dependency graph for sha224-256.c:

Go to the source code of this file.

Defines

#define SHA256_SHR(bits, word)   ((word) >> (bits))
#define SHA256_ROTL(bits, word)   (((word) << (bits)) | ((word) >> (32-(bits))))
#define SHA256_ROTR(bits, word)   (((word) >> (bits)) | ((word) << (32-(bits))))
#define SHA256_SIGMA0(word)   (SHA256_ROTR( 2,word) ^ SHA256_ROTR(13,word) ^ SHA256_ROTR(22,word))
#define SHA256_SIGMA1(word)   (SHA256_ROTR( 6,word) ^ SHA256_ROTR(11,word) ^ SHA256_ROTR(25,word))
#define SHA256_sigma0(word)   (SHA256_ROTR( 7,word) ^ SHA256_ROTR(18,word) ^ SHA256_SHR( 3,word))
#define SHA256_sigma1(word)   (SHA256_ROTR(17,word) ^ SHA256_ROTR(19,word) ^ SHA256_SHR(10,word))
#define SHA224_256AddLength(context, length)

Functions

static int SHA224_256Reset (SHA256Context *context, uint32_t *H0)
static void SHA224_256ProcessMessageBlock (SHA256Context *context)
static void SHA224_256Finalize (SHA256Context *context, uint8_t Pad_Byte)
static void SHA224_256PadMessage (SHA256Context *context, uint8_t Pad_Byte)
static int SHA224_256ResultN (SHA256Context *context, uint8_t Message_Digest[], int HashSize)
int SHA224Reset (SHA224Context *context)
int SHA224Input (SHA224Context *context, const uint8_t *message_array, unsigned int length)
int SHA224FinalBits (SHA224Context *context, uint8_t message_bits, unsigned int length)
int SHA224Result (SHA224Context *context, uint8_t Message_Digest[SHA224HashSize])
int SHA256Reset (SHA256Context *context)
int SHA256Input (SHA256Context *context, const uint8_t *message_array, unsigned int length)
int SHA256FinalBits (SHA256Context *context, uint8_t message_bits, unsigned int length)
int SHA256Result (SHA256Context *context, uint8_t Message_Digest[SHA256HashSize])

Variables

static uint32_t addTemp
static uint32_t SHA224_H0 [SHA256HashSize/4]
static uint32_t SHA256_H0 [SHA256HashSize/4]

Define Documentation

#define SHA224_256AddLength (   context,
  length 
)
Value:
(addTemp = (context)->Length_Low, (context)->Corrupted = \
    (((context)->Length_Low += (length)) < addTemp) &&     \
    (++(context)->Length_High == 0) ? shaInputTooLong :    \
                                      (context)->Corrupted )

Definition at line 68 of file sha224-256.c.

#define SHA256_ROTL (   bits,
  word 
)    (((word) << (bits)) | ((word) >> (32-(bits))))

Definition at line 48 of file sha224-256.c.

#define SHA256_ROTR (   bits,
  word 
)    (((word) >> (bits)) | ((word) << (32-(bits))))

Definition at line 50 of file sha224-256.c.

#define SHA256_SHR (   bits,
  word 
)    ((word) >> (bits))

Definition at line 47 of file sha224-256.c.

#define SHA256_SIGMA0 (   word)    (SHA256_ROTR( 2,word) ^ SHA256_ROTR(13,word) ^ SHA256_ROTR(22,word))

Definition at line 54 of file sha224-256.c.

#define SHA256_sigma0 (   word)    (SHA256_ROTR( 7,word) ^ SHA256_ROTR(18,word) ^ SHA256_SHR( 3,word))

Definition at line 58 of file sha224-256.c.

#define SHA256_SIGMA1 (   word)    (SHA256_ROTR( 6,word) ^ SHA256_ROTR(11,word) ^ SHA256_ROTR(25,word))

Definition at line 56 of file sha224-256.c.

#define SHA256_sigma1 (   word)    (SHA256_ROTR(17,word) ^ SHA256_ROTR(19,word) ^ SHA256_SHR(10,word))

Definition at line 60 of file sha224-256.c.


Function Documentation

static void SHA224_256Finalize ( SHA256Context context,
uint8_t  Pad_Byte 
) [static]

Definition at line 471 of file sha224-256.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void SHA224_256PadMessage ( SHA256Context context,
uint8_t  Pad_Byte 
) [static]

Definition at line 508 of file sha224-256.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void SHA224_256ProcessMessageBlock ( SHA256Context context) [static]

Definition at line 383 of file sha224-256.c.

Here is the caller graph for this function:

static int SHA224_256Reset ( SHA256Context context,
uint32_t *  H0 
) [static]

Definition at line 342 of file sha224-256.c.

Here is the caller graph for this function:

static int SHA224_256ResultN ( SHA256Context context,
uint8_t  Message_Digest[],
int  HashSize 
) [static]

Definition at line 564 of file sha224-256.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int SHA224FinalBits ( SHA224Context context,
uint8_t  message_bits,
unsigned int  length 
)

Definition at line 160 of file sha224-256.c.

Here is the call graph for this function:

int SHA224Input ( SHA224Context context,
const uint8_t *  message_array,
unsigned int  length 
)

Definition at line 135 of file sha224-256.c.

Here is the call graph for this function:

int SHA224Reset ( SHA224Context context)

Definition at line 110 of file sha224-256.c.

Here is the call graph for this function:

int SHA224Result ( SHA224Context context,
uint8_t  Message_Digest[SHA224HashSize] 
)

Definition at line 185 of file sha224-256.c.

Here is the call graph for this function:

int SHA256FinalBits ( SHA256Context context,
uint8_t  message_bits,
unsigned int  length 
)

Definition at line 272 of file sha224-256.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int SHA256Input ( SHA256Context context,
const uint8_t *  message_array,
unsigned int  length 
)

Definition at line 229 of file sha224-256.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int SHA256Reset ( SHA256Context context)

Definition at line 205 of file sha224-256.c.

Here is the call graph for this function:

int SHA256Result ( SHA256Context context,
uint8_t  Message_Digest[SHA256HashSize] 
)

Definition at line 320 of file sha224-256.c.

Here is the call graph for this function:


Variable Documentation

uint32_t addTemp [static]

Definition at line 67 of file sha224-256.c.

uint32_t SHA224_H0[SHA256HashSize/4] [static]
Initial value:
 {
    0xC1059ED8, 0x367CD507, 0x3070DD17, 0xF70E5939,
    0xFFC00B31, 0x68581511, 0x64F98FA7, 0xBEFA4FA4
}

Definition at line 85 of file sha224-256.c.

uint32_t SHA256_H0[SHA256HashSize/4] [static]
Initial value:
 {
  0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A,
  0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19
}

Definition at line 91 of file sha224-256.c.