GSS_S_PROMPTING_NEEDED is a bit
[cyrus-sasl.git] / include / hmac-md5.h
1 /* hmac-md5.h -- HMAC_MD5 functions
2  */
3
4 #ifndef HMAC_MD5_H
5 #define HMAC_MD5_H 1
6
7 #define HMAC_MD5_SIZE 16
8
9 /* intermediate MD5 context */
10 typedef struct HMAC_MD5_CTX_s {
11     MD5_CTX ictx, octx;
12 } HMAC_MD5_CTX;
13
14 /* intermediate HMAC state
15  *  values stored in network byte order (Big Endian)
16  */
17 typedef struct HMAC_MD5_STATE_s {
18     UINT4 istate[4];
19     UINT4 ostate[4];
20 } HMAC_MD5_STATE;
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /* One step hmac computation
27  *
28  * digest may be same as text or key
29  */
30 void _sasl_hmac_md5(const unsigned char *text, int text_len,
31                     const unsigned char *key, int key_len,
32                     unsigned char digest[HMAC_MD5_SIZE]);
33
34 /* create context from key
35  */
36 void _sasl_hmac_md5_init(HMAC_MD5_CTX *hmac,
37                          const unsigned char *key, int key_len);
38
39 /* precalculate intermediate state from key
40  */
41 void _sasl_hmac_md5_precalc(HMAC_MD5_STATE *hmac,
42                             const unsigned char *key, int key_len);
43
44 /* initialize context from intermediate state
45  */
46 void _sasl_hmac_md5_import(HMAC_MD5_CTX *hmac, HMAC_MD5_STATE *state);
47
48 #define _sasl_hmac_md5_update(hmac, text, text_len) _sasl_MD5Update(&(hmac)->ictx, (text), (text_len))
49
50 /* finish hmac from intermediate result.  Intermediate result is zeroed.
51  */
52 void _sasl_hmac_md5_final(unsigned char digest[HMAC_MD5_SIZE],
53                           HMAC_MD5_CTX *hmac);
54
55 #ifdef __cplusplus
56 }
57 #endif
58
59 #endif /* HMAC_MD5_H */