OpenVAS Libraries  9.0.1
hmacmd5.h
Go to the documentation of this file.
1 /*
2  Unix SMB/CIFS implementation.
3  Interface header: Scheduler service
4  Copyright (C) Luke Kenneth Casson Leighton 1996-1999
5  Copyright (C) Andrew Tridgell 1992-1999
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21 
22 #ifndef _HMAC_MD5_H
23 #define _HMAC_MD5_H
24 
25 #include "md5.h"
26 
27 #ifndef uchar
28 #define uchar unsigned char
29 #endif
30 
31 /* zero a structure */
32 #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
33 
34 typedef struct
35 {
36  struct MD5Context ctx;
37  uchar k_ipad[65];
38  uchar k_opad[65];
39 
41 
42 #ifndef SAFE_FREE
43 
49 #define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
50 #endif
51 
52 /*
53  * Note we duplicate the size tests in the unsigned
54  * case as int16 may be a typedef from rpc/rpc.h
55  */
56 
57 #if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)
58 #if (SIZEOF_SHORT == 4)
59 #define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
60 #else /* SIZEOF_SHORT != 4 */
61 #define uint16 unsigned short
62 #endif /* SIZEOF_SHORT != 4 */
63 #endif
64 
65 /*
66  * SMB UCS2 (16-bit unicode) internal type.
67  */
69 
70 #ifdef WORDS_BIGENDIAN
71 #define UCS2_SHIFT 8
72 #else
73 #define UCS2_SHIFT 0
74 #endif
75 
76 /* turn a 7 bit character into a ucs2 character */
77 #define UCS2_CHAR(c) ((c) << UCS2_SHIFT)
78 void hmac_md5_init_limK_to_64(const uchar* key, int key_len, HMACMD5Context *ctx);
79 
80 void hmac_md5_update(const uchar* text, int text_len, HMACMD5Context *ctx);
81 void hmac_md5_final(uchar *digest, HMACMD5Context *ctx);
82 
83 void hmac_md5( uchar key[16], uchar* data, int data_len, uchar* digest);
84 
85 #endif /* _HMAC_MD5_H */
#define uchar
Definition: hmacmd5.h:28
void hmac_md5_final(uchar *digest, HMACMD5Context *ctx)
Finish off hmac_md5 "inner" buffer and generate outer one.
Definition: hmacmd5.c:71
void hmac_md5(uchar key[16], uchar *data, int data_len, uchar *digest)
Function to calculate an HMAC MD5 digest from data. Use the microsoft hmacmd5 init method because the...
Definition: hmacmd5.c:88
void hmac_md5_init_limK_to_64(const uchar *key, int key_len, HMACMD5Context *ctx)
The microsoft version of hmac_md5 initialisation.
Definition: hmacmd5.c:33
#define uint16
Definition: hmacmd5.h:61
uint16 smb_ucs2_t
Definition: hmacmd5.h:68
Definition: md5.h:46
void hmac_md5_update(const uchar *text, int text_len, HMACMD5Context *ctx)
Update hmac_md5 "inner" buffer.
Definition: hmacmd5.c:63
Definition: hmacmd5.h:34