PolarSSL v1.1.4
sha2.h
Go to the documentation of this file.
00001 
00027 #ifndef POLARSSL_SHA2_H
00028 #define POLARSSL_SHA2_H
00029 
00030 #include <string.h>
00031 
00032 #define POLARSSL_ERR_SHA2_FILE_IO_ERROR                -0x0078  
00037 typedef struct
00038 {
00039     unsigned long total[2];     
00040     unsigned long state[8];     
00041     unsigned char buffer[64];   
00043     unsigned char ipad[64];     
00044     unsigned char opad[64];     
00045     int is224;                  
00046 }
00047 sha2_context;
00048 
00049 #ifdef __cplusplus
00050 extern "C" {
00051 #endif
00052 
00059 void sha2_starts( sha2_context *ctx, int is224 );
00060 
00068 void sha2_update( sha2_context *ctx, const unsigned char *input, size_t ilen );
00069 
00076 void sha2_finish( sha2_context *ctx, unsigned char output[32] );
00077 
00086 void sha2( const unsigned char *input, size_t ilen,
00087            unsigned char output[32], int is224 );
00088 
00098 int sha2_file( const char *path, unsigned char output[32], int is224 );
00099 
00108 void sha2_hmac_starts( sha2_context *ctx, const unsigned char *key, size_t keylen,
00109                        int is224 );
00110 
00118 void sha2_hmac_update( sha2_context *ctx, const unsigned char *input, size_t ilen );
00119 
00126 void sha2_hmac_finish( sha2_context *ctx, unsigned char output[32] );
00127 
00133 void sha2_hmac_reset( sha2_context *ctx );
00134 
00145 void sha2_hmac( const unsigned char *key, size_t keylen,
00146                 const unsigned char *input, size_t ilen,
00147                 unsigned char output[32], int is224 );
00148 
00154 int sha2_self_test( int verbose );
00155 
00156 #ifdef __cplusplus
00157 }
00158 #endif
00159 
00160 #endif /* sha2.h */