tin  2.4.5
About: TIN is a threaded NNTP and spool based UseNet newsreader.
  Fossies Dox: tin-2.4.5.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

sha224-256.c File Reference
#include "canlock-private.h"
#include "sha.h"
#include "sha-private.h"
Include dependency graph for sha224-256.c:

Go to the source code of this file.

Macros

#define SHA256_SHR(bits, word)   ((word) >> (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]
 

Macro Definition Documentation

◆ SHA224_256AddLength

#define SHA224_256AddLength (   context,
  length 
)
Value:
(addTemp = (context)->Length_Low, (context)->Corrupted = \
(((context)->Length_Low += (length)) < addTemp) && \
(++(context)->Length_High == 0) ? shaInputTooLong : \
(context)->Corrupted )
static uint32_t addTemp
Definition: sha224-256.c:70
@ shaInputTooLong
Definition: sha.h:94
context
Definition: tin.h:107

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

◆ SHA256_ROTR

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

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

◆ SHA256_SHR

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

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

◆ SHA256_SIGMA0

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

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

◆ SHA256_sigma0

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

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

◆ SHA256_SIGMA1

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

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

◆ SHA256_sigma1

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

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

Function Documentation

◆ SHA224_256Finalize()

static void SHA224_256Finalize ( SHA256Context context,
uint8_t  Pad_Byte 
)
static

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

References SHA224_256PadMessage(), and SHA256_Message_Block_Size.

Referenced by SHA224_256ResultN(), and SHA256FinalBits().

◆ SHA224_256PadMessage()

static void SHA224_256PadMessage ( SHA256Context context,
uint8_t  Pad_Byte 
)
static

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

References SHA224_256ProcessMessageBlock(), and SHA256_Message_Block_Size.

Referenced by SHA224_256Finalize().

◆ SHA224_256ProcessMessageBlock()

static void SHA224_256ProcessMessageBlock ( SHA256Context context)
static

◆ SHA224_256Reset()

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

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

References shaNull, and shaSuccess.

Referenced by SHA224Reset(), and SHA256Reset().

◆ SHA224_256ResultN()

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

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

References SHA224_256Finalize(), shaNull, and shaSuccess.

Referenced by SHA224Result(), and SHA256Result().

◆ SHA224FinalBits()

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

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

References SHA256FinalBits().

Referenced by USHAFinalBits().

◆ SHA224Input()

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

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

References SHA256Input().

Referenced by USHAInput().

◆ SHA224Reset()

int SHA224Reset ( SHA224Context context)

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

References SHA224_256Reset(), and SHA224_H0.

Referenced by USHAReset().

◆ SHA224Result()

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

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

References SHA224_256ResultN(), and SHA224HashSize.

Referenced by USHAResult().

◆ SHA256FinalBits()

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

◆ SHA256Input()

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

◆ SHA256Reset()

int SHA256Reset ( SHA256Context context)

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

References SHA224_256Reset(), and SHA256_H0.

Referenced by USHAReset().

◆ SHA256Result()

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

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

References SHA224_256ResultN(), and SHA256HashSize.

Referenced by USHAResult().

Variable Documentation

◆ addTemp

uint32_t addTemp
static

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

◆ SHA224_H0

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

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

Referenced by SHA224Reset().

◆ SHA256_H0

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

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

Referenced by SHA256Reset().