OpenVAS Scanner 21.4.1
smb_crypt.h
Go to the documentation of this file.
1/* Copyright (C) Andrew Tridgell 1998-2000
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
28#ifndef NASL_SMB_CRYPT_H
29#define NASL_SMB_CRYPT_H
30#include "byteorder.h"
31#include "charset.h"
32#include "hmacmd5.h"
33#include "md4.h"
34#include "md5.h"
35
36#ifndef uchar
37#define uchar unsigned char
38#endif
39
40#ifndef uint8
41#define uint8 uint8_t
42#endif
43
44typedef unsigned int bool;
45#define False 0
46#define True 1
47
48void
49E_P24 (const uchar *p21, const uchar *c8, uchar *p24);
50void
51E_P16 (uchar *p14, uchar *p16);
52
53int
54strupper_w (smb_ucs2_t *s); /*implemented in smb_crypt2.c*/
55
56void
58 const uchar lm_resp[24], uint8 sess_key[16]);
59
60void
61SMBsesskeygen_ntv1_ntlmssp (const uchar kr[16], const uchar *nt_resp,
62 uint8 sess_key[16]);
63
64void
65SMBOWFencrypt_ntlmssp (const uchar passwd[16], const uchar *c8, uchar p24[24]);
66
67void
68SMBencrypt_hash_ntlmssp (const uchar lm_hash[16], const uchar *c8,
69 uchar p24[24]);
70
71void
72SMBNTencrypt_hash_ntlmssp (const uchar nt_hash[16], uchar *c8, uchar *p24);
73
74bool
75E_deshash_ntlmssp (const char *passwd, uint8_t pass_len, uchar p16[16]);
76
77void
78SamOEMhash (uchar *data, const uchar *key, int val);
79
80/* Does the md5 encryption from the Key Response for NTLMv2. */
81void
82SMBOWFencrypt_ntv2_ntlmssp (const uchar kr[16], const uint8_t *srv_chal,
83 int srv_chal_len, const uint8_t *cli_chal,
84 int cli_chal_len, uchar resp_buf[16]);
85
86void
87SMBsesskeygen_ntv2_ntlmssp (const uchar kr[16], const uchar *nt_resp,
88 uint8 sess_key[16]);
89
90uint8_t *
91NTLMv2_generate_client_data_ntlmssp (const char *addr_list,
92 int address_list_len);
93
94void
95NTLMv2_generate_response_ntlmssp (const uchar ntlm_v2_hash[16],
96 const char *server_chal,
97 const char *address_list,
98 int address_list_len, uint8_t *nt_response);
99
100void
101LMv2_generate_response_ntlmssp (const uchar ntlm_v2_hash[16],
102 const char *server_chal, uint8_t *lm_response);
103
104void
105SMBNTLMv2encrypt_hash_ntlmssp (const char *user, const char *domain,
106 uchar ntlm_v2_hash[16], const char *server_chal,
107 const char *address_list, int address_list_len,
108 unsigned char *lm_response,
109 unsigned char *nt_response,
110 unsigned char *user_session_key);
111
112#endif
Unix SMB/CIFS implementation. SMB Byte handling.
Unix SMB/CIFS implementation. charset defines.
Unix SMB/CIFS implementation. HMAC MD5 code for use in NTLMv2.
#define uchar
Definition: hmacmd5.h:35
uint16 smb_ucs2_t
Definition: hmacmd5.h:65
Unix SMB/CIFS implementation.
const char * val
Definition: nasl_init.c:389
int strupper_w(smb_ucs2_t *s)
Definition: smb_crypt2.c:48
#define uint8
Definition: smb_crypt.h:41
void SMBencrypt_hash_ntlmssp(const uchar lm_hash[16], const uchar *c8, uchar p24[24])
Definition: smb_crypt.c:407
void SMBNTLMv2encrypt_hash_ntlmssp(const char *user, const char *domain, uchar ntlm_v2_hash[16], const char *server_chal, const char *address_list, int address_list_len, unsigned char *lm_response, unsigned char *nt_response, unsigned char *user_session_key)
void NTLMv2_generate_response_ntlmssp(const uchar ntlm_v2_hash[16], const char *server_chal, const char *address_list, int address_list_len, uint8_t *nt_response)
Definition: smb_crypt.c:520
void E_P16(uchar *p14, uchar *p16)
Definition: smb_crypt.c:315
void SMBNTencrypt_hash_ntlmssp(const uchar nt_hash[16], uchar *c8, uchar *p24)
Definition: smb_crypt.c:419
unsigned int bool
Definition: smb_crypt.h:44
void SamOEMhash(uchar *data, const uchar *key, int val)
Definition: smb_crypt.c:331
void SMBsesskeygen_ntv1_ntlmssp(const uchar kr[16], const uchar *nt_resp, uint8 sess_key[16])
Definition: smb_crypt.c:386
void SMBsesskeygen_ntv2_ntlmssp(const uchar kr[16], const uchar *nt_resp, uint8 sess_key[16])
Definition: smb_crypt.c:476
void LMv2_generate_response_ntlmssp(const uchar ntlm_v2_hash[16], const char *server_chal, uint8_t *lm_response)
Definition: smb_crypt.c:545
void E_P24(const uchar *p21, const uchar *c8, uchar *p24)
Definition: smb_crypt.c:323
void SMBOWFencrypt_ntlmssp(const uchar passwd[16], const uchar *c8, uchar p24[24])
Definition: smb_crypt.c:397
void SMBsesskeygen_lm_sess_key_ntlmssp(const uchar lm_hash[16], const uchar lm_resp[24], uint8 sess_key[16])
Definition: smb_crypt.c:429
uint8_t * NTLMv2_generate_client_data_ntlmssp(const char *addr_list, int address_list_len)
Definition: smb_crypt.c:489
void SMBOWFencrypt_ntv2_ntlmssp(const uchar kr[16], const uint8_t *srv_chal, int srv_chal_len, const uint8_t *cli_chal, int cli_chal_len, uchar resp_buf[16])
bool E_deshash_ntlmssp(const char *passwd, uint8_t pass_len, uchar p16[16])
Definition: smb_crypt.c:450