TSP: The Transport Sample Protocol



Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

bb_sha1.h

00001 /*
00002  * This code has been taken from RFC 3174 on 
00003  * http://ww.rfc-editors.org/
00004  * File has been renamed to bb_sha1.[hc] to avoid name clash.
00005  * 
00006  *  sha1.h
00007  *
00008  *  Description:
00009  *      This is the header file for code which implements the Secure
00010  *      Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
00011  *      April 17, 1995.
00012  *
00013  *      Many of the variable names in this code, especially the
00014  *      single character names, were used because those were the names
00015  *      used in the publication.
00016  *
00017  *      Please read the file sha1.c for more information.
00018  *
00019  */
00020 #ifndef _SHA1_H_
00021 #define _SHA1_H_
00022 
00023 #include "tsp_abs_types.h"
00024 /*
00025  * If you do not have the ISO standard stdint.h header file, then you
00026  * must typdef the following:
00027  *    name              meaning
00028  *  uint32_t         unsigned 32 bit integer
00029  *  uint8_t          unsigned 8 bit integer (i.e., unsigned char)
00030  *  int_least16_t    integer of >= 16 bits
00031  *
00032  */
00033 
00034 #ifndef _SHA_enum_
00035 #define _SHA_enum_
00036 enum
00037 {
00038     shaSuccess = 0,
00039     shaNull,            /* Null pointer parameter */
00040     shaInputTooLong,    /* input data too long */
00041     shaStateError       /* called Input after Result */
00042 };
00043 #endif
00044 #define SHA1HashSize 20
00045 
00046 /*
00047  *  This structure will hold context information for the SHA-1
00048  *  hashing operation
00049  */
00050 typedef struct SHA1Context
00051 {
00052     uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest  */
00053 
00054     uint32_t Length_Low;            /* Message length in bits      */
00055     uint32_t Length_High;           /* Message length in bits      */
00056 
00057                                /* Index into message block array   */
00058     int_least16_t Message_Block_Index;
00059     uint8_t Message_Block[64];      /* 512-bit message blocks      */
00060 
00061     int Computed;               /* Is the digest computed?         */
00062     int Corrupted;             /* Is the message digest corrupted? */
00063 } SHA1Context;
00064 
00065 /*
00066  *  Function Prototypes
00067  */
00068 
00069 int SHA1Reset(  SHA1Context *);
00070 int SHA1Input(  SHA1Context *,
00071                 const uint8_t *,
00072                 unsigned int);
00073 int SHA1Result( SHA1Context *,
00074                 uint8_t Message_Digest[SHA1HashSize]);
00075 
00076 #endif
Framework Home Page.

Beware !! TSP wave is coming...