PolarSSL v1.1.4
|
00001 00027 #ifndef POLARSSL_SHA1_H 00028 #define POLARSSL_SHA1_H 00029 00030 #include <string.h> 00031 00032 #define POLARSSL_ERR_SHA1_FILE_IO_ERROR -0x0076 00037 typedef struct 00038 { 00039 unsigned long total[2]; 00040 unsigned long state[5]; 00041 unsigned char buffer[64]; 00043 unsigned char ipad[64]; 00044 unsigned char opad[64]; 00045 } 00046 sha1_context; 00047 00048 #ifdef __cplusplus 00049 extern "C" { 00050 #endif 00051 00057 void sha1_starts( sha1_context *ctx ); 00058 00066 void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ilen ); 00067 00074 void sha1_finish( sha1_context *ctx, unsigned char output[20] ); 00075 00083 void sha1( const unsigned char *input, size_t ilen, unsigned char output[20] ); 00084 00093 int sha1_file( const char *path, unsigned char output[20] ); 00094 00102 void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, size_t keylen ); 00103 00111 void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, size_t ilen ); 00112 00119 void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] ); 00120 00126 void sha1_hmac_reset( sha1_context *ctx ); 00127 00137 void sha1_hmac( const unsigned char *key, size_t keylen, 00138 const unsigned char *input, size_t ilen, 00139 unsigned char output[20] ); 00140 00146 int sha1_self_test( int verbose ); 00147 00148 #ifdef __cplusplus 00149 } 00150 #endif 00151 00152 #endif /* sha1.h */