OpenVAS Scanner 23.23.1
smb_crypt.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Greenbone AG
2 * SPDX-FileCopyrightText: 1998-2000 Andrew Tridgell
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
14
15#ifndef NASL_SMB_CRYPT_H
16#define NASL_SMB_CRYPT_H
17#include "byteorder.h"
18#include "charset.h"
19#include "hmacmd5.h"
20#include "md4.h"
21#include "md5.h"
22
23#ifndef uchar
24#define uchar unsigned char
25#endif
26
27#ifndef uint8
28#define uint8 uint8_t
29#endif
30
31typedef unsigned int bool;
32#define False 0
33#define True 1
34
35void
36E_P24 (const uchar *p21, const uchar *c8, uchar *p24);
37void
38E_P16 (uchar *p14, uchar *p16);
39
40int
41strupper_w (smb_ucs2_t *s); /*implemented in smb_crypt2.c*/
42
43void
45 const uchar lm_resp[24], uint8 sess_key[16]);
46
47void
48SMBsesskeygen_ntv1_ntlmssp (const uchar kr[16], const uchar *nt_resp,
49 uint8 sess_key[16]);
50
51void
52SMBOWFencrypt_ntlmssp (const uchar passwd[16], const uchar *c8, uchar p24[24]);
53
54void
55SMBencrypt_hash_ntlmssp (const uchar lm_hash[16], const uchar *c8,
56 uchar p24[24]);
57
58void
59SMBNTencrypt_hash_ntlmssp (const uchar nt_hash[16], uchar *c8, uchar *p24);
60
61bool
62E_deshash_ntlmssp (const char *passwd, uint8_t pass_len, uchar p16[16]);
63
64void
65SamOEMhash (uchar *data, const uchar *key, int val);
66
67/* Does the md5 encryption from the Key Response for NTLMv2. */
68void
69SMBOWFencrypt_ntv2_ntlmssp (const uchar *kr, const uint8_t *srv_chal,
70 int srv_chal_len, const uint8_t *cli_chal,
71 int cli_chal_len, uchar resp_buf[16]);
72
73void
74SMBsesskeygen_ntv2_ntlmssp (const uchar kr[16], const uchar *nt_resp,
75 uint8 sess_key[16]);
76
77uint8_t *
78NTLMv2_generate_client_data_ntlmssp (const char *addr_list,
79 int address_list_len);
80
81void
82NTLMv2_generate_response_ntlmssp (const uchar ntlm_v2_hash[16],
83 const char *server_chal,
84 const char *address_list,
85 int address_list_len, uint8_t *nt_response);
86
87void
88LMv2_generate_response_ntlmssp (const uchar ntlm_v2_hash[16],
89 const char *server_chal, uint8_t *lm_response);
90
91void
92SMBNTLMv2encrypt_hash_ntlmssp (const char *user, const char *domain,
93 uchar ntlm_v2_hash[16], const char *server_chal,
94 const char *address_list, int address_list_len,
95 unsigned char *lm_response,
96 unsigned char *nt_response,
97 unsigned char *user_session_key);
98
99#endif
Unix SMB/CIFS implementation. SMB Byte handling.
#define uint8
Definition charcnv.c:45
unsigned int bool
Definition charcnv.c:62
Unix SMB/CIFS implementation. charset defines.
Unix SMB/CIFS implementation. HMAC MD5 code for use in NTLMv2.
#define uchar
Definition hmacmd5.h:22
uint16 smb_ucs2_t
Definition hmacmd5.h:52
Unix SMB/CIFS implementation.
const char * val
Definition nasl_init.c:437
int strupper_w(smb_ucs2_t *s)
Definition smb_crypt2.c:35
void SMBencrypt_hash_ntlmssp(const uchar lm_hash[16], const uchar *c8, uchar p24[24])
Definition smb_crypt.c:394
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:507
void E_P16(uchar *p14, uchar *p16)
Definition smb_crypt.c:302
void SMBNTencrypt_hash_ntlmssp(const uchar nt_hash[16], uchar *c8, uchar *p24)
Definition smb_crypt.c:406
void SMBOWFencrypt_ntv2_ntlmssp(const uchar *kr, const uint8_t *srv_chal, int srv_chal_len, const uint8_t *cli_chal, int cli_chal_len, uchar resp_buf[16])
void SamOEMhash(uchar *data, const uchar *key, int val)
Definition smb_crypt.c:318
void SMBsesskeygen_ntv1_ntlmssp(const uchar kr[16], const uchar *nt_resp, uint8 sess_key[16])
Definition smb_crypt.c:373
void SMBsesskeygen_ntv2_ntlmssp(const uchar kr[16], const uchar *nt_resp, uint8 sess_key[16])
Definition smb_crypt.c:463
void LMv2_generate_response_ntlmssp(const uchar ntlm_v2_hash[16], const char *server_chal, uint8_t *lm_response)
Definition smb_crypt.c:534
void E_P24(const uchar *p21, const uchar *c8, uchar *p24)
Definition smb_crypt.c:310
void SMBOWFencrypt_ntlmssp(const uchar passwd[16], const uchar *c8, uchar p24[24])
Definition smb_crypt.c:384
void SMBsesskeygen_lm_sess_key_ntlmssp(const uchar lm_hash[16], const uchar lm_resp[24], uint8 sess_key[16])
Definition smb_crypt.c:416
uint8_t * NTLMv2_generate_client_data_ntlmssp(const char *addr_list, int address_list_len)
Definition smb_crypt.c:476
bool E_deshash_ntlmssp(const char *passwd, uint8_t pass_len, uchar p16[16])
Definition smb_crypt.c:437