PolarSSL v1.3.9
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
45extern "C" {
46#endif
47
51typedef 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
68void md2_init( md2_context *ctx );
69
75void md2_free( md2_context *ctx );
76
83
91void md2_update( md2_context *ctx, const unsigned char *input, size_t ilen );
92
99void 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
110extern "C" {
111#endif
112
120void md2( const unsigned char *input, size_t ilen, unsigned char output[16] );
121
130int md2_file( const char *path, unsigned char output[16] );
131
139void md2_hmac_starts( md2_context *ctx, const unsigned char *key,
140 size_t keylen );
141
149void md2_hmac_update( md2_context *ctx, const unsigned char *input,
150 size_t ilen );
151
158void md2_hmac_finish( md2_context *ctx, unsigned char output[16] );
159
166
176void md2_hmac( const unsigned char *key, size_t keylen,
177 const unsigned char *input, size_t ilen,
178 unsigned char output[16] );
179
185int md2_self_test( int verbose );
186
187/* Internal use */
189
190#ifdef __cplusplus
191}
192#endif
193
194#endif /* md2.h */
Configuration options (set of defines)
void md2_update(md2_context *ctx, const unsigned char *input, size_t ilen)
MD2 process buffer.
void md2_hmac_reset(md2_context *ctx)
MD2 HMAC context reset.
int md2_self_test(int verbose)
Checkup routine.
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.
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_process(md2_context *ctx)
void md2_init(md2_context *ctx)
Initialize MD2 context.
void md2_free(md2_context *ctx)
Clear MD2 context.
void md2_hmac_update(md2_context *ctx, const unsigned char *input, size_t ilen)
MD2 HMAC process buffer.
int md2_file(const char *path, unsigned char output[16])
Output = MD2( file contents )
void md2_finish(md2_context *ctx, unsigned char output[16])
MD2 final digest.
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.
MD2 context structure.
Definition md2.h:52
size_t left
Definition md2.h:59