PolarSSL v1.2.5
sha4.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_SHA4_H
28 #define POLARSSL_SHA4_H
29 
30 #include <string.h>
31 
32 #if defined(_MSC_VER) || defined(__WATCOMC__)
33  #define UL64(x) x##ui64
34  typedef unsigned __int64 uint64_t;
35 #else
36  #include <inttypes.h>
37  #define UL64(x) x##ULL
38 #endif
39 
40 #define POLARSSL_ERR_SHA4_FILE_IO_ERROR -0x007A
45 typedef struct
46 {
47  uint64_t total[2];
48  uint64_t state[8];
49  unsigned char buffer[128];
51  unsigned char ipad[128];
52  unsigned char opad[128];
53  int is384;
54 }
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
67 void sha4_starts( sha4_context *ctx, int is384 );
68 
76 void sha4_update( sha4_context *ctx, const unsigned char *input, size_t ilen );
77 
84 void sha4_finish( sha4_context *ctx, unsigned char output[64] );
85 
94 void sha4( const unsigned char *input, size_t ilen,
95  unsigned char output[64], int is384 );
96 
106 int sha4_file( const char *path, unsigned char output[64], int is384 );
107 
116 void sha4_hmac_starts( sha4_context *ctx, const unsigned char *key, size_t keylen,
117  int is384 );
118 
126 void sha4_hmac_update( sha4_context *ctx, const unsigned char *input, size_t ilen );
127 
134 void sha4_hmac_finish( sha4_context *ctx, unsigned char output[64] );
135 
141 void sha4_hmac_reset( sha4_context *ctx );
142 
153 void sha4_hmac( const unsigned char *key, size_t keylen,
154  const unsigned char *input, size_t ilen,
155  unsigned char output[64], int is384 );
156 
162 int sha4_self_test( int verbose );
163 
164 #ifdef __cplusplus
165 }
166 #endif
167 
168 #endif /* sha4.h */