PolarSSL v1.1.4
sha2.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_SHA2_H
28 #define POLARSSL_SHA2_H
29 
30 #include <string.h>
31 
32 #define POLARSSL_ERR_SHA2_FILE_IO_ERROR -0x0078
37 typedef struct
38 {
39  unsigned long total[2];
40  unsigned long state[8];
41  unsigned char buffer[64];
43  unsigned char ipad[64];
44  unsigned char opad[64];
45  int is224;
46 }
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
59 void sha2_starts( sha2_context *ctx, int is224 );
60 
68 void sha2_update( sha2_context *ctx, const unsigned char *input, size_t ilen );
69 
76 void sha2_finish( sha2_context *ctx, unsigned char output[32] );
77 
86 void sha2( const unsigned char *input, size_t ilen,
87  unsigned char output[32], int is224 );
88 
98 int sha2_file( const char *path, unsigned char output[32], int is224 );
99 
108 void sha2_hmac_starts( sha2_context *ctx, const unsigned char *key, size_t keylen,
109  int is224 );
110 
118 void sha2_hmac_update( sha2_context *ctx, const unsigned char *input, size_t ilen );
119 
126 void sha2_hmac_finish( sha2_context *ctx, unsigned char output[32] );
127 
133 void sha2_hmac_reset( sha2_context *ctx );
134 
145 void sha2_hmac( const unsigned char *key, size_t keylen,
146  const unsigned char *input, size_t ilen,
147  unsigned char output[32], int is224 );
148 
154 int sha2_self_test( int verbose );
155 
156 #ifdef __cplusplus
157 }
158 #endif
159 
160 #endif /* sha2.h */