mbed TLS v1.3.11
md5.h
Go to the documentation of this file.
1 
24 #ifndef POLARSSL_MD5_H
25 #define POLARSSL_MD5_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 #if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
36 #include <basetsd.h>
37 typedef UINT32 uint32_t;
38 #else
39 #include <inttypes.h>
40 #endif
41 
42 #define POLARSSL_ERR_MD5_FILE_IO_ERROR -0x0074
44 #if !defined(POLARSSL_MD5_ALT)
45 // Regular implementation
46 //
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
55 typedef struct
56 {
57  uint32_t total[2];
58  uint32_t state[4];
59  unsigned char buffer[64];
61  unsigned char ipad[64];
62  unsigned char opad[64];
63 }
65 
71 void md5_init( md5_context *ctx );
72 
78 void md5_free( md5_context *ctx );
79 
85 void md5_starts( md5_context *ctx );
86 
94 void md5_update( md5_context *ctx, const unsigned char *input, size_t ilen );
95 
102 void md5_finish( md5_context *ctx, unsigned char output[16] );
103 
104 /* Internal use */
105 void md5_process( md5_context *ctx, const unsigned char data[64] );
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #else /* POLARSSL_MD5_ALT */
112 #include "md5_alt.h"
113 #endif /* POLARSSL_MD5_ALT */
114 
115 #ifdef __cplusplus
116 extern "C" {
117 #endif
118 
126 void md5( const unsigned char *input, size_t ilen, unsigned char output[16] );
127 
136 int md5_file( const char *path, unsigned char output[16] );
137 
145 void md5_hmac_starts( md5_context *ctx,
146  const unsigned char *key, size_t keylen );
147 
155 void md5_hmac_update( md5_context *ctx,
156  const unsigned char *input, size_t ilen );
157 
164 void md5_hmac_finish( md5_context *ctx, unsigned char output[16] );
165 
171 void md5_hmac_reset( md5_context *ctx );
172 
182 void md5_hmac( const unsigned char *key, size_t keylen,
183  const unsigned char *input, size_t ilen,
184  unsigned char output[16] );
185 
191 int md5_self_test( int verbose );
192 
193 #ifdef __cplusplus
194 }
195 #endif
196 
197 #endif /* md5.h */
Configuration options (set of defines)
void md5_finish(md5_context *ctx, unsigned char output[16])
MD5 final digest.
void md5_hmac(const unsigned char *key, size_t keylen, const unsigned char *input, size_t ilen, unsigned char output[16])
Output = HMAC-MD5( hmac key, input buffer )
void md5_free(md5_context *ctx)
Clear MD5 context.
int md5_self_test(int verbose)
Checkup routine.
int md5_file(const char *path, unsigned char output[16])
Output = MD5( file contents )
void md5_hmac_starts(md5_context *ctx, const unsigned char *key, size_t keylen)
MD5 HMAC context setup.
void md5_process(md5_context *ctx, const unsigned char data[64])
void md5_hmac_reset(md5_context *ctx)
MD5 HMAC context reset.
void md5_starts(md5_context *ctx)
MD5 context setup.
void md5_hmac_finish(md5_context *ctx, unsigned char output[16])
MD5 HMAC final digest.
MD5 context structure.
Definition: md5.h:55
void md5_init(md5_context *ctx)
Initialize MD5 context.
void md5_update(md5_context *ctx, const unsigned char *input, size_t ilen)
MD5 process buffer.
void md5_hmac_update(md5_context *ctx, const unsigned char *input, size_t ilen)
MD5 HMAC process buffer.
void md5(const unsigned char *input, size_t ilen, unsigned char output[16])
Output = MD5( input buffer )