mbed TLS v1.3.18
md2.h
Go to the documentation of this file.
1 
24 #ifndef POLARSSL_MD2_H
25 #define POLARSSL_MD2_H
26 
27 #if !defined(POLARSSL_CONFIG_FILE)
28 #include "config.h"
29 #else
30 #include POLARSSL_CONFIG_FILE
31 #endif
32 
33 #include <stddef.h>
34 
35 #define POLARSSL_ERR_MD2_FILE_IO_ERROR -0x0070
37 #if !defined(POLARSSL_MD2_ALT)
38 // Regular implementation
39 //
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
48 typedef struct
49 {
50  unsigned char cksum[16];
51  unsigned char state[48];
52  unsigned char buffer[16];
54  unsigned char ipad[16];
55  unsigned char opad[16];
56  size_t left;
57 }
59 
65 void md2_init( md2_context *ctx );
66 
72 void md2_free( md2_context *ctx );
73 
79 void md2_starts( md2_context *ctx );
80 
88 void md2_update( md2_context *ctx, const unsigned char *input, size_t ilen );
89 
96 void md2_finish( md2_context *ctx, unsigned char output[16] );
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #else /* POLARSSL_MD2_ALT */
103 #include "md2_alt.h"
104 #endif /* POLARSSL_MD2_ALT */
105 
106 #ifdef __cplusplus
107 extern "C" {
108 #endif
109 
117 void md2( const unsigned char *input, size_t ilen, unsigned char output[16] );
118 
127 int md2_file( const char *path, unsigned char output[16] );
128 
136 void md2_hmac_starts( md2_context *ctx, const unsigned char *key,
137  size_t keylen );
138 
146 void md2_hmac_update( md2_context *ctx, const unsigned char *input,
147  size_t ilen );
148 
155 void md2_hmac_finish( md2_context *ctx, unsigned char output[16] );
156 
162 void md2_hmac_reset( md2_context *ctx );
163 
173 void md2_hmac( const unsigned char *key, size_t keylen,
174  const unsigned char *input, size_t ilen,
175  unsigned char output[16] );
176 
182 int md2_self_test( int verbose );
183 
184 /* Internal use */
185 void md2_process( md2_context *ctx );
186 
187 #ifdef __cplusplus
188 }
189 #endif
190 
191 #endif /* md2.h */
void md2_update(md2_context *ctx, const unsigned char *input, size_t ilen)
MD2 process buffer.
void md2_init(md2_context *ctx)
Initialize MD2 context.
void md2_process(md2_context *ctx)
void md2_hmac_update(md2_context *ctx, const unsigned char *input, size_t ilen)
MD2 HMAC process buffer.
Configuration options (set of defines)
void md2(const unsigned char *input, size_t ilen, unsigned char output[16])
Output = MD2( input buffer )
void md2_hmac_finish(md2_context *ctx, unsigned char output[16])
MD2 HMAC final digest.
int md2_file(const char *path, unsigned char output[16])
Output = MD2( file contents )
void md2_free(md2_context *ctx)
Clear MD2 context.
size_t left
Definition: md2.h:56
int md2_self_test(int verbose)
Checkup routine.
void md2_starts(md2_context *ctx)
MD2 context setup.
void md2_hmac_starts(md2_context *ctx, const unsigned char *key, size_t keylen)
MD2 HMAC context setup.
void md2_hmac(const unsigned char *key, size_t keylen, const unsigned char *input, size_t ilen, unsigned char output[16])
Output = HMAC-MD2( hmac key, input buffer )
void md2_hmac_reset(md2_context *ctx)
MD2 HMAC context reset.
MD2 context structure.
Definition: md2.h:48
void md2_finish(md2_context *ctx, unsigned char output[16])
MD2 final digest.