File: hmac.c

package info (click to toggle)
courier 0.60.0-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 52,288 kB
  • ctags: 12,677
  • sloc: ansic: 165,348; cpp: 24,820; sh: 16,410; perl: 6,839; makefile: 3,621; yacc: 289; sed: 16
file content (35 lines) | stat: -rw-r--r-- 846 bytes parent folder | download | duplicates (26)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
** Copyright 1998 - 1999 Double Precision, Inc.
** See COPYING for distribution information.
*/

#define	MD5_INTERNAL
#include	"md5.h"
#include	"../libhmac/hmac.h"

static void alloc_context( void (*func)(void *, void *), void *arg)
{
struct	MD5_CONTEXT c;

	(*func)((void *)&c, arg);
}

static void alloc_hash( void (*func)(unsigned char *, void *), void *arg)
{
unsigned char c[MD5_DIGEST_SIZE];

	(*func)(c, arg);
}

struct hmac_hashinfo hmac_md5 = {
	"md5",
	MD5_BLOCK_SIZE,
	MD5_DIGEST_SIZE,
	sizeof(struct MD5_CONTEXT),
	(void (*)(void *))md5_context_init,
	(void (*)(void *, const void *, unsigned))md5_context_hashstream,
	(void (*)(void *, unsigned long))md5_context_endstream,
	(void (*)(void *, unsigned char *))md5_context_digest,
	(void (*)(void *, const unsigned char *))md5_context_restore,
        alloc_context,
	alloc_hash};