2000-05-20 01:55:34 +08:00
|
|
|
/* --------------------------------- SHS.H ------------------------------- */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* NIST proposed Secure Hash Standard.
|
|
|
|
*
|
|
|
|
* Written 2 September 1992, Peter C. Gutmann.
|
|
|
|
* This implementation placed in the public domain.
|
|
|
|
*
|
|
|
|
* Comments to pgut1@cs.aukuni.ac.nz
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Useful defines/typedefs */
|
|
|
|
|
|
|
|
#ifndef SHS_H
|
|
|
|
#define SHS_H
|
|
|
|
|
2002-02-07 13:01:29 +08:00
|
|
|
#include<config.h>
|
|
|
|
#if HAVE_INTTYPES_H
|
|
|
|
# include <inttypes.h>
|
|
|
|
#else
|
|
|
|
# if HAVE_STDINT_H
|
|
|
|
# include <stdint.h>
|
|
|
|
# endif
|
|
|
|
#endif
|
2000-05-20 01:55:34 +08:00
|
|
|
|
|
|
|
/* The SHS block size and message digest sizes, in bytes */
|
|
|
|
|
|
|
|
#define SHS_BLOCKSIZE 64
|
|
|
|
#define SHS_DIGESTSIZE 20
|
|
|
|
|
|
|
|
/* The structure for storing SHS info */
|
|
|
|
|
|
|
|
typedef struct {
|
2002-02-07 13:01:29 +08:00
|
|
|
uint32_t digest [5]; /* Message digest */
|
|
|
|
uint32_t countLo, countHi; /* 64-bit bit count */
|
|
|
|
uint32_t data [16]; /* SHS data buffer */
|
2000-05-20 01:55:34 +08:00
|
|
|
} SHS_INFO;
|
|
|
|
|
|
|
|
/* Turn off prototypes if requested */
|
|
|
|
#if (defined(NOPROTO) && defined(PROTO))
|
|
|
|
# undef PROTO
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Used to remove arguments in function prototypes for non-ANSI C */
|
|
|
|
#ifdef PROTO
|
|
|
|
# define OF(a) a
|
|
|
|
#else /* !PROTO */
|
|
|
|
# define OF(a) ()
|
|
|
|
#endif /* ?PROTO */
|
|
|
|
|
|
|
|
#define local static
|
|
|
|
|
|
|
|
void shsInit OF((SHS_INFO *shsInfo));
|
2002-02-07 13:01:29 +08:00
|
|
|
void shsUpdate OF((SHS_INFO *shsInfo, uint8_t *buffer, int count));
|
2000-05-20 01:55:34 +08:00
|
|
|
void shsFinal OF((SHS_INFO *shsInfo));
|
|
|
|
|
|
|
|
#endif
|