OpenVAS Scanner  22.7.9
hmacmd5.h
Go to the documentation of this file.
1 /* SPDX-FileCopyrightText: 2023 Greenbone AG
2  * SPDX-FileCopyrightText: 1996-1999 Luke Kenneth Casson Leighton
3  * SPDX-FileCopyrightText: 1992-1999 Andrew Tridgell
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  */
7 
16 #ifndef NASL_HMACMD5_H
17 #define NASL_HMACMD5_H
18 
19 #include "md5.h"
20 
21 #ifndef uchar
22 #define uchar unsigned char
23 #endif
24 
25 /* zero a structure */
26 #define ZERO_STRUCT(x) memset ((char *) &(x), 0, sizeof (x))
27 
28 typedef struct
29 {
30  struct MD5Context ctx;
31  uchar k_ipad[65];
32  uchar k_opad[65];
33 
35 
36 /*
37  * Note we duplicate the size tests in the unsigned
38  * case as int16 may be a typedef from rpc/rpc.h
39  */
40 
41 #if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)
42 #if (SIZEOF_SHORT == 4)
43 #define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
44 #else /* SIZEOF_SHORT != 4 */
45 #define uint16 unsigned short
46 #endif /* SIZEOF_SHORT != 4 */
47 #endif
48 
49 /*
50  * SMB UCS2 (16-bit unicode) internal type.
51  */
53 
54 #ifdef WORDS_BIGENDIAN
55 #define UCS2_SHIFT 8
56 #else
57 #define UCS2_SHIFT 0
58 #endif
59 
60 /* turn a 7 bit character into a ucs2 character */
61 #define UCS2_CHAR(c) ((c) << UCS2_SHIFT)
62 void
63 hmac_md5_init_limK_to_64 (const uchar *key, int key_len, HMACMD5Context *ctx);
64 
65 void
66 hmac_md5_update (const uchar *text, int text_len, HMACMD5Context *ctx);
67 void
68 hmac_md5_final (uchar *digest, HMACMD5Context *ctx);
69 
70 void
71 hmac_md5 (uchar key[16], uchar *data, int data_len, uchar *digest);
72 
73 #endif /* NASL_HMACMD5_H */
HMACMD5Context
Definition: hmacmd5.h:29
uchar
#define uchar
Definition: hmacmd5.h:22
hmac_md5_final
void hmac_md5_final(uchar *digest, HMACMD5Context *ctx)
Finish off hmac_md5 "inner" buffer and generate outer one.
Definition: hmacmd5.c:64
uint16
#define uint16
Definition: hmacmd5.h:45
hmac_md5
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:82
hmac_md5_init_limK_to_64
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:24
smb_ucs2_t
uint16 smb_ucs2_t
Definition: hmacmd5.h:52
hmac_md5_update
void hmac_md5_update(const uchar *text, int text_len, HMACMD5Context *ctx)
Update hmac_md5 "inner" buffer.
Definition: hmacmd5.c:55
md5.h
MD5Context
Definition: md5.h:52