113498266Sopenharmony_ci#ifndef HEADER_VAUTH_NTLM_H
213498266Sopenharmony_ci#define HEADER_VAUTH_NTLM_H
313498266Sopenharmony_ci/***************************************************************************
413498266Sopenharmony_ci *                                  _   _ ____  _
513498266Sopenharmony_ci *  Project                     ___| | | |  _ \| |
613498266Sopenharmony_ci *                             / __| | | | |_) | |
713498266Sopenharmony_ci *                            | (__| |_| |  _ <| |___
813498266Sopenharmony_ci *                             \___|\___/|_| \_\_____|
913498266Sopenharmony_ci *
1013498266Sopenharmony_ci * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
1113498266Sopenharmony_ci *
1213498266Sopenharmony_ci * This software is licensed as described in the file COPYING, which
1313498266Sopenharmony_ci * you should have received as part of this distribution. The terms
1413498266Sopenharmony_ci * are also available at https://curl.se/docs/copyright.html.
1513498266Sopenharmony_ci *
1613498266Sopenharmony_ci * You may opt to use, copy, modify, merge, publish, distribute and/or sell
1713498266Sopenharmony_ci * copies of the Software, and permit persons to whom the Software is
1813498266Sopenharmony_ci * furnished to do so, under the terms of the COPYING file.
1913498266Sopenharmony_ci *
2013498266Sopenharmony_ci * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
2113498266Sopenharmony_ci * KIND, either express or implied.
2213498266Sopenharmony_ci *
2313498266Sopenharmony_ci * SPDX-License-Identifier: curl
2413498266Sopenharmony_ci *
2513498266Sopenharmony_ci ***************************************************************************/
2613498266Sopenharmony_ci
2713498266Sopenharmony_ci#include "curl_setup.h"
2813498266Sopenharmony_ci
2913498266Sopenharmony_ci#ifdef USE_NTLM
3013498266Sopenharmony_ci
3113498266Sopenharmony_ci/* NTLM buffer fixed size, large enough for long user + host + domain */
3213498266Sopenharmony_ci#define NTLM_BUFSIZE 1024
3313498266Sopenharmony_ci
3413498266Sopenharmony_ci/* Stuff only required for curl_ntlm_msgs.c */
3513498266Sopenharmony_ci#ifdef BUILDING_CURL_NTLM_MSGS_C
3613498266Sopenharmony_ci
3713498266Sopenharmony_ci/* Flag bits definitions based on
3813498266Sopenharmony_ci   https://davenport.sourceforge.net/ntlm.html */
3913498266Sopenharmony_ci
4013498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_UNICODE               (1<<0)
4113498266Sopenharmony_ci/* Indicates that Unicode strings are supported for use in security buffer
4213498266Sopenharmony_ci   data. */
4313498266Sopenharmony_ci
4413498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_OEM                   (1<<1)
4513498266Sopenharmony_ci/* Indicates that OEM strings are supported for use in security buffer data. */
4613498266Sopenharmony_ci
4713498266Sopenharmony_ci#define NTLMFLAG_REQUEST_TARGET                  (1<<2)
4813498266Sopenharmony_ci/* Requests that the server's authentication realm be included in the Type 2
4913498266Sopenharmony_ci   message. */
5013498266Sopenharmony_ci
5113498266Sopenharmony_ci/* unknown (1<<3) */
5213498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_SIGN                  (1<<4)
5313498266Sopenharmony_ci/* Specifies that authenticated communication between the client and server
5413498266Sopenharmony_ci   should carry a digital signature (message integrity). */
5513498266Sopenharmony_ci
5613498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_SEAL                  (1<<5)
5713498266Sopenharmony_ci/* Specifies that authenticated communication between the client and server
5813498266Sopenharmony_ci   should be encrypted (message confidentiality). */
5913498266Sopenharmony_ci
6013498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE        (1<<6)
6113498266Sopenharmony_ci/* Indicates that datagram authentication is being used. */
6213498266Sopenharmony_ci
6313498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_LM_KEY                (1<<7)
6413498266Sopenharmony_ci/* Indicates that the LAN Manager session key should be used for signing and
6513498266Sopenharmony_ci   sealing authenticated communications. */
6613498266Sopenharmony_ci
6713498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_NTLM_KEY              (1<<9)
6813498266Sopenharmony_ci/* Indicates that NTLM authentication is being used. */
6913498266Sopenharmony_ci
7013498266Sopenharmony_ci/* unknown (1<<10) */
7113498266Sopenharmony_ci
7213498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_ANONYMOUS             (1<<11)
7313498266Sopenharmony_ci/* Sent by the client in the Type 3 message to indicate that an anonymous
7413498266Sopenharmony_ci   context has been established. This also affects the response fields. */
7513498266Sopenharmony_ci
7613498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED       (1<<12)
7713498266Sopenharmony_ci/* Sent by the client in the Type 1 message to indicate that a desired
7813498266Sopenharmony_ci   authentication realm is included in the message. */
7913498266Sopenharmony_ci
8013498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED  (1<<13)
8113498266Sopenharmony_ci/* Sent by the client in the Type 1 message to indicate that the client
8213498266Sopenharmony_ci   workstation's name is included in the message. */
8313498266Sopenharmony_ci
8413498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_LOCAL_CALL            (1<<14)
8513498266Sopenharmony_ci/* Sent by the server to indicate that the server and client are on the same
8613498266Sopenharmony_ci   machine. Implies that the client may use a pre-established local security
8713498266Sopenharmony_ci   context rather than responding to the challenge. */
8813498266Sopenharmony_ci
8913498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_ALWAYS_SIGN           (1<<15)
9013498266Sopenharmony_ci/* Indicates that authenticated communication between the client and server
9113498266Sopenharmony_ci   should be signed with a "dummy" signature. */
9213498266Sopenharmony_ci
9313498266Sopenharmony_ci#define NTLMFLAG_TARGET_TYPE_DOMAIN              (1<<16)
9413498266Sopenharmony_ci/* Sent by the server in the Type 2 message to indicate that the target
9513498266Sopenharmony_ci   authentication realm is a domain. */
9613498266Sopenharmony_ci
9713498266Sopenharmony_ci#define NTLMFLAG_TARGET_TYPE_SERVER              (1<<17)
9813498266Sopenharmony_ci/* Sent by the server in the Type 2 message to indicate that the target
9913498266Sopenharmony_ci   authentication realm is a server. */
10013498266Sopenharmony_ci
10113498266Sopenharmony_ci#define NTLMFLAG_TARGET_TYPE_SHARE               (1<<18)
10213498266Sopenharmony_ci/* Sent by the server in the Type 2 message to indicate that the target
10313498266Sopenharmony_ci   authentication realm is a share. Presumably, this is for share-level
10413498266Sopenharmony_ci   authentication. Usage is unclear. */
10513498266Sopenharmony_ci
10613498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_NTLM2_KEY             (1<<19)
10713498266Sopenharmony_ci/* Indicates that the NTLM2 signing and sealing scheme should be used for
10813498266Sopenharmony_ci   protecting authenticated communications. */
10913498266Sopenharmony_ci
11013498266Sopenharmony_ci#define NTLMFLAG_REQUEST_INIT_RESPONSE           (1<<20)
11113498266Sopenharmony_ci/* unknown purpose */
11213498266Sopenharmony_ci
11313498266Sopenharmony_ci#define NTLMFLAG_REQUEST_ACCEPT_RESPONSE         (1<<21)
11413498266Sopenharmony_ci/* unknown purpose */
11513498266Sopenharmony_ci
11613498266Sopenharmony_ci#define NTLMFLAG_REQUEST_NONNT_SESSION_KEY       (1<<22)
11713498266Sopenharmony_ci/* unknown purpose */
11813498266Sopenharmony_ci
11913498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_TARGET_INFO           (1<<23)
12013498266Sopenharmony_ci/* Sent by the server in the Type 2 message to indicate that it is including a
12113498266Sopenharmony_ci   Target Information block in the message. */
12213498266Sopenharmony_ci
12313498266Sopenharmony_ci/* unknown (1<24) */
12413498266Sopenharmony_ci/* unknown (1<25) */
12513498266Sopenharmony_ci/* unknown (1<26) */
12613498266Sopenharmony_ci/* unknown (1<27) */
12713498266Sopenharmony_ci/* unknown (1<28) */
12813498266Sopenharmony_ci
12913498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_128                   (1<<29)
13013498266Sopenharmony_ci/* Indicates that 128-bit encryption is supported. */
13113498266Sopenharmony_ci
13213498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_KEY_EXCHANGE          (1<<30)
13313498266Sopenharmony_ci/* Indicates that the client will provide an encrypted master key in
13413498266Sopenharmony_ci   the "Session Key" field of the Type 3 message. */
13513498266Sopenharmony_ci
13613498266Sopenharmony_ci#define NTLMFLAG_NEGOTIATE_56                    (1<<31)
13713498266Sopenharmony_ci/* Indicates that 56-bit encryption is supported. */
13813498266Sopenharmony_ci
13913498266Sopenharmony_ci#endif /* BUILDING_CURL_NTLM_MSGS_C */
14013498266Sopenharmony_ci
14113498266Sopenharmony_ci#endif /* USE_NTLM */
14213498266Sopenharmony_ci
14313498266Sopenharmony_ci#endif /* HEADER_VAUTH_NTLM_H */
144