mfreadwrite/reader: Only attempt to copy sample buffers from responses with non-NULL...
[wine.git] / include / schannel.h
blob3aa85832fd34b9b38e150eeed942340bcd6d754c
1 /*
2 * Copyright (C) 2005 Juan Lang
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 #ifndef __WINE_SCHANNEL_H__
19 #define __WINE_SCHANNEL_H__
21 #include <minschannel.h>
22 #include <wincrypt.h>
24 /* Package names */
25 #define UNISP_NAME_A "Microsoft Unified Security Protocol Provider"
26 #if defined(_MSC_VER) || defined(__MINGW32__)
27 #define UNISP_NAME_W L"Microsoft Unified Security Protocol Provider"
28 #else
29 static const WCHAR UNISP_NAME_W[] = { 'M','i','c','r','o','s','o','f','t',
30 ' ','U','n','i','f','i','e','d',' ','S','e','c','u','r','i','t','y',' ',
31 'P','r','o','t','o','c','o','l',' ','P','r','o','v','i','d','e','r',0 };
32 #endif
33 #define UNISP_NAME WINELIB_NAME_AW(UNISP_NAME_)
35 #define SSL2SP_NAME_A "Microsoft SSL 2.0"
36 #if defined(_MSC_VER) || defined(__MINGW32__)
37 #define SSL2SP_NAME_W L"Microsoft SSL 2.0"
38 #else
39 static const WCHAR SSL2SP_NAME_W[] = { 'M','i','c','r','o','s','o','f','t',
40 ' ','S','S','L',' ','2','.','0',0 };
41 #endif
42 #define SSL2SP_NAME WINELIB_NAME_AW(SSL2SP_NAME_)
44 #define SSL3SP_NAME_A "Microsoft SSL 3.0"
45 #if defined(_MSC_VER) || defined(__MINGW32__)
46 #define SSL3SP_NAME_W L"Microsoft SSL 3.0"
47 #else
48 static const WCHAR SSL3SP_NAME_W[] = { 'M','i','c','r','o','s','o','f','t',
49 ' ','S','S','L',' ','3','.','0',0 };
50 #endif
51 #define SSL3SP_NAME WINELIB_NAME_AW(SSL3SP_NAME_)
53 #define TLS1SP_NAME_A "Microsoft TLS 1.0"
54 #if defined(_MSC_VER) || defined(__MINGW32__)
55 #define TLS1SP_NAME_W L"Microsoft TLS 1.0"
56 #else
57 static const WCHAR TLS1SP_NAME_W[] = { 'M','i','c','r','o','s','o','f','t',
58 ' ','T','L','S',' ','1','.','0',0 };
59 #endif
60 #define TLS1SP_NAME WINELIB_NAME_AW(TLS1SP_NAME_)
62 #define PCT1SP_NAME_A "Microsoft PCT 1.0"
63 #if defined(_MSC_VER) || defined(__MINGW32__)
64 #define PCT1SP_NAME_W L"Microsoft PCT 1.0"
65 #else
66 static const WCHAR PCT1SP_NAME_W[] = { 'M','i','c','r','o','s','o','f','t',
67 ' ','P','C','T',' ','1','.','0',0 };
68 #endif
69 #define PCT1SP_NAME WINELIB_NAME_AW(PCT1SP_NAME_)
71 #define SCHANNEL_NAME_A "Schannel"
72 #if defined(_MSC_VER) || defined(__MINGW32__)
73 #define SCHANNEL_NAME_W L"Schannel"
74 #else
75 static const WCHAR SCHANNEL_NAME_W[] = { 'S','c','h','a','n','n','e','l',0 };
76 #endif
77 #define SCHANNEL_NAME WINELIB_NAME_AW(SCHANNEL_NAME_)
79 #define SCH_CRED_V1 1
80 #define SCH_CRED_V2 2
81 #define SCH_CRED_VERSION 2
82 #define SCH_CRED_V3 3
83 #define SCHANNEL_CRED_VERSION 4
84 #define SCH_CREDENTIALS_VERSION 5
86 #define SCHANNEL_RENEGOTIATE 0
87 #define SCHANNEL_SHUTDOWN 1
88 #define SCHANNEL_ALERT 2
89 #define SCHANNEL_SESSION 3
91 #define SP_PROT_ALL 0xffffffff
92 #define SP_PROT_UNI_CLIENT 0x80000000
93 #define SP_PROT_UNI_SERVER 0x40000000
94 #define SP_PROT_DTLS1_2_SERVER 0x00040000
95 #define SP_PROT_DTLS1_2_CLIENT 0x00080000
96 #define SP_PROT_DTLS_SERVER 0x00010000
97 #define SP_PROT_DTLS_CLIENT 0x00020000
98 #define SP_PROT_DTLS1_0_SERVER SP_PROT_DTLS_SERVER
99 #define SP_PROT_DTLS1_0_CLIENT SP_PROT_DTLS_CLIENT
100 #define SP_PROT_TLS1_3_SERVER 0x00001000
101 #define SP_PROT_TLS1_3_CLIENT 0x00002000
102 #define SP_PROT_TLS1_2_CLIENT 0x00000800
103 #define SP_PROT_TLS1_2_SERVER 0x00000400
104 #define SP_PROT_TLS1_1_CLIENT 0x00000200
105 #define SP_PROT_TLS1_1_SERVER 0x00000100
106 #define SP_PROT_TLS1_0_CLIENT SP_PROT_TLS1_CLIENT
107 #define SP_PROT_TLS1_0_SERVER SP_PROT_TLS1_SERVER
108 #define SP_PROT_TLS1_CLIENT 0x00000080
109 #define SP_PROT_TLS1_SERVER 0x00000040
110 #define SP_PROT_SSL3_CLIENT 0x00000020
111 #define SP_PROT_SSL3_SERVER 0x00000010
112 #define SP_PROT_SSL2_CLIENT 0x00000008
113 #define SP_PROT_SSL2_SERVER 0x00000004
114 #define SP_PROT_PCT1_CLIENT 0x00000002
115 #define SP_PROT_PCT1_SERVER 0x00000001
116 #define SP_PROT_NONE 0x00000000
118 #define SP_PROT_UNI (SP_PROT_UNI_CLIENT | SP_PROT_UNI_SERVER)
119 #define SP_PROT_DTLS (SP_PROT_DTLS_SERVER | SP_PROT_DTLS_CLIENT)
120 #define SP_PROT_DTLS1_0 (SP_PROT_DTLS1_0_SERVER | SP_PROT_DTLS1_0_CLIENT)
121 #define SP_PROT_DTLS1_2 (SP_PROT_DTLS1_2_SERVER | SP_PROT_DTLS1_2_CLIENT)
122 #define SP_PROT_TLS1_3 (SP_PROT_TLS1_3_CLIENT | SP_PROT_TLS1_3_SERVER)
123 #define SP_PROT_TLS1_2 (SP_PROT_TLS1_2_CLIENT | SP_PROT_TLS1_2_SERVER)
124 #define SP_PROT_TLS1_1 (SP_PROT_TLS1_1_CLIENT | SP_PROT_TLS1_1_SERVER)
125 #define SP_PROT_TLS1_0 (SP_PROT_TLS1_0_CLIENT | SP_PROT_TLS1_0_SERVER)
126 #define SP_PROT_TLS1 (SP_PROT_TLS1_CLIENT | SP_PROT_TLS1_SERVER)
127 #define SP_PROT_SSL3 (SP_PROT_SSL3_CLIENT | SP_PROT_SSL3_SERVER)
128 #define SP_PROT_SSL2 (SP_PROT_SSL2_CLIENT | SP_PROT_SSL2_SERVER)
129 #define SP_PROT_PCT1 (SP_PROT_PCT1_CLIENT | SP_PROT_PCT1_SERVER)
131 #define SP_PROT_SSL3TLS1_CLIENTS (SP_PROT_SSL3_CLIENT | SP_PROT_TLS1_CLIENT)
132 #define SP_PROT_SSL3TLS1_SERVERS (SP_PROT_SSL3_SERVER | SP_PROT_TLS1_SERVER)
133 #define SP_PROT_SSL3TLS1_X_CLIENTS (SP_PROT_SSL3_CLIENT | SP_PROT_TLS1_X_CLIENT)
134 #define SP_PROT_SSL3TLS1_X_SERVERS (SP_PROT_SSL3_SERVER | SP_PROT_TLS1_X_SERVER)
135 #define SP_PROT_TLS1_X_CLIENT ( SP_PROT_TLS1_0_CLIENT \
136 | SP_PROT_TLS1_1_CLIENT \
137 | SP_PROT_TLS1_2_CLIENT \
138 | SP_PROT_TLS1_3_CLIENT )
139 #define SP_PROT_TLS1_X_SERVER ( SP_PROT_TLS1_0_SERVER \
140 | SP_PROT_TLS1_1_SERVER \
141 | SP_PROT_TLS1_2_SERVER \
142 | SP_PROT_TLS1_3_SERVER )
143 #define SP_PROT_TLS1_1PLUS_CLIENT ( SP_PROT_TLS1_1_CLIENT \
144 | SP_PROT_TLS1_2_CLIENT \
145 | SP_PROT_TLS1_3_CLIENT)
146 #define SP_PROT_TLS1_1PLUS_SERVER ( SP_PROT_TLS1_1_SERVER \
147 | SP_PROT_TLS1_2_SERVER \
148 | SP_PROT_TLS1_3_SERVER )
149 #define SP_PROT_DTLS1_X_SERVER ( SP_PROT_DTLS1_0_SERVER \
150 | SP_PROT_DTLS1_2_SERVER )
151 #define SP_PROT_DTLS1_X_CLIENT ( SP_PROT_DTLS1_0_CLIENT \
152 | SP_PROT_DTLS1_2_CLIENT )
153 #define SP_PROT_DTLS1_X ( SP_PROT_DTLS1_X_SERVER \
154 | SP_PROT_DTLS1_X_CLIENT )
155 #define SP_PROT_CLIENTS (SP_PROT_PCT1_CLIENT | SP_PROT_SSL2_CLIENT | SP_PROT_SSL3_CLIENT \
156 | SP_PROT_TLS1_CLIENT | SP_PROT_UNI_CLIENT)
157 #define SP_PROT_SERVERS (SP_PROT_PCT1_SERVER | SP_PROT_SSL2_SERVER | SP_PROT_SSL3_SERVER \
158 | SP_PROT_TLS1_SERVER | SP_PROT_UNI_SERVER)
159 #define SP_PROT_X_CLIENTS ( SP_PROT_CLIENTS \
160 | SP_PROT_TLS1_X_CLIENT \
161 | SP_PROT_DTLS1_X_CLIENT)
162 #define SP_PROT_X_SERVERS ( SP_PROT_SERVERS \
163 | SP_PROT_TLS1_X_SERVER \
164 | SP_PROT_DTLS1_X_SERVER)
166 #define SP_PROT_SSL3TLS1 (SP_PROT_SSL3 | SP_PROT_TLS1)
167 #define SP_PROT_SSL3TLS1_X (SP_PROT_SSL3 | SP_PROT_TLS1_X)
168 #define SP_PROT_TLS1_X (SP_PROT_TLS1_X_CLIENT | SP_PROT_TLS1_X_SERVER)
169 #define SP_PROT_TLS1_1PLUS (SP_PROT_TLS1_1PLUS_CLIENT | SP_PROT_TLS1_1PLUS_SERVER)
171 #define SCH_CRED_NO_SYSTEM_MAPPER 2
172 #define SCH_CRED_NO_SERVERNAME_CHECK 4
173 #define SCH_CRED_MANUAL_CRED_VALIDATION 8
174 #define SCH_CRED_NO_DEFAULT_CREDS 16
175 #define SCH_CRED_AUTO_CRED_VALIDATION 32
176 #define SCH_CRED_USE_DEFAULT_CREDS 64
177 #define SCH_CRED_REVOCATION_CHECK_CHAIN_END_CERT 256
178 #define SCH_CRED_REVOCATION_CHECK_CHAIN 512
179 #define SCH_CRED_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT 1024
180 #define SCH_CRED_IGNORE_NO_REVOCATION_CHECK 2048
181 #define SCH_CRED_IGNORE_REVOCATION_OFFLINE 4096
183 #define UNISP_RPC_ID 14
185 struct _HMAPPER;
187 typedef struct _SCHANNEL_CRED
189 DWORD dwVersion;
190 DWORD cCreds;
191 PCCERT_CONTEXT *paCred;
192 HCERTSTORE hRootStore;
193 DWORD cMappers;
194 struct _HMAPPER **aphMappers;
195 DWORD cSupportedAlgs;
196 ALG_ID *palgSupportedAlgs;
197 DWORD grbitEnabledProtocols;
198 DWORD dwMinimumCipherStrength;
199 DWORD dwMaximumCipherStrength;
200 DWORD dwSessionLifespan;
201 DWORD dwFlags;
202 DWORD dwCredFormat;
203 } SCHANNEL_CRED, *PSCHANNEL_CRED;
205 #ifdef SCHANNEL_USE_BLACKLISTS
207 typedef enum _eTlsAlgorithmUsage
209 TlsParametersCngAlgUsageKeyExchange,
210 TlsParametersCngAlgUsageSignature,
211 TlsParametersCngAlgUsageCipher,
212 TlsParametersCngAlgUsageDigest,
213 TlsParametersCngAlgUsageCertSig,
214 } eTlsAlgorithmUsage;
216 typedef struct _CRYPTO_SETTINGS
218 eTlsAlgorithmUsage eAlgorithmUsage;
219 UNICODE_STRING strCngAlgId;
220 DWORD cChainingModes;
221 PUNICODE_STRING rgstrChainingModes;
222 DWORD dwMinBitLength;
223 DWORD dwMaxBitLength;
224 } CRYPTO_SETTINGS, *PCRYPTO_SETTINGS;
226 typedef struct _TLS_PARAMETERS
228 DWORD cAlpnIds;
229 PUNICODE_STRING rgstrAlpnIds;
230 DWORD grbitDisabledProtocols;
231 DWORD cDisabledCrypto;
232 PCRYPTO_SETTINGS pDisabledCrypto;
233 DWORD dwFlags;
234 } TLS_PARAMETERS, *PTLS_PARAMETERS;
236 typedef struct _SCH_CREDENTIALS
238 DWORD dwVersion;
239 DWORD dwCredFormat;
240 DWORD cCreds;
241 PCCERT_CONTEXT *paCred;
242 HCERTSTORE hRootStore;
243 DWORD cMappers;
244 struct _HMAPPER **aphMappers;
245 DWORD dwSessionLifespan;
246 DWORD dwFlags;
247 DWORD cTlsParameters;
248 PTLS_PARAMETERS pTlsParameters;
249 } SCH_CREDENTIALS, *PSCH_CREDENTIALS;
251 #endif
253 typedef struct _SecPkgCred_SupportedAlgs
255 DWORD cSupportedAlgs;
256 ALG_ID *palgSupportedAlgs;
257 } SecPkgCred_SupportedAlgs, *PSecPkgCred_SupportedAlgs;
259 typedef struct _SecPkgCred_CipherStrengths
261 DWORD dwMinimumCipherStrength;
262 DWORD dwMaximumCipherStrength;
263 } SecPkgCred_CipherStrengths, *PSecPkgCred_CipherStrengths;
265 typedef struct _SecPkgCred_SupportedProtocols
267 DWORD grbitProtocol;
268 } SecPkgCred_SupportedProtocols, *PSecPkgCred_SupportedProtocols;
270 typedef struct _SecPkgContext_IssuerListInfoEx
272 PCERT_NAME_BLOB aIssuers;
273 DWORD cIssuers;
274 } SecPkgContext_IssuerListInfoEx, *PSecPkgContext_IssuerListInfoEx;
276 typedef struct _SecPkgContext_ConnectionInfo
278 DWORD dwProtocol;
279 ALG_ID aiCipher;
280 DWORD dwCipherStrength;
281 ALG_ID aiHash;
282 DWORD dwHashStrength;
283 ALG_ID aiExch;
284 DWORD dwExchStrength;
285 } SecPkgContext_ConnectionInfo, *PSecPkgContext_ConnectionInfo;
287 #define SECPKGCONTEXT_CIPHERINFO_V1 1
288 #define SZ_ALG_MAX_SIZE 64
290 typedef struct _SecPkgContext_CipherInfo
292 DWORD dwVersion;
293 DWORD dwProtocol;
294 DWORD dwCipherSuite;
295 DWORD dwBaseCipherSuite;
296 WCHAR szCipherSuite[SZ_ALG_MAX_SIZE];
297 WCHAR szCipher[SZ_ALG_MAX_SIZE];
298 DWORD dwCipherLen;
299 DWORD dwCipherBlockLen;
300 WCHAR szHash[SZ_ALG_MAX_SIZE];
301 DWORD dwHashLen;
302 WCHAR szExchange[SZ_ALG_MAX_SIZE];
303 DWORD dwMinExchangeLen;
304 DWORD dwMaxExchangeLen;
305 WCHAR szCertificate[SZ_ALG_MAX_SIZE];
306 DWORD dwKeyType;
307 } SecPkgContext_CipherInfo, *PSecPkgContext_CipherInfo;
309 #endif /* __WINE_SCHANNEL_H__ */