diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2009-02-04 21:09:06 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2009-02-04 21:09:06 +0000 |
commit | 03f3002a176fc48753686a9c5fa8216de176e3ab (patch) | |
tree | 36819c73433a29bc1294debc6a571bf41c40ba87 /tools/firmware-utils/src/sha1.h | |
parent | 1adabd363c7c312db63e1753e4a0e6b2b5c0de1a (diff) | |
download | upstream-03f3002a176fc48753686a9c5fa8216de176e3ab.tar.gz upstream-03f3002a176fc48753686a9c5fa8216de176e3ab.tar.bz2 upstream-03f3002a176fc48753686a9c5fa8216de176e3ab.zip |
firmware-utils/mkplanexfw: new firmware generation tool for the Planex MZK-W04NU device
SVN-Revision: 14410
Diffstat (limited to 'tools/firmware-utils/src/sha1.h')
-rw-r--r-- | tools/firmware-utils/src/sha1.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tools/firmware-utils/src/sha1.h b/tools/firmware-utils/src/sha1.h new file mode 100644 index 0000000000..425267a306 --- /dev/null +++ b/tools/firmware-utils/src/sha1.h @@ -0,0 +1,57 @@ +#ifndef _SHA1_H +#define _SHA1_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _STD_TYPES +#define _STD_TYPES + +#define uchar unsigned char +#define uint unsigned int +#define ulong unsigned long int + +#endif + +typedef struct +{ + ulong total[2]; + ulong state[5]; + uchar buffer[64]; +} +sha1_context; + +/* + * Core SHA-1 functions + */ +void sha1_starts( sha1_context *ctx ); +void sha1_update( sha1_context *ctx, uchar *input, uint length ); +void sha1_finish( sha1_context *ctx, uchar digest[20] ); + +/* + * Output SHA-1(file contents), returns 0 if successful. + */ +int sha1_file( char *filename, uchar digest[20] ); + +/* + * Output SHA-1(buf) + */ +void sha1_csum( uchar *buf, uint buflen, uchar digest[20] ); + +/* + * Output HMAC-SHA-1(key,buf) + */ +void sha1_hmac( uchar *key, uint keylen, uchar *buf, uint buflen, + uchar digest[20] ); + +/* + * Checkup routine + */ +int sha1_self_test( void ); + +#ifdef __cplusplus +} +#endif + +#endif /* sha1.h */ |