| 1 | /*
|
|---|
| 2 | * sha1.h
|
|---|
| 3 | *
|
|---|
| 4 | * Description:
|
|---|
| 5 | * This is the header file for code which implements the Secure
|
|---|
| 6 | * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
|
|---|
| 7 | * April 17, 1995.
|
|---|
| 8 | *
|
|---|
| 9 | * Many of the variable names in this code, especially the
|
|---|
| 10 | * single character names, were used because those were the names
|
|---|
| 11 | * used in the publication.
|
|---|
| 12 | *
|
|---|
| 13 | * Please read the file sha1.c for more information.
|
|---|
| 14 | *
|
|---|
| 15 | */
|
|---|
| 16 |
|
|---|
| 17 | #ifndef _SHA1_H_
|
|---|
| 18 | #define _SHA1_H_
|
|---|
| 19 |
|
|---|
| 20 | #include <stdint.h>
|
|---|
| 21 |
|
|---|
| 22 | #ifndef _SHA_enum_
|
|---|
| 23 | #define _SHA_enum_
|
|---|
| 24 | enum
|
|---|
| 25 | {
|
|---|
| 26 | shaSuccess = 0,
|
|---|
| 27 | shaNull, /* Null pointer parameter */
|
|---|
| 28 | shaInputTooLong, /* input data too long */
|
|---|
| 29 | shaStateError /* called Input after Result */
|
|---|
| 30 | };
|
|---|
| 31 | #endif
|
|---|
| 32 | #define SHA1HashSize 20
|
|---|
| 33 |
|
|---|
| 34 | /*
|
|---|
| 35 | * This structure will hold context information for the SHA-1
|
|---|
| 36 | * hashing operation
|
|---|
| 37 | */
|
|---|
| 38 | typedef struct SHA1Context
|
|---|
| 39 | {
|
|---|
| 40 | uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */
|
|---|
| 41 |
|
|---|
| 42 | uint32_t Length_Low; /* Message length in bits */
|
|---|
| 43 | uint32_t Length_High; /* Message length in bits */
|
|---|
| 44 |
|
|---|
| 45 | /* Index into message block array */
|
|---|
| 46 | int_least16_t Message_Block_Index;
|
|---|
| 47 | uint8_t Message_Block[64]; /* 512-bit message blocks */
|
|---|
| 48 |
|
|---|
| 49 | int Computed; /* Is the digest computed? */
|
|---|
| 50 | int Corrupted; /* Is the message digest corrupted? */
|
|---|
| 51 | } SHA1Context;
|
|---|
| 52 |
|
|---|
| 53 | /*
|
|---|
| 54 | * Function Prototypes
|
|---|
| 55 | */
|
|---|
| 56 |
|
|---|
| 57 | int SHA1Reset( SHA1Context *);
|
|---|
| 58 | int SHA1Input( SHA1Context *,
|
|---|
| 59 | const uint8_t *,
|
|---|
| 60 | unsigned int);
|
|---|
| 61 | int SHA1Result( SHA1Context *,
|
|---|
| 62 | uint8_t Message_Digest[SHA1HashSize]);
|
|---|
| 63 |
|
|---|
| 64 | #endif
|
|---|