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