PolarSSL v1.1.4
sha4.h
Go to the documentation of this file.
00001 
00027 #ifndef POLARSSL_SHA4_H
00028 #define POLARSSL_SHA4_H
00029 
00030 #include <string.h>
00031 
00032 #define POLARSSL_ERR_SHA4_FILE_IO_ERROR                -0x007A  
00034 #if defined(_MSC_VER) || defined(__WATCOMC__)
00035   #define UL64(x) x##ui64
00036   #define long64 __int64
00037 #else
00038   #define UL64(x) x##ULL
00039   #define long64 long long
00040 #endif
00041 
00045 typedef struct
00046 {
00047     unsigned long64 total[2];    
00048     unsigned long64 state[8];    
00049     unsigned char buffer[128];  
00051     unsigned char ipad[128];    
00052     unsigned char opad[128];    
00053     int is384;                  
00054 }
00055 sha4_context;
00056 
00057 #ifdef __cplusplus
00058 extern "C" {
00059 #endif
00060 
00067 void sha4_starts( sha4_context *ctx, int is384 );
00068 
00076 void sha4_update( sha4_context *ctx, const unsigned char *input, size_t ilen );
00077 
00084 void sha4_finish( sha4_context *ctx, unsigned char output[64] );
00085 
00094 void sha4( const unsigned char *input, size_t ilen,
00095            unsigned char output[64], int is384 );
00096 
00106 int sha4_file( const char *path, unsigned char output[64], int is384 );
00107 
00116 void sha4_hmac_starts( sha4_context *ctx, const unsigned char *key, size_t keylen,
00117                        int is384 );
00118 
00126 void sha4_hmac_update( sha4_context *ctx, const unsigned char *input, size_t ilen );
00127 
00134 void sha4_hmac_finish( sha4_context *ctx, unsigned char output[64] );
00135 
00141 void sha4_hmac_reset( sha4_context *ctx );
00142 
00153 void sha4_hmac( const unsigned char *key, size_t keylen,
00154                 const unsigned char *input, size_t ilen,
00155                 unsigned char output[64], int is384 );
00156 
00162 int sha4_self_test( int verbose );
00163 
00164 #ifdef __cplusplus
00165 }
00166 #endif
00167 
00168 #endif /* sha4.h */