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