Try to improve the "Kerberos requested but not OpenSSL" message.
[jelmer/wireshark.git] / wsutil / md5.h
1 /* $Id$ */
2 /*
3  * Copyright (C) 2003-2005 Benny Prijono <benny@prijono.org>
4  * Copyright (C) 2012      C Elston, Katalix Systems Ltd <celston@katalix.com>
5  *
6  * MD5 code from pjlib-util http://www.pjsip.org
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  *  2012-08-21 - C Elston - Split md5_hmac function to allow incremental usage.
23  *
24  */
25 #ifndef __MD5_H__ /**@todo Should this be _CRYPT_MD5_H__ ?*/
26 #define __MD5_H__
27
28 #include "ws_symbol_export.h"
29
30 /**
31  * @file md5.h
32  * @brief MD5 Functions
33  */
34
35 /* Don't define this group for Wireshark
36  * @defgroup PJLIB_UTIL_MD5 MD5 Functions
37  * @ingroup PJLIB_UTIL
38  * @{
39  */
40
41 #define md5_byte_t guint8
42
43 /** MD5 context. */
44 typedef struct md5_state_s
45 {
46         guint32 buf[4];
47         guint32 bits[2];
48         guint32 in[16];
49 } md5_state_t;
50
51 /** Initialize the algorithm.
52  *  @param pms          MD5 context.
53  */
54 WS_DLL_PUBLIC
55 void md5_init(md5_state_t *pms);
56
57 /** Append a string to the message.
58  *  @param pms          MD5 context.
59  *  @param data         Data.
60  *  @param nbytes       Length of data.
61  */
62 WS_DLL_PUBLIC
63 void md5_append( md5_state_t *pms,
64                              const guint8 *data, size_t nbytes);
65
66 /** Finish the message and return the digest.
67  *  @param pms          MD5 context.
68  *  @param digest       16 byte digest.
69  */
70 WS_DLL_PUBLIC
71 void md5_finish(md5_state_t *pms, guint8 digest[16]);
72
73 typedef struct md5_hmac_state_s
74 {
75     md5_state_t ctx;
76     guint8 k_opad[65];
77 } md5_hmac_state_t;
78
79 WS_DLL_PUBLIC
80 void md5_hmac_init(md5_hmac_state_t *hctx,
81                    const guint8* key, size_t key_len);
82
83 WS_DLL_PUBLIC
84 void md5_hmac_append(md5_hmac_state_t *hctx,
85                      const guint8* text, size_t text_len);
86
87 WS_DLL_PUBLIC
88 void md5_hmac_finish(md5_hmac_state_t *hctx, guint8 digest[16]);
89
90 WS_DLL_PUBLIC
91 void md5_hmac(const guint8* text, size_t text_len, const guint8* key,
92               size_t key_len, guint8 digest[16]);
93
94 /*
95  * @}
96  */
97
98 #endif  /* _CRYPT_MD5_H__ */