PolarSSL v1.3.8
md2.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_MD2_H
28 #define POLARSSL_MD2_H
29 
30 #if !defined(POLARSSL_CONFIG_FILE)
31 #include "config.h"
32 #else
33 #include POLARSSL_CONFIG_FILE
34 #endif
35 
36 #include <string.h>
37 
38 #define POLARSSL_ERR_MD2_FILE_IO_ERROR -0x0070
40 #if !defined(POLARSSL_MD2_ALT)
41 // Regular implementation
42 //
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
51 typedef struct
52 {
53  unsigned char cksum[16];
54  unsigned char state[48];
55  unsigned char buffer[16];
57  unsigned char ipad[16];
58  unsigned char opad[16];
59  size_t left;
60 }
62 
68 void md2_init( md2_context *ctx );
69 
75 void md2_free( md2_context *ctx );
76 
82 void md2_starts( md2_context *ctx );
83 
91 void md2_update( md2_context *ctx, const unsigned char *input, size_t ilen );
92 
99 void md2_finish( md2_context *ctx, unsigned char output[16] );
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #else /* POLARSSL_MD2_ALT */
106 #include "md2_alt.h"
107 #endif /* POLARSSL_MD2_ALT */
108 
109 #ifdef __cplusplus
110 extern "C" {
111 #endif
112 
120 void md2( const unsigned char *input, size_t ilen, unsigned char output[16] );
121 
130 int md2_file( const char *path, unsigned char output[16] );
131 
139 void md2_hmac_starts( md2_context *ctx, const unsigned char *key,
140  size_t keylen );
141 
149 void md2_hmac_update( md2_context *ctx, const unsigned char *input,
150  size_t ilen );
151 
158 void md2_hmac_finish( md2_context *ctx, unsigned char output[16] );
159 
165 void md2_hmac_reset( md2_context *ctx );
166 
176 void md2_hmac( const unsigned char *key, size_t keylen,
177  const unsigned char *input, size_t ilen,
178  unsigned char output[16] );
179 
185 int md2_self_test( int verbose );
186 
187 /* Internal use */
188 void md2_process( md2_context *ctx );
189 
190 #ifdef __cplusplus
191 }
192 #endif
193 
194 #endif /* md2.h */