2 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
6 #pragma ident "%Z%%M% %I% %E% SMI"
8 /* hmac-md5.h -- HMAC_MD5 functions
14 #define HMAC_MD5_SIZE 16
18 #include <sasl/saslplug.h>
21 /* intermediate MD5 context */
22 typedef struct HMAC_MD5_CTX_s
{
26 /* intermediate HMAC state
27 * values stored in network byte order (Big Endian)
29 typedef struct HMAC_MD5_STATE_s
{
35 /* One step hmac computation
37 * digest may be same as text or key
39 void _sasl_hmac_md5(const unsigned char *text
, int text_len
,
40 const unsigned char *key
, int key_len
,
41 unsigned char digest
[HMAC_MD5_SIZE
]);
43 /* create context from key
45 void _sasl_hmac_md5_init(HMAC_MD5_CTX
*hmac
,
46 const unsigned char *key
, int key_len
);
48 /* precalculate intermediate state from key
50 void _sasl_hmac_md5_precalc(HMAC_MD5_STATE
*hmac
,
51 const unsigned char *key
, int key_len
);
53 /* initialize context from intermediate state
55 void _sasl_hmac_md5_import(HMAC_MD5_CTX
*hmac
, HMAC_MD5_STATE
*state
);
57 #define _sasl_hmac_md5_update(hmac, text, text_len) _sasl_MD5Update(&(hmac)->ictx, (text), (text_len))
59 /* finish hmac from intermediate result. Intermediate result is zeroed.
61 void _sasl_hmac_md5_final(unsigned char digest
[HMAC_MD5_SIZE
],
64 #endif /* HMAC_MD5_H */