00001
00027 #ifndef POLARSSL_MD2_H
00028 #define POLARSSL_MD2_H
00029
00030 #include "config.h"
00031
00032 #include <string.h>
00033
00034 #define POLARSSL_ERR_MD2_FILE_IO_ERROR -0x0070
00036 #if !defined(POLARSSL_MD2_ALT)
00037
00038
00039
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043
00047 typedef struct
00048 {
00049 unsigned char cksum[16];
00050 unsigned char state[48];
00051 unsigned char buffer[16];
00053 unsigned char ipad[16];
00054 unsigned char opad[16];
00055 size_t left;
00056 }
00057 md2_context;
00058
00064 void md2_starts( md2_context *ctx );
00065
00073 void md2_update( md2_context *ctx, const unsigned char *input, size_t ilen );
00074
00081 void md2_finish( md2_context *ctx, unsigned char output[16] );
00082
00083 #ifdef __cplusplus
00084 }
00085 #endif
00086
00087 #else
00088 #include "md2_alt.h"
00089 #endif
00090
00091 #ifdef __cplusplus
00092 extern "C" {
00093 #endif
00094
00102 void md2( const unsigned char *input, size_t ilen, unsigned char output[16] );
00103
00112 int md2_file( const char *path, unsigned char output[16] );
00113
00121 void md2_hmac_starts( md2_context *ctx, const unsigned char *key, size_t keylen );
00122
00130 void md2_hmac_update( md2_context *ctx, const unsigned char *input, size_t ilen );
00131
00138 void md2_hmac_finish( md2_context *ctx, unsigned char output[16] );
00139
00145 void md2_hmac_reset( md2_context *ctx );
00146
00156 void md2_hmac( const unsigned char *key, size_t keylen,
00157 const unsigned char *input, size_t ilen,
00158 unsigned char output[16] );
00159
00165 int md2_self_test( int verbose );
00166
00167
00168 void md2_process( md2_context *ctx );
00169
00170 #ifdef __cplusplus
00171 }
00172 #endif
00173
00174 #endif