Network Services

Dependents:   PwrCond_mbed5

Fork of W5500Interface_K22F by Andrew McCartney

Committer:
dgriffin65
Date:
Thu Jun 15 20:29:03 2017 +0000
Revision:
15:14382459c8b7
Converted to a single library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dgriffin65 15:14382459c8b7 1 /*
dgriffin65 15:14382459c8b7 2 * source from http://www.ipa.go.jp/security/rfc/RFC3174JA.html
dgriffin65 15:14382459c8b7 3 */
dgriffin65 15:14382459c8b7 4 /*
dgriffin65 15:14382459c8b7 5 * sha1.h
dgriffin65 15:14382459c8b7 6 *
dgriffin65 15:14382459c8b7 7 * Description:
dgriffin65 15:14382459c8b7 8 * This is the header file for code which implements the Secure
dgriffin65 15:14382459c8b7 9 * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
dgriffin65 15:14382459c8b7 10 * April 17, 1995.
dgriffin65 15:14382459c8b7 11 *
dgriffin65 15:14382459c8b7 12 * Many of the variable names in this code, especially the
dgriffin65 15:14382459c8b7 13 * single character names, were used because those were the names
dgriffin65 15:14382459c8b7 14 * used in the publication.
dgriffin65 15:14382459c8b7 15 *
dgriffin65 15:14382459c8b7 16 * Please read the file sha1.c for more information.
dgriffin65 15:14382459c8b7 17 *
dgriffin65 15:14382459c8b7 18 */
dgriffin65 15:14382459c8b7 19
dgriffin65 15:14382459c8b7 20 #ifndef _SHA1_H_
dgriffin65 15:14382459c8b7 21 #define _SHA1_H_
dgriffin65 15:14382459c8b7 22
dgriffin65 15:14382459c8b7 23 #include "mbed.h"
dgriffin65 15:14382459c8b7 24 /*
dgriffin65 15:14382459c8b7 25 * If you do not have the ISO standard stdint.h header file, then you
dgriffin65 15:14382459c8b7 26 * must typdef the following:
dgriffin65 15:14382459c8b7 27 * name meaning
dgriffin65 15:14382459c8b7 28 * uint32_t unsigned 32 bit integer
dgriffin65 15:14382459c8b7 29 * uint8_t unsigned 8 bit integer (i.e., unsigned char)
dgriffin65 15:14382459c8b7 30 * int_least16_t integer of >= 16 bits
dgriffin65 15:14382459c8b7 31 *
dgriffin65 15:14382459c8b7 32 */
dgriffin65 15:14382459c8b7 33
dgriffin65 15:14382459c8b7 34 #ifndef _SHA_enum_
dgriffin65 15:14382459c8b7 35 #define _SHA_enum_
dgriffin65 15:14382459c8b7 36 enum
dgriffin65 15:14382459c8b7 37 {
dgriffin65 15:14382459c8b7 38 shaSuccess = 0,
dgriffin65 15:14382459c8b7 39 shaNull, /* Null pointer parameter */
dgriffin65 15:14382459c8b7 40 shaInputTooLong, /* input data too long */
dgriffin65 15:14382459c8b7 41 shaStateError /* called Input after Result */
dgriffin65 15:14382459c8b7 42 };
dgriffin65 15:14382459c8b7 43 #endif
dgriffin65 15:14382459c8b7 44 #define SHA1HashSize 20
dgriffin65 15:14382459c8b7 45
dgriffin65 15:14382459c8b7 46 /*
dgriffin65 15:14382459c8b7 47 * This structure will hold context information for the SHA-1
dgriffin65 15:14382459c8b7 48 * hashing operation
dgriffin65 15:14382459c8b7 49 */
dgriffin65 15:14382459c8b7 50 typedef struct SHA1Context
dgriffin65 15:14382459c8b7 51 {
dgriffin65 15:14382459c8b7 52 uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */
dgriffin65 15:14382459c8b7 53
dgriffin65 15:14382459c8b7 54 uint32_t Length_Low; /* Message length in bits */
dgriffin65 15:14382459c8b7 55 uint32_t Length_High; /* Message length in bits */
dgriffin65 15:14382459c8b7 56
dgriffin65 15:14382459c8b7 57 /* Index into message block array */
dgriffin65 15:14382459c8b7 58 int_least16_t Message_Block_Index;
dgriffin65 15:14382459c8b7 59 uint8_t Message_Block[64]; /* 512-bit message blocks */
dgriffin65 15:14382459c8b7 60
dgriffin65 15:14382459c8b7 61 int Computed; /* Is the digest computed? */
dgriffin65 15:14382459c8b7 62 int Corrupted; /* Is the message digest corrupted? */
dgriffin65 15:14382459c8b7 63 } SHA1Context;
dgriffin65 15:14382459c8b7 64
dgriffin65 15:14382459c8b7 65 /*
dgriffin65 15:14382459c8b7 66 * Function Prototypes
dgriffin65 15:14382459c8b7 67 */
dgriffin65 15:14382459c8b7 68
dgriffin65 15:14382459c8b7 69 int SHA1Reset( SHA1Context *);
dgriffin65 15:14382459c8b7 70 int SHA1Input( SHA1Context *,
dgriffin65 15:14382459c8b7 71 const uint8_t *,
dgriffin65 15:14382459c8b7 72 unsigned int);
dgriffin65 15:14382459c8b7 73 int SHA1Result( SHA1Context *,
dgriffin65 15:14382459c8b7 74 uint8_t Message_Digest[SHA1HashSize]);
dgriffin65 15:14382459c8b7 75
dgriffin65 15:14382459c8b7 76
dgriffin65 15:14382459c8b7 77 void sha1 (const char *input, int len, char *output);
dgriffin65 15:14382459c8b7 78 #endif