PolarSSL v1.2.12
md_wrap.c
Go to the documentation of this file.
1 
30 #include "polarssl/config.h"
31 
32 #if defined(POLARSSL_MD_C)
33 
34 #include "polarssl/md_wrap.h"
35 
36 #if defined(POLARSSL_MD2_C)
37 #include "polarssl/md2.h"
38 #endif
39 
40 #if defined(POLARSSL_MD4_C)
41 #include "polarssl/md4.h"
42 #endif
43 
44 #if defined(POLARSSL_MD5_C)
45 #include "polarssl/md5.h"
46 #endif
47 
48 #if defined(POLARSSL_SHA1_C)
49 #include "polarssl/sha1.h"
50 #endif
51 
52 #if defined(POLARSSL_SHA2_C)
53 #include "polarssl/sha2.h"
54 #endif
55 
56 #if defined(POLARSSL_SHA4_C)
57 #include "polarssl/sha4.h"
58 #endif
59 
60 #include <stdlib.h>
61 
62 /* Implementation that should never be optimized out by the compiler */
63 static void polarssl_zeroize( void *v, size_t n ) {
64  volatile unsigned char *p = v; while( n-- ) *p++ = 0;
65 }
66 
67 #if defined(POLARSSL_MD2_C)
68 
69 static void md2_starts_wrap( void *ctx )
70 {
71  md2_starts( (md2_context *) ctx );
72 }
73 
74 static void md2_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
75 {
76  md2_update( (md2_context *) ctx, input, ilen );
77 }
78 
79 static void md2_finish_wrap( void *ctx, unsigned char *output )
80 {
81  md2_finish( (md2_context *) ctx, output );
82 }
83 
84 static int md2_file_wrap( const char *path, unsigned char *output )
85 {
86 #if defined(POLARSSL_FS_IO)
87  return md2_file( path, output );
88 #else
89  ((void) path);
90  ((void) output);
92 #endif
93 }
94 
95 static void md2_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
96 {
97  md2_hmac_starts( (md2_context *) ctx, key, keylen );
98 }
99 
100 static void md2_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
101 {
102  md2_hmac_update( (md2_context *) ctx, input, ilen );
103 }
104 
105 static void md2_hmac_finish_wrap( void *ctx, unsigned char *output )
106 {
107  md2_hmac_finish( (md2_context *) ctx, output );
108 }
109 
110 static void md2_hmac_reset_wrap( void *ctx )
111 {
112  md2_hmac_reset( (md2_context *) ctx );
113 }
114 
115 static void * md2_ctx_alloc( void )
116 {
117  return malloc( sizeof( md2_context ) );
118 }
119 
120 static void md2_ctx_free( void *ctx )
121 {
122  polarssl_zeroize( ctx, sizeof( md2_context ) );
123  free( ctx );
124 }
125 
126 const md_info_t md2_info = {
128  "MD2",
129  16,
130  md2_starts_wrap,
131  md2_update_wrap,
132  md2_finish_wrap,
133  md2,
134  md2_file_wrap,
135  md2_hmac_starts_wrap,
136  md2_hmac_update_wrap,
137  md2_hmac_finish_wrap,
138  md2_hmac_reset_wrap,
139  md2_hmac,
140  md2_ctx_alloc,
141  md2_ctx_free,
142 };
143 
144 #endif
145 
146 #if defined(POLARSSL_MD4_C)
147 
148 static void md4_starts_wrap( void *ctx )
149 {
150  md4_starts( (md4_context *) ctx );
151 }
152 
153 static void md4_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
154 {
155  md4_update( (md4_context *) ctx, input, ilen );
156 }
157 
158 static void md4_finish_wrap( void *ctx, unsigned char *output )
159 {
160  md4_finish( (md4_context *) ctx, output );
161 }
162 
163 static int md4_file_wrap( const char *path, unsigned char *output )
164 {
165 #if defined(POLARSSL_FS_IO)
166  return md4_file( path, output );
167 #else
168  ((void) path);
169  ((void) output);
171 #endif
172 }
173 
174 static void md4_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
175 {
176  md4_hmac_starts( (md4_context *) ctx, key, keylen );
177 }
178 
179 static void md4_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
180 {
181  md4_hmac_update( (md4_context *) ctx, input, ilen );
182 }
183 
184 static void md4_hmac_finish_wrap( void *ctx, unsigned char *output )
185 {
186  md4_hmac_finish( (md4_context *) ctx, output );
187 }
188 
189 static void md4_hmac_reset_wrap( void *ctx )
190 {
191  md4_hmac_reset( (md4_context *) ctx );
192 }
193 
194 static void *md4_ctx_alloc( void )
195 {
196  return malloc( sizeof( md4_context ) );
197 }
198 
199 static void md4_ctx_free( void *ctx )
200 {
201  polarssl_zeroize( ctx, sizeof( md4_context ) );
202  free( ctx );
203 }
204 
205 const md_info_t md4_info = {
207  "MD4",
208  16,
209  md4_starts_wrap,
210  md4_update_wrap,
211  md4_finish_wrap,
212  md4,
213  md4_file_wrap,
214  md4_hmac_starts_wrap,
215  md4_hmac_update_wrap,
216  md4_hmac_finish_wrap,
217  md4_hmac_reset_wrap,
218  md4_hmac,
219  md4_ctx_alloc,
220  md4_ctx_free,
221 };
222 
223 #endif
224 
225 #if defined(POLARSSL_MD5_C)
226 
227 static void md5_starts_wrap( void *ctx )
228 {
229  md5_starts( (md5_context *) ctx );
230 }
231 
232 static void md5_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
233 {
234  md5_update( (md5_context *) ctx, input, ilen );
235 }
236 
237 static void md5_finish_wrap( void *ctx, unsigned char *output )
238 {
239  md5_finish( (md5_context *) ctx, output );
240 }
241 
242 static int md5_file_wrap( const char *path, unsigned char *output )
243 {
244 #if defined(POLARSSL_FS_IO)
245  return md5_file( path, output );
246 #else
247  ((void) path);
248  ((void) output);
250 #endif
251 }
252 
253 static void md5_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
254 {
255  md5_hmac_starts( (md5_context *) ctx, key, keylen );
256 }
257 
258 static void md5_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
259 {
260  md5_hmac_update( (md5_context *) ctx, input, ilen );
261 }
262 
263 static void md5_hmac_finish_wrap( void *ctx, unsigned char *output )
264 {
265  md5_hmac_finish( (md5_context *) ctx, output );
266 }
267 
268 static void md5_hmac_reset_wrap( void *ctx )
269 {
270  md5_hmac_reset( (md5_context *) ctx );
271 }
272 
273 static void * md5_ctx_alloc( void )
274 {
275  return malloc( sizeof( md5_context ) );
276 }
277 
278 static void md5_ctx_free( void *ctx )
279 {
280  polarssl_zeroize( ctx, sizeof( md5_context ) );
281  free( ctx );
282 }
283 
284 const md_info_t md5_info = {
286  "MD5",
287  16,
288  md5_starts_wrap,
289  md5_update_wrap,
290  md5_finish_wrap,
291  md5,
292  md5_file_wrap,
293  md5_hmac_starts_wrap,
294  md5_hmac_update_wrap,
295  md5_hmac_finish_wrap,
296  md5_hmac_reset_wrap,
297  md5_hmac,
298  md5_ctx_alloc,
299  md5_ctx_free,
300 };
301 
302 #endif
303 
304 #if defined(POLARSSL_SHA1_C)
305 
306 static void sha1_starts_wrap( void *ctx )
307 {
308  sha1_starts( (sha1_context *) ctx );
309 }
310 
311 static void sha1_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
312 {
313  sha1_update( (sha1_context *) ctx, input, ilen );
314 }
315 
316 static void sha1_finish_wrap( void *ctx, unsigned char *output )
317 {
318  sha1_finish( (sha1_context *) ctx, output );
319 }
320 
321 static int sha1_file_wrap( const char *path, unsigned char *output )
322 {
323 #if defined(POLARSSL_FS_IO)
324  return sha1_file( path, output );
325 #else
326  ((void) path);
327  ((void) output);
329 #endif
330 }
331 
332 static void sha1_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
333 {
334  sha1_hmac_starts( (sha1_context *) ctx, key, keylen );
335 }
336 
337 static void sha1_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
338 {
339  sha1_hmac_update( (sha1_context *) ctx, input, ilen );
340 }
341 
342 static void sha1_hmac_finish_wrap( void *ctx, unsigned char *output )
343 {
344  sha1_hmac_finish( (sha1_context *) ctx, output );
345 }
346 
347 static void sha1_hmac_reset_wrap( void *ctx )
348 {
349  sha1_hmac_reset( (sha1_context *) ctx );
350 }
351 
352 static void * sha1_ctx_alloc( void )
353 {
354  return malloc( sizeof( sha1_context ) );
355 }
356 
357 static void sha1_ctx_free( void *ctx )
358 {
359  polarssl_zeroize( ctx, sizeof( sha1_context ) );
360  free( ctx );
361 }
362 
363 const md_info_t sha1_info = {
365  "SHA1",
366  20,
367  sha1_starts_wrap,
368  sha1_update_wrap,
369  sha1_finish_wrap,
370  sha1,
371  sha1_file_wrap,
372  sha1_hmac_starts_wrap,
373  sha1_hmac_update_wrap,
374  sha1_hmac_finish_wrap,
375  sha1_hmac_reset_wrap,
376  sha1_hmac,
377  sha1_ctx_alloc,
378  sha1_ctx_free,
379 };
380 
381 #endif
382 
383 /*
384  * Wrappers for generic message digests
385  */
386 #if defined(POLARSSL_SHA2_C)
387 
388 static void sha224_starts_wrap( void *ctx )
389 {
390  sha2_starts( (sha2_context *) ctx, 1 );
391 }
392 
393 static void sha224_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
394 {
395  sha2_update( (sha2_context *) ctx, input, ilen );
396 }
397 
398 static void sha224_finish_wrap( void *ctx, unsigned char *output )
399 {
400  sha2_finish( (sha2_context *) ctx, output );
401 }
402 
403 static void sha224_wrap( const unsigned char *input, size_t ilen,
404  unsigned char *output )
405 {
406  sha2( input, ilen, output, 1 );
407 }
408 
409 static int sha224_file_wrap( const char *path, unsigned char *output )
410 {
411 #if defined(POLARSSL_FS_IO)
412  return sha2_file( path, output, 1 );
413 #else
414  ((void) path);
415  ((void) output);
417 #endif
418 }
419 
420 static void sha224_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
421 {
422  sha2_hmac_starts( (sha2_context *) ctx, key, keylen, 1 );
423 }
424 
425 static void sha224_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
426 {
427  sha2_hmac_update( (sha2_context *) ctx, input, ilen );
428 }
429 
430 static void sha224_hmac_finish_wrap( void *ctx, unsigned char *output )
431 {
432  sha2_hmac_finish( (sha2_context *) ctx, output );
433 }
434 
435 static void sha224_hmac_reset_wrap( void *ctx )
436 {
437  sha2_hmac_reset( (sha2_context *) ctx );
438 }
439 
440 static void sha224_hmac_wrap( const unsigned char *key, size_t keylen,
441  const unsigned char *input, size_t ilen,
442  unsigned char *output )
443 {
444  sha2_hmac( key, keylen, input, ilen, output, 1 );
445 }
446 
447 static void * sha224_ctx_alloc( void )
448 {
449  return malloc( sizeof( sha2_context ) );
450 }
451 
452 static void sha224_ctx_free( void *ctx )
453 {
454  polarssl_zeroize( ctx, sizeof( sha2_context ) );
455  free( ctx );
456 }
457 
458 const md_info_t sha224_info = {
460  "SHA224",
461  28,
462  sha224_starts_wrap,
463  sha224_update_wrap,
464  sha224_finish_wrap,
465  sha224_wrap,
466  sha224_file_wrap,
467  sha224_hmac_starts_wrap,
468  sha224_hmac_update_wrap,
469  sha224_hmac_finish_wrap,
470  sha224_hmac_reset_wrap,
471  sha224_hmac_wrap,
472  sha224_ctx_alloc,
473  sha224_ctx_free,
474 };
475 
476 static void sha256_starts_wrap( void *ctx )
477 {
478  sha2_starts( (sha2_context *) ctx, 0 );
479 }
480 
481 static void sha256_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
482 {
483  sha2_update( (sha2_context *) ctx, input, ilen );
484 }
485 
486 static void sha256_finish_wrap( void *ctx, unsigned char *output )
487 {
488  sha2_finish( (sha2_context *) ctx, output );
489 }
490 
491 static void sha256_wrap( const unsigned char *input, size_t ilen,
492  unsigned char *output )
493 {
494  sha2( input, ilen, output, 0 );
495 }
496 
497 static int sha256_file_wrap( const char *path, unsigned char *output )
498 {
499 #if defined(POLARSSL_FS_IO)
500  return sha2_file( path, output, 0 );
501 #else
502  ((void) path);
503  ((void) output);
505 #endif
506 }
507 
508 static void sha256_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
509 {
510  sha2_hmac_starts( (sha2_context *) ctx, key, keylen, 0 );
511 }
512 
513 static void sha256_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
514 {
515  sha2_hmac_update( (sha2_context *) ctx, input, ilen );
516 }
517 
518 static void sha256_hmac_finish_wrap( void *ctx, unsigned char *output )
519 {
520  sha2_hmac_finish( (sha2_context *) ctx, output );
521 }
522 
523 static void sha256_hmac_reset_wrap( void *ctx )
524 {
525  sha2_hmac_reset( (sha2_context *) ctx );
526 }
527 
528 static void sha256_hmac_wrap( const unsigned char *key, size_t keylen,
529  const unsigned char *input, size_t ilen,
530  unsigned char *output )
531 {
532  sha2_hmac( key, keylen, input, ilen, output, 0 );
533 }
534 
535 static void * sha256_ctx_alloc( void )
536 {
537  return malloc( sizeof( sha2_context ) );
538 }
539 
540 static void sha256_ctx_free( void *ctx )
541 {
542  polarssl_zeroize( ctx, sizeof( sha2_context ) );
543  free( ctx );
544 }
545 
546 const md_info_t sha256_info = {
548  "SHA256",
549  32,
550  sha256_starts_wrap,
551  sha256_update_wrap,
552  sha256_finish_wrap,
553  sha256_wrap,
554  sha256_file_wrap,
555  sha256_hmac_starts_wrap,
556  sha256_hmac_update_wrap,
557  sha256_hmac_finish_wrap,
558  sha256_hmac_reset_wrap,
559  sha256_hmac_wrap,
560  sha256_ctx_alloc,
561  sha256_ctx_free,
562 };
563 
564 #endif
565 
566 #if defined(POLARSSL_SHA4_C)
567 
568 static void sha384_starts_wrap( void *ctx )
569 {
570  sha4_starts( (sha4_context *) ctx, 1 );
571 }
572 
573 static void sha384_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
574 {
575  sha4_update( (sha4_context *) ctx, input, ilen );
576 }
577 
578 static void sha384_finish_wrap( void *ctx, unsigned char *output )
579 {
580  sha4_finish( (sha4_context *) ctx, output );
581 }
582 
583 static void sha384_wrap( const unsigned char *input, size_t ilen,
584  unsigned char *output )
585 {
586  sha4( input, ilen, output, 1 );
587 }
588 
589 static int sha384_file_wrap( const char *path, unsigned char *output )
590 {
591 #if defined(POLARSSL_FS_IO)
592  return sha4_file( path, output, 1 );
593 #else
594  ((void) path);
595  ((void) output);
597 #endif
598 }
599 
600 static void sha384_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
601 {
602  sha4_hmac_starts( (sha4_context *) ctx, key, keylen, 1 );
603 }
604 
605 static void sha384_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
606 {
607  sha4_hmac_update( (sha4_context *) ctx, input, ilen );
608 }
609 
610 static void sha384_hmac_finish_wrap( void *ctx, unsigned char *output )
611 {
612  sha4_hmac_finish( (sha4_context *) ctx, output );
613 }
614 
615 static void sha384_hmac_reset_wrap( void *ctx )
616 {
617  sha4_hmac_reset( (sha4_context *) ctx );
618 }
619 
620 static void sha384_hmac_wrap( const unsigned char *key, size_t keylen,
621  const unsigned char *input, size_t ilen,
622  unsigned char *output )
623 {
624  sha4_hmac( key, keylen, input, ilen, output, 1 );
625 }
626 
627 static void * sha384_ctx_alloc( void )
628 {
629  return malloc( sizeof( sha4_context ) );
630 }
631 
632 static void sha384_ctx_free( void *ctx )
633 {
634  polarssl_zeroize( ctx, sizeof( sha4_context ) );
635  free( ctx );
636 }
637 
638 const md_info_t sha384_info = {
640  "SHA384",
641  48,
642  sha384_starts_wrap,
643  sha384_update_wrap,
644  sha384_finish_wrap,
645  sha384_wrap,
646  sha384_file_wrap,
647  sha384_hmac_starts_wrap,
648  sha384_hmac_update_wrap,
649  sha384_hmac_finish_wrap,
650  sha384_hmac_reset_wrap,
651  sha384_hmac_wrap,
652  sha384_ctx_alloc,
653  sha384_ctx_free,
654 };
655 
656 static void sha512_starts_wrap( void *ctx )
657 {
658  sha4_starts( (sha4_context *) ctx, 0 );
659 }
660 
661 static void sha512_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
662 {
663  sha4_update( (sha4_context *) ctx, input, ilen );
664 }
665 
666 static void sha512_finish_wrap( void *ctx, unsigned char *output )
667 {
668  sha4_finish( (sha4_context *) ctx, output );
669 }
670 
671 static void sha512_wrap( const unsigned char *input, size_t ilen,
672  unsigned char *output )
673 {
674  sha4( input, ilen, output, 0 );
675 }
676 
677 static int sha512_file_wrap( const char *path, unsigned char *output )
678 {
679 #if defined(POLARSSL_FS_IO)
680  return sha4_file( path, output, 0 );
681 #else
682  ((void) path);
683  ((void) output);
685 #endif
686 }
687 
688 static void sha512_hmac_starts_wrap( void *ctx, const unsigned char *key, size_t keylen )
689 {
690  sha4_hmac_starts( (sha4_context *) ctx, key, keylen, 0 );
691 }
692 
693 static void sha512_hmac_update_wrap( void *ctx, const unsigned char *input, size_t ilen )
694 {
695  sha4_hmac_update( (sha4_context *) ctx, input, ilen );
696 }
697 
698 static void sha512_hmac_finish_wrap( void *ctx, unsigned char *output )
699 {
700  sha4_hmac_finish( (sha4_context *) ctx, output );
701 }
702 
703 static void sha512_hmac_reset_wrap( void *ctx )
704 {
705  sha4_hmac_reset( (sha4_context *) ctx );
706 }
707 
708 static void sha512_hmac_wrap( const unsigned char *key, size_t keylen,
709  const unsigned char *input, size_t ilen,
710  unsigned char *output )
711 {
712  sha4_hmac( key, keylen, input, ilen, output, 0 );
713 }
714 
715 static void * sha512_ctx_alloc( void )
716 {
717  return malloc( sizeof( sha4_context ) );
718 }
719 
720 static void sha512_ctx_free( void *ctx )
721 {
722  polarssl_zeroize( ctx, sizeof( sha4_context ) );
723  free( ctx );
724 }
725 
726 const md_info_t sha512_info = {
728  "SHA512",
729  64,
730  sha512_starts_wrap,
731  sha512_update_wrap,
732  sha512_finish_wrap,
733  sha512_wrap,
734  sha512_file_wrap,
735  sha512_hmac_starts_wrap,
736  sha512_hmac_update_wrap,
737  sha512_hmac_finish_wrap,
738  sha512_hmac_reset_wrap,
739  sha512_hmac_wrap,
740  sha512_ctx_alloc,
741  sha512_ctx_free,
742 };
743 
744 #endif
745 
746 #endif
void sha1_hmac_finish(sha1_context *ctx, unsigned char output[20])
SHA-1 HMAC final digest.
void sha4_hmac_reset(sha4_context *ctx)
SHA-512 HMAC context reset.
void md2_update(md2_context *ctx, const unsigned char *input, size_t ilen)
MD2 process buffer.
void sha2_hmac_update(sha2_context *ctx, const unsigned char *input, size_t ilen)
SHA-256 HMAC process buffer.
SHA-256 context structure.
Definition: sha2.h:50
SHA-1 context structure.
Definition: sha1.h:50
int sha4_file(const char *path, unsigned char output[64], int is384)
Output = SHA-512( file contents )
void md2_hmac_update(md2_context *ctx, const unsigned char *input, size_t ilen)
MD2 HMAC process buffer.
const md_info_t md5_info
void sha1(const unsigned char *input, size_t ilen, unsigned char output[20])
Output = SHA-1( input buffer )
void sha1_finish(sha1_context *ctx, unsigned char output[20])
SHA-1 final digest.
void sha4_hmac_starts(sha4_context *ctx, const unsigned char *key, size_t keylen, int is384)
SHA-512 HMAC context setup.
#define POLARSSL_ERR_MD_FEATURE_UNAVAILABLE
The selected feature is not available.
Definition: md.h:42
void sha2_hmac_starts(sha2_context *ctx, const unsigned char *key, size_t keylen, int is224)
SHA-256 HMAC context setup.
void md4_finish(md4_context *ctx, unsigned char output[16])
MD4 final digest.
void sha1_hmac(const unsigned char *key, size_t keylen, const unsigned char *input, size_t ilen, unsigned char output[20])
Output = HMAC-SHA-1( hmac key, input buffer )
void md4_hmac(const unsigned char *key, size_t keylen, const unsigned char *input, size_t ilen, unsigned char output[16])
Output = HMAC-MD4( hmac key, input buffer )
void md4_starts(md4_context *ctx)
MD4 context setup.
Configuration options (set of defines)
void md2(const unsigned char *input, size_t ilen, unsigned char output[16])
Output = MD2( input buffer )
void md5_finish(md5_context *ctx, unsigned char output[16])
MD5 final digest.
void sha2_hmac_reset(sha2_context *ctx)
SHA-256 HMAC context reset.
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 md4(const unsigned char *input, size_t ilen, unsigned char output[16])
Output = MD4( input buffer )
void sha2_hmac_finish(sha2_context *ctx, unsigned char output[32])
SHA-256 HMAC final digest.
void md2_hmac_finish(md2_context *ctx, unsigned char output[16])
MD2 HMAC final digest.
void sha4_starts(sha4_context *ctx, int is384)
SHA-512 context setup.
void sha4_hmac(const unsigned char *key, size_t keylen, const unsigned char *input, size_t ilen, unsigned char output[64], int is384)
Output = HMAC-SHA-512( hmac key, input buffer )
int md2_file(const char *path, unsigned char output[16])
Output = MD2( file contents )
SHA-384 and SHA-512 cryptographic hash function.
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 sha1_hmac_reset(sha1_context *ctx)
SHA-1 HMAC context reset.
void md4_update(md4_context *ctx, const unsigned char *input, size_t ilen)
MD4 process buffer.
SHA-224 and SHA-256 cryptographic hash function.
void md4_hmac_starts(md4_context *ctx, const unsigned char *key, size_t keylen)
MD4 HMAC context setup.
void sha4_update(sha4_context *ctx, const unsigned char *input, size_t ilen)
SHA-512 process buffer.
const md_info_t sha224_info
void md4_hmac_finish(md4_context *ctx, unsigned char output[16])
MD4 HMAC final digest.
MD4 context structure.
Definition: md4.h:50
int sha1_file(const char *path, unsigned char output[20])
Output = SHA-1( file contents )
Message digest wrappers.
void md5_hmac_reset(md5_context *ctx)
MD5 HMAC context reset.
void md5_starts(md5_context *ctx)
MD5 context setup.
void sha4_hmac_finish(sha4_context *ctx, unsigned char output[64])
SHA-512 HMAC final digest.
void sha1_hmac_starts(sha1_context *ctx, const unsigned char *key, size_t keylen)
SHA-1 HMAC context setup.
void md5_hmac_finish(md5_context *ctx, unsigned char output[16])
MD5 HMAC final digest.
MD5 context structure.
Definition: md5.h:50
void sha1_starts(sha1_context *ctx)
SHA-1 context setup.
void md2_starts(md2_context *ctx)
MD2 context setup.
void sha2_update(sha2_context *ctx, const unsigned char *input, size_t ilen)
SHA-256 process buffer.
const md_info_t sha1_info
void sha4(const unsigned char *input, size_t ilen, unsigned char output[64], int is384)
Output = SHA-512( input buffer )
void md2_hmac_starts(md2_context *ctx, const unsigned char *key, size_t keylen)
MD2 HMAC context setup.
const md_info_t sha512_info
SHA-1 cryptographic hash function.
void sha2_hmac(const unsigned char *key, size_t keylen, const unsigned char *input, size_t ilen, unsigned char output[32], int is224)
Output = HMAC-SHA-256( hmac key, input buffer )
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 )
SHA-512 context structure.
Definition: sha4.h:51
const md_info_t sha256_info
void sha1_update(sha1_context *ctx, const unsigned char *input, size_t ilen)
SHA-1 process buffer.
void md5_update(md5_context *ctx, const unsigned char *input, size_t ilen)
MD5 process buffer.
int sha2_file(const char *path, unsigned char output[32], int is224)
Output = SHA-256( file contents )
void md2_hmac_reset(md2_context *ctx)
MD2 HMAC context reset.
void sha2(const unsigned char *input, size_t ilen, unsigned char output[32], int is224)
Output = SHA-256( input buffer )
void sha4_finish(sha4_context *ctx, unsigned char output[64])
SHA-512 final digest.
void sha4_hmac_update(sha4_context *ctx, const unsigned char *input, size_t ilen)
SHA-512 HMAC process buffer.
MD2 context structure.
Definition: md2.h:43
void md2_finish(md2_context *ctx, unsigned char output[16])
MD2 final digest.
void sha1_hmac_update(sha1_context *ctx, const unsigned char *input, size_t ilen)
SHA-1 HMAC process buffer.
MD4 message digest algorithm (hash function)
void md5_hmac_update(md5_context *ctx, const unsigned char *input, size_t ilen)
MD5 HMAC process buffer.
int md4_file(const char *path, unsigned char output[16])
Output = MD4( file contents )
void sha2_starts(sha2_context *ctx, int is224)
SHA-256 context setup.
MD5 message digest algorithm (hash function)
void md5(const unsigned char *input, size_t ilen, unsigned char output[16])
Output = MD5( input buffer )
Message digest information.
Definition: md.h:65
MD2 message digest algorithm (hash function)
const md_info_t sha384_info
void md4_hmac_reset(md4_context *ctx)
MD4 HMAC context reset.
void md4_hmac_update(md4_context *ctx, const unsigned char *input, size_t ilen)
MD4 HMAC process buffer.
void sha2_finish(sha2_context *ctx, unsigned char output[32])
SHA-256 final digest.