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