Back to index

courier  0.68.2
hmac.c
Go to the documentation of this file.
00001 /*
00002 ** Copyright 1998 - 1999 Double Precision, Inc.
00003 ** See COPYING for distribution information.
00004 */
00005 
00006 #define       MD5_INTERNAL
00007 #include      "md5.h"
00008 #include      "../libhmac/hmac.h"
00009 
00010 static void alloc_context( void (*func)(void *, void *), void *arg)
00011 {
00012 struct MD5_CONTEXT c;
00013 
00014        (*func)((void *)&c, arg);
00015 }
00016 
00017 static void alloc_hash( void (*func)(unsigned char *, void *), void *arg)
00018 {
00019 unsigned char c[MD5_DIGEST_SIZE];
00020 
00021        (*func)(c, arg);
00022 }
00023 
00024 struct hmac_hashinfo hmac_md5 = {
00025        "md5",
00026        MD5_BLOCK_SIZE,
00027        MD5_DIGEST_SIZE,
00028        sizeof(struct MD5_CONTEXT),
00029        (void (*)(void *))md5_context_init,
00030        (void (*)(void *, const void *, unsigned))md5_context_hashstream,
00031        (void (*)(void *, unsigned long))md5_context_endstream,
00032        (void (*)(void *, unsigned char *))md5_context_digest,
00033        (void (*)(void *, const unsigned char *))md5_context_restore,
00034         alloc_context,
00035        alloc_hash};