00001
00004 #ifndef XYSSL_SHA4_H
00005 #define XYSSL_SHA4_H
00006
00007 #if defined(_MSC_VER) || defined(__WATCOMC__)
00008 #define UL64(x) x##ui64
00009 #define int64 __int64
00010 #else
00011 #define UL64(x) x##ULL
00012 #define int64 long long
00013 #endif
00014
00018 typedef struct
00019 {
00020 unsigned int64 total[2];
00021 unsigned int64 state[8];
00022 unsigned char buffer[128];
00024 unsigned char ipad[128];
00025 unsigned char opad[128];
00026 int is384;
00027 }
00028 sha4_context;
00029
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033
00040 void sha4_starts( sha4_context *ctx, int is384 );
00041
00049 void sha4_update( sha4_context *ctx, unsigned char *input, int ilen );
00050
00057 void sha4_finish( sha4_context *ctx, unsigned char output[64] );
00058
00067 void sha4( unsigned char *input, int ilen,
00068 unsigned char output[64], int is384 );
00069
00080 int sha4_file( char *path, unsigned char output[64], int is384 );
00081
00090 void sha4_hmac_starts( sha4_context *ctx, unsigned char *key, int keylen,
00091 int is384 );
00092
00100 void sha4_hmac_update( sha4_context *ctx, unsigned char *input, int ilen );
00101
00108 void sha4_hmac_finish( sha4_context *ctx, unsigned char output[64] );
00109
00120 void sha4_hmac( unsigned char *key, int keylen,
00121 unsigned char *input, int ilen,
00122 unsigned char output[64], int is384 );
00123
00129 int sha4_self_test( int verbose );
00130
00131 #ifdef __cplusplus
00132 }
00133 #endif
00134
00135 #endif