xref: /illumos-gate/usr/src/lib/libsmbfs/smb/ntlm.h (revision 40c0e2317898b8c774791bdc2b30bd50111ab1fa)
1613a2f6bSGordon Ross /*
2613a2f6bSGordon Ross  * CDDL HEADER START
3613a2f6bSGordon Ross  *
4613a2f6bSGordon Ross  * The contents of this file are subject to the terms of the
5613a2f6bSGordon Ross  * Common Development and Distribution License (the "License").
6613a2f6bSGordon Ross  * You may not use this file except in compliance with the License.
7613a2f6bSGordon Ross  *
8613a2f6bSGordon Ross  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9613a2f6bSGordon Ross  * or http://www.opensolaris.org/os/licensing.
10613a2f6bSGordon Ross  * See the License for the specific language governing permissions
11613a2f6bSGordon Ross  * and limitations under the License.
12613a2f6bSGordon Ross  *
13613a2f6bSGordon Ross  * When distributing Covered Code, include this CDDL HEADER in each
14613a2f6bSGordon Ross  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15613a2f6bSGordon Ross  * If applicable, add the following below this CDDL HEADER, with the
16613a2f6bSGordon Ross  * fields enclosed by brackets "[]" replaced with your own identifying
17613a2f6bSGordon Ross  * information: Portions Copyright [yyyy] [name of copyright owner]
18613a2f6bSGordon Ross  *
19613a2f6bSGordon Ross  * CDDL HEADER END
20613a2f6bSGordon Ross  */
21613a2f6bSGordon Ross 
22613a2f6bSGordon Ross /*
23613a2f6bSGordon Ross  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24613a2f6bSGordon Ross  * Use is subject to license terms.
25*40c0e231SGordon Ross  *
26*40c0e231SGordon Ross  * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
27613a2f6bSGordon Ross  */
28613a2f6bSGordon Ross 
29613a2f6bSGordon Ross #ifndef _NTLM_H
30613a2f6bSGordon Ross #define	_NTLM_H
31613a2f6bSGordon Ross 
32613a2f6bSGordon Ross /*
33613a2f6bSGordon Ross  * NTLM support functions
34613a2f6bSGordon Ross  * See ntlm.c
35613a2f6bSGordon Ross  */
36613a2f6bSGordon Ross 
37613a2f6bSGordon Ross /*
38613a2f6bSGordon Ross  * Size of all LM/NTLM hashes, challenge
39613a2f6bSGordon Ross  * NTLM_HASH_SZ: 16 bytes (see smb_lib.h)
40613a2f6bSGordon Ross  * NTLM_CHAL_SZ:  8 bytes (see smb_lib.h)
41613a2f6bSGordon Ross  */
42613a2f6bSGordon Ross #define	NTLM_V1_RESP_SZ		24	/* response size */
43613a2f6bSGordon Ross 
44613a2f6bSGordon Ross #define	NAMETYPE_EOL		0x0000	/* end of list of names */
45613a2f6bSGordon Ross #define	NAMETYPE_MACHINE_NB	0x0001	/* NetBIOS machine name */
46613a2f6bSGordon Ross #define	NAMETYPE_DOMAIN_NB	0x0002	/* NetBIOS domain name */
47613a2f6bSGordon Ross #define	NAMETYPE_MACHINE_DNS	0x0003	/* DNS machine name */
48613a2f6bSGordon Ross #define	NAMETYPE_DOMAIN_DNS	0x0004	/* DNS (AD) domain name */
49613a2f6bSGordon Ross 
50613a2f6bSGordon Ross int
51613a2f6bSGordon Ross ntlm_compute_lm_hash(uchar_t *hash, const char *pw);
52613a2f6bSGordon Ross 
53613a2f6bSGordon Ross int
54613a2f6bSGordon Ross ntlm_compute_nt_hash(uchar_t *hash, const char *pw);
55613a2f6bSGordon Ross 
56613a2f6bSGordon Ross int
57613a2f6bSGordon Ross ntlm_build_target_info(struct smb_ctx *, struct mbuf *, struct mbdata *);
58613a2f6bSGordon Ross 
59613a2f6bSGordon Ross int
60613a2f6bSGordon Ross ntlm_put_v1_responses(struct smb_ctx *ctx,
61*40c0e231SGordon Ross 	struct mbdata *lm_mbp, struct mbdata *nt_mbp,
62*40c0e231SGordon Ross 	uchar_t *ssnkey);
63613a2f6bSGordon Ross 
64613a2f6bSGordon Ross int
6585e6b674SGordon Ross ntlm_put_v1x_responses(struct smb_ctx *ctx,
66*40c0e231SGordon Ross 	struct mbdata *lm_mbp, struct mbdata *nt_mbp,
67*40c0e231SGordon Ross 	uchar_t *ssnkey);
6885e6b674SGordon Ross 
6985e6b674SGordon Ross int
70613a2f6bSGordon Ross ntlm_put_v2_responses(struct smb_ctx *ctx, struct mbdata *ti_mbp,
71*40c0e231SGordon Ross 	struct mbdata *lm_mbp, struct mbdata *nt_mbp,
72*40c0e231SGordon Ross 	uchar_t *ssnkey);
7385e6b674SGordon Ross 
7485e6b674SGordon Ross void
75*40c0e231SGordon Ross ntlm2_kxkey(struct smb_ctx *ctx, struct mbdata *lm_mbp,
76*40c0e231SGordon Ross 	uchar_t *ssn_key, uchar_t *kxkey);
7785e6b674SGordon Ross 
78613a2f6bSGordon Ross #endif /* _NTLM_H */
79