00001
00027 #ifndef POLARSSL_MD5_H
00028 #define POLARSSL_MD5_H
00029
00030 #include "config.h"
00031
00032 #include <string.h>
00033
00034 #if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
00035 #include <basetsd.h>
00036 typedef UINT32 uint32_t;
00037 #else
00038 #include <inttypes.h>
00039 #endif
00040
00041 #define POLARSSL_ERR_MD5_FILE_IO_ERROR -0x0074
00043 #if !defined(POLARSSL_MD5_ALT)
00044
00045
00046
00047 #ifdef __cplusplus
00048 extern "C" {
00049 #endif
00050
00054 typedef struct
00055 {
00056 uint32_t total[2];
00057 uint32_t state[4];
00058 unsigned char buffer[64];
00060 unsigned char ipad[64];
00061 unsigned char opad[64];
00062 }
00063 md5_context;
00064
00070 void md5_starts( md5_context *ctx );
00071
00079 void md5_update( md5_context *ctx, const unsigned char *input, size_t ilen );
00080
00087 void md5_finish( md5_context *ctx, unsigned char output[16] );
00088
00089
00090 void md5_process( md5_context *ctx, const unsigned char data[64] );
00091
00092 #ifdef __cplusplus
00093 }
00094 #endif
00095
00096 #else
00097 #include "md5_alt.h"
00098 #endif
00099
00100 #ifdef __cplusplus
00101 extern "C" {
00102 #endif
00103
00111 void md5( const unsigned char *input, size_t ilen, unsigned char output[16] );
00112
00121 int md5_file( const char *path, unsigned char output[16] );
00122
00130 void md5_hmac_starts( md5_context *ctx,
00131 const unsigned char *key, size_t keylen );
00132
00140 void md5_hmac_update( md5_context *ctx,
00141 const unsigned char *input, size_t ilen );
00142
00149 void md5_hmac_finish( md5_context *ctx, unsigned char output[16] );
00150
00156 void md5_hmac_reset( md5_context *ctx );
00157
00167 void md5_hmac( const unsigned char *key, size_t keylen,
00168 const unsigned char *input, size_t ilen,
00169 unsigned char output[16] );
00170
00176 int md5_self_test( int verbose );
00177
00178 #ifdef __cplusplus
00179 }
00180 #endif
00181
00182 #endif