00001
00004 #ifndef XYSSL_SHA2_H
00005 #define XYSSL_SHA2_H
00006
00010 typedef struct
00011 {
00012 unsigned long total[2];
00013 unsigned long state[8];
00014 unsigned char buffer[64];
00016 unsigned char ipad[64];
00017 unsigned char opad[64];
00018 int is224;
00019 }
00020 sha2_context;
00021
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025
00032 void sha2_starts( sha2_context *ctx, int is224 );
00033
00041 void sha2_update( sha2_context *ctx, unsigned char *input, int ilen );
00042
00049 void sha2_finish( sha2_context *ctx, unsigned char output[32] );
00050
00059 void sha2( unsigned char *input, int ilen,
00060 unsigned char output[32], int is224 );
00061
00072 int sha2_file( char *path, unsigned char output[32], int is224 );
00073
00082 void sha2_hmac_starts( sha2_context *ctx, unsigned char *key, int keylen,
00083 int is224 );
00084
00092 void sha2_hmac_update( sha2_context *ctx, unsigned char *input, int ilen );
00093
00100 void sha2_hmac_finish( sha2_context *ctx, unsigned char output[32] );
00101
00112 void sha2_hmac( unsigned char *key, int keylen,
00113 unsigned char *input, int ilen,
00114 unsigned char output[32], int is224 );
00115
00121 int sha2_self_test( int verbose );
00122
00123 #ifdef __cplusplus
00124 }
00125 #endif
00126
00127 #endif