NTLM_WB: move NTLM_WB specifics into curl_ntlm_wb.[ch]
[platform/upstream/curl.git] / lib / curl_ntlm.h
1 #ifndef HEADER_CURL_NTLM_H
2 #define HEADER_CURL_NTLM_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2011, 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 http://curl.haxx.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  ***************************************************************************/
24
25 #ifdef USE_NTLM
26
27 /* This is to generate a base64 encoded NTLM type-1 message */
28 CURLcode Curl_ntlm_create_type1_message(const char *userp,
29                                         const char *passwdp,
30                                         struct ntlmdata *ntlm,
31                                         char **outptr);
32
33 /* This is to generate a base64 encoded NTLM type-3 message */
34 CURLcode Curl_ntlm_create_type3_message(struct SessionHandle *data,
35                                         const char *userp,
36                                         const char *passwdp,
37                                         struct ntlmdata *ntlm,
38                                         char **outptr);
39
40 /* This is to decode a NTLM type-2 message */
41 CURLcode Curl_ntlm_decode_type2_message(struct SessionHandle *data,
42                                         const char* header,
43                                         struct ntlmdata* ntlm);
44
45 /* This is to clean up the ntlm data structure */
46 #ifdef USE_WINDOWS_SSPI
47 void Curl_ntlm_sspi_cleanup(struct ntlmdata *ntlm);
48 #endif
49
50 /* NTLM buffer fixed size, large enough for long user + host + domain */
51 #define NTLM_BUFSIZE 1024
52
53 /* Stuff only required for curl_ntlm.c */
54 #ifdef BUILDING_CURL_NTLM_C
55
56 /* Flag bits definitions based on http://davenport.sourceforge.net/ntlm.html */
57
58 #define NTLMFLAG_NEGOTIATE_UNICODE               (1<<0)
59 /* Indicates that Unicode strings are supported for use in security buffer
60    data. */
61
62 #define NTLMFLAG_NEGOTIATE_OEM                   (1<<1)
63 /* Indicates that OEM strings are supported for use in security buffer data. */
64
65 #define NTLMFLAG_REQUEST_TARGET                  (1<<2)
66 /* Requests that the server's authentication realm be included in the Type 2
67    message. */
68
69 /* unknown (1<<3) */
70 #define NTLMFLAG_NEGOTIATE_SIGN                  (1<<4)
71 /* Specifies that authenticated communication between the client and server
72    should carry a digital signature (message integrity). */
73
74 #define NTLMFLAG_NEGOTIATE_SEAL                  (1<<5)
75 /* Specifies that authenticated communication between the client and server
76    should be encrypted (message confidentiality). */
77
78 #define NTLMFLAG_NEGOTIATE_DATAGRAM_STYLE        (1<<6)
79 /* Indicates that datagram authentication is being used. */
80
81 #define NTLMFLAG_NEGOTIATE_LM_KEY                (1<<7)
82 /* Indicates that the LAN Manager session key should be used for signing and
83    sealing authenticated communications. */
84
85 #define NTLMFLAG_NEGOTIATE_NETWARE               (1<<8)
86 /* unknown purpose */
87
88 #define NTLMFLAG_NEGOTIATE_NTLM_KEY              (1<<9)
89 /* Indicates that NTLM authentication is being used. */
90
91 /* unknown (1<<10) */
92
93 #define NTLMFLAG_NEGOTIATE_ANONYMOUS             (1<<11)
94 /* Sent by the client in the Type 3 message to indicate that an anonymous
95    context has been established. This also affects the response fields. */
96
97 #define NTLMFLAG_NEGOTIATE_DOMAIN_SUPPLIED       (1<<12)
98 /* Sent by the client in the Type 1 message to indicate that a desired
99    authentication realm is included in the message. */
100
101 #define NTLMFLAG_NEGOTIATE_WORKSTATION_SUPPLIED  (1<<13)
102 /* Sent by the client in the Type 1 message to indicate that the client
103    workstation's name is included in the message. */
104
105 #define NTLMFLAG_NEGOTIATE_LOCAL_CALL            (1<<14)
106 /* Sent by the server to indicate that the server and client are on the same
107    machine. Implies that the client may use a pre-established local security
108    context rather than responding to the challenge. */
109
110 #define NTLMFLAG_NEGOTIATE_ALWAYS_SIGN           (1<<15)
111 /* Indicates that authenticated communication between the client and server
112    should be signed with a "dummy" signature. */
113
114 #define NTLMFLAG_TARGET_TYPE_DOMAIN              (1<<16)
115 /* Sent by the server in the Type 2 message to indicate that the target
116    authentication realm is a domain. */
117
118 #define NTLMFLAG_TARGET_TYPE_SERVER              (1<<17)
119 /* Sent by the server in the Type 2 message to indicate that the target
120    authentication realm is a server. */
121
122 #define NTLMFLAG_TARGET_TYPE_SHARE               (1<<18)
123 /* Sent by the server in the Type 2 message to indicate that the target
124    authentication realm is a share. Presumably, this is for share-level
125    authentication. Usage is unclear. */
126
127 #define NTLMFLAG_NEGOTIATE_NTLM2_KEY             (1<<19)
128 /* Indicates that the NTLM2 signing and sealing scheme should be used for
129    protecting authenticated communications. */
130
131 #define NTLMFLAG_REQUEST_INIT_RESPONSE           (1<<20)
132 /* unknown purpose */
133
134 #define NTLMFLAG_REQUEST_ACCEPT_RESPONSE         (1<<21)
135 /* unknown purpose */
136
137 #define NTLMFLAG_REQUEST_NONNT_SESSION_KEY       (1<<22)
138 /* unknown purpose */
139
140 #define NTLMFLAG_NEGOTIATE_TARGET_INFO           (1<<23)
141 /* Sent by the server in the Type 2 message to indicate that it is including a
142    Target Information block in the message. */
143
144 /* unknown (1<24) */
145 /* unknown (1<25) */
146 /* unknown (1<26) */
147 /* unknown (1<27) */
148 /* unknown (1<28) */
149
150 #define NTLMFLAG_NEGOTIATE_128                   (1<<29)
151 /* Indicates that 128-bit encryption is supported. */
152
153 #define NTLMFLAG_NEGOTIATE_KEY_EXCHANGE          (1<<30)
154 /* Indicates that the client will provide an encrypted master key in
155    the "Session Key" field of the Type 3 message. */
156
157 #define NTLMFLAG_NEGOTIATE_56                    (1<<31)
158 /* Indicates that 56-bit encryption is supported. */
159
160 #endif /* BUILDING_CURL_NTLM_C */
161
162 #endif /* USE_NTLM */
163
164 #endif /* HEADER_CURL_NTLM_H */