Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Utilities / cmcurl / lib / vauth / ntlm.h
1 #ifndef HEADER_VAUTH_NTLM_H
2 #define HEADER_VAUTH_NTLM_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
11  *
12  * This software is licensed as described in the file COPYING, which
13  * you should have received as part of this distribution. The terms
14  * are also available at https://curl.se/docs/copyright.html.
15  *
16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17  * copies of the Software, and permit persons to whom the Software is
18  * furnished to do so, under the terms of the COPYING file.
19  *
20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21  * KIND, either express or implied.
22  *
23  * SPDX-License-Identifier: curl
24  *
25  ***************************************************************************/
26
27 #include "curl_setup.h"
28
29 #ifdef USE_NTLM
30
31 /* NTLM buffer fixed size, large enough for long user + host + domain */
32 #define NTLM_BUFSIZE 1024
33
34 /* Stuff only required for curl_ntlm_msgs.c */
35 #ifdef BUILDING_CURL_NTLM_MSGS_C
36
37 /* Flag bits definitions based on
38    https://davenport.sourceforge.net/ntlm.html */
39
40 #define NTLMFLAG_NEGOTIATE_UNICODE               (1<<0)
41 /* Indicates that Unicode strings are supported for use in security buffer
42    data. */
43
44 #define NTLMFLAG_NEGOTIATE_OEM                   (1<<1)
45 /* Indicates that OEM strings are supported for use in security buffer data. */
46
47 #define NTLMFLAG_REQUEST_TARGET                  (1<<2)
48 /* Requests that the server's authentication realm be included in the Type 2
49    message. */
50
51 /* unknown (1<<3) */
52 #define NTLMFLAG_NEGOTIATE_SIGN                  (1<<4)
53 /* Specifies that authenticated communication between the client and server
54    should carry a digital signature (message integrity). */
55
56 #define NTLMFLAG_NEGOTIATE_SEAL                  (1<<5)
57 /* Specifies that authenticated communication between the client and server
58    should be encrypted (message confidentiality). */
59
60 #define NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE        (1<<6)
61 /* Indicates that datagram authentication is being used. */
62
63 #define NTLMFLAG_NEGOTIATE_LM_KEY                (1<<7)
64 /* Indicates that the LAN Manager session key should be used for signing and
65    sealing authenticated communications. */
66
67 #define NTLMFLAG_NEGOTIATE_NETWARE               (1<<8)
68 /* unknown purpose */
69
70 #define NTLMFLAG_NEGOTIATE_NTLM_KEY              (1<<9)
71 /* Indicates that NTLM authentication is being used. */
72
73 /* unknown (1<<10) */
74
75 #define NTLMFLAG_NEGOTIATE_ANONYMOUS             (1<<11)
76 /* Sent by the client in the Type 3 message to indicate that an anonymous
77    context has been established. This also affects the response fields. */
78
79 #define NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED       (1<<12)
80 /* Sent by the client in the Type 1 message to indicate that a desired
81    authentication realm is included in the message. */
82
83 #define NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED  (1<<13)
84 /* Sent by the client in the Type 1 message to indicate that the client
85    workstation's name is included in the message. */
86
87 #define NTLMFLAG_NEGOTIATE_LOCAL_CALL            (1<<14)
88 /* Sent by the server to indicate that the server and client are on the same
89    machine. Implies that the client may use a pre-established local security
90    context rather than responding to the challenge. */
91
92 #define NTLMFLAG_NEGOTIATE_ALWAYS_SIGN           (1<<15)
93 /* Indicates that authenticated communication between the client and server
94    should be signed with a "dummy" signature. */
95
96 #define NTLMFLAG_TARGET_TYPE_DOMAIN              (1<<16)
97 /* Sent by the server in the Type 2 message to indicate that the target
98    authentication realm is a domain. */
99
100 #define NTLMFLAG_TARGET_TYPE_SERVER              (1<<17)
101 /* Sent by the server in the Type 2 message to indicate that the target
102    authentication realm is a server. */
103
104 #define NTLMFLAG_TARGET_TYPE_SHARE               (1<<18)
105 /* Sent by the server in the Type 2 message to indicate that the target
106    authentication realm is a share. Presumably, this is for share-level
107    authentication. Usage is unclear. */
108
109 #define NTLMFLAG_NEGOTIATE_NTLM2_KEY             (1<<19)
110 /* Indicates that the NTLM2 signing and sealing scheme should be used for
111    protecting authenticated communications. */
112
113 #define NTLMFLAG_REQUEST_INIT_RESPONSE           (1<<20)
114 /* unknown purpose */
115
116 #define NTLMFLAG_REQUEST_ACCEPT_RESPONSE         (1<<21)
117 /* unknown purpose */
118
119 #define NTLMFLAG_REQUEST_NONNT_SESSION_KEY       (1<<22)
120 /* unknown purpose */
121
122 #define NTLMFLAG_NEGOTIATE_TARGET_INFO           (1<<23)
123 /* Sent by the server in the Type 2 message to indicate that it is including a
124    Target Information block in the message. */
125
126 /* unknown (1<24) */
127 /* unknown (1<25) */
128 /* unknown (1<26) */
129 /* unknown (1<27) */
130 /* unknown (1<28) */
131
132 #define NTLMFLAG_NEGOTIATE_128                   (1<<29)
133 /* Indicates that 128-bit encryption is supported. */
134
135 #define NTLMFLAG_NEGOTIATE_KEY_EXCHANGE          (1<<30)
136 /* Indicates that the client will provide an encrypted master key in
137    the "Session Key" field of the Type 3 message. */
138
139 #define NTLMFLAG_NEGOTIATE_56                    (1<<31)
140 /* Indicates that 56-bit encryption is supported. */
141
142 #endif /* BUILDING_CURL_NTLM_MSGS_C */
143
144 #endif /* USE_NTLM */
145
146 #endif /* HEADER_VAUTH_NTLM_H */