| 1 | /* |
| 2 | ** Copyright 1998 - 1999 Double Precision, Inc. |
| 3 | ** See COPYING for distribution information. |
| 4 | */ |
| 5 | |
| 6 | #define MD5_INTERNAL |
| 7 | #include "md5.h" |
| 8 | #include "../libhmac/hmac.h" |
| 9 | |
| 10 | static void alloc_context( void (*func)(void *, void *), void *arg) |
| 11 | { |
| 12 | struct MD5_CONTEXT c; |
| 13 | |
| 14 | (*func)((void *)&c, arg); |
| 15 | } |
| 16 | |
| 17 | static void alloc_hash( void (*func)(unsigned char *, void *), void *arg) |
| 18 | { |
| 19 | unsigned char c[MD5_DIGEST_SIZE]; |
| 20 | |
| 21 | (*func)(c, arg); |
| 22 | } |
| 23 | |
| 24 | struct hmac_hashinfo hmac_md5 = { |
| 25 | "md5", |
| 26 | MD5_BLOCK_SIZE, |
| 27 | MD5_DIGEST_SIZE, |
| 28 | sizeof(struct MD5_CONTEXT), |
| 29 | (void (*)(void *))md5_context_init, |
| 30 | (void (*)(void *, const void *, unsigned))md5_context_hashstream, |
| 31 | (void (*)(void *, unsigned long))md5_context_endstream, |
| 32 | (void (*)(void *, unsigned char *))md5_context_digest, |
| 33 | (void (*)(void *, const unsigned char *))md5_context_restore, |
| 34 | alloc_context, |
| 35 | alloc_hash}; |