PolarSSL v1.2.8
sha1.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_SHA1_H
28 #define POLARSSL_SHA1_H
29 
30 #include "config.h"
31 
32 #include <string.h>
33 
34 #ifdef _MSC_VER
35 #include <basetsd.h>
36 typedef UINT32 uint32_t;
37 #else
38 #include <inttypes.h>
39 #endif
40 
41 #define POLARSSL_ERR_SHA1_FILE_IO_ERROR -0x0076
43 #if !defined(POLARSSL_SHA1_ALT)
44 // Regular implementation
45 //
46 
50 typedef struct
51 {
52  uint32_t total[2];
53  uint32_t state[5];
54  unsigned char buffer[64];
56  unsigned char ipad[64];
57  unsigned char opad[64];
58 }
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
70 void sha1_starts( sha1_context *ctx );
71 
79 void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ilen );
80 
87 void sha1_finish( sha1_context *ctx, unsigned char output[20] );
88 
89 /* Internal use */
90 void sha1_process( sha1_context *ctx, const unsigned char data[64] );
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #else /* POLARSSL_SHA1_ALT */
97 #include "sha1_alt.h"
98 #endif /* POLARSSL_SHA1_ALT */
99 
100 #ifdef __cplusplus
101 extern "C" {
102 #endif
103 
111 void sha1( const unsigned char *input, size_t ilen, unsigned char output[20] );
112 
121 int sha1_file( const char *path, unsigned char output[20] );
122 
130 void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, size_t keylen );
131 
139 void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, size_t ilen );
140 
147 void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] );
148 
154 void sha1_hmac_reset( sha1_context *ctx );
155 
165 void sha1_hmac( const unsigned char *key, size_t keylen,
166  const unsigned char *input, size_t ilen,
167  unsigned char output[20] );
168 
174 int sha1_self_test( int verbose );
175 
176 #ifdef __cplusplus
177 }
178 #endif
179 
180 #endif /* sha1.h */