113498266Sopenharmony_ci#ifndef HEADER_CURL_SSPI_H 213498266Sopenharmony_ci#define HEADER_CURL_SSPI_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_WINDOWS_SSPI 3013498266Sopenharmony_ci 3113498266Sopenharmony_ci#include <curl/curl.h> 3213498266Sopenharmony_ci 3313498266Sopenharmony_ci/* 3413498266Sopenharmony_ci * When including the following three headers, it is mandatory to define either 3513498266Sopenharmony_ci * SECURITY_WIN32 or SECURITY_KERNEL, indicating who is compiling the code. 3613498266Sopenharmony_ci */ 3713498266Sopenharmony_ci 3813498266Sopenharmony_ci#undef SECURITY_WIN32 3913498266Sopenharmony_ci#undef SECURITY_KERNEL 4013498266Sopenharmony_ci#define SECURITY_WIN32 1 4113498266Sopenharmony_ci#include <security.h> 4213498266Sopenharmony_ci#include <sspi.h> 4313498266Sopenharmony_ci#include <rpc.h> 4413498266Sopenharmony_ci 4513498266Sopenharmony_ciCURLcode Curl_sspi_global_init(void); 4613498266Sopenharmony_civoid Curl_sspi_global_cleanup(void); 4713498266Sopenharmony_ci 4813498266Sopenharmony_ci/* This is used to populate the domain in a SSPI identity structure */ 4913498266Sopenharmony_ciCURLcode Curl_override_sspi_http_realm(const char *chlg, 5013498266Sopenharmony_ci SEC_WINNT_AUTH_IDENTITY *identity); 5113498266Sopenharmony_ci 5213498266Sopenharmony_ci/* This is used to generate an SSPI identity structure */ 5313498266Sopenharmony_ciCURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp, 5413498266Sopenharmony_ci SEC_WINNT_AUTH_IDENTITY *identity); 5513498266Sopenharmony_ci 5613498266Sopenharmony_ci/* This is used to free an SSPI identity structure */ 5713498266Sopenharmony_civoid Curl_sspi_free_identity(SEC_WINNT_AUTH_IDENTITY *identity); 5813498266Sopenharmony_ci 5913498266Sopenharmony_ci/* Forward-declaration of global variables defined in curl_sspi.c */ 6013498266Sopenharmony_ciextern HMODULE s_hSecDll; 6113498266Sopenharmony_ciextern PSecurityFunctionTable s_pSecFn; 6213498266Sopenharmony_ci 6313498266Sopenharmony_ci/* Provide some definitions missing in old headers */ 6413498266Sopenharmony_ci#define SP_NAME_DIGEST "WDigest" 6513498266Sopenharmony_ci#define SP_NAME_NTLM "NTLM" 6613498266Sopenharmony_ci#define SP_NAME_NEGOTIATE "Negotiate" 6713498266Sopenharmony_ci#define SP_NAME_KERBEROS "Kerberos" 6813498266Sopenharmony_ci 6913498266Sopenharmony_ci#ifndef ISC_REQ_USE_HTTP_STYLE 7013498266Sopenharmony_ci#define ISC_REQ_USE_HTTP_STYLE 0x01000000 7113498266Sopenharmony_ci#endif 7213498266Sopenharmony_ci 7313498266Sopenharmony_ci#ifndef SEC_E_INVALID_PARAMETER 7413498266Sopenharmony_ci# define SEC_E_INVALID_PARAMETER ((HRESULT)0x8009035DL) 7513498266Sopenharmony_ci#endif 7613498266Sopenharmony_ci#ifndef SEC_E_DELEGATION_POLICY 7713498266Sopenharmony_ci# define SEC_E_DELEGATION_POLICY ((HRESULT)0x8009035EL) 7813498266Sopenharmony_ci#endif 7913498266Sopenharmony_ci#ifndef SEC_E_POLICY_NLTM_ONLY 8013498266Sopenharmony_ci# define SEC_E_POLICY_NLTM_ONLY ((HRESULT)0x8009035FL) 8113498266Sopenharmony_ci#endif 8213498266Sopenharmony_ci 8313498266Sopenharmony_ci#ifndef SEC_I_SIGNATURE_NEEDED 8413498266Sopenharmony_ci# define SEC_I_SIGNATURE_NEEDED ((HRESULT)0x0009035CL) 8513498266Sopenharmony_ci#endif 8613498266Sopenharmony_ci 8713498266Sopenharmony_ci#ifndef CRYPT_E_REVOKED 8813498266Sopenharmony_ci# define CRYPT_E_REVOKED ((HRESULT)0x80092010L) 8913498266Sopenharmony_ci#endif 9013498266Sopenharmony_ci 9113498266Sopenharmony_ci#ifndef CRYPT_E_NO_REVOCATION_DLL 9213498266Sopenharmony_ci# define CRYPT_E_NO_REVOCATION_DLL ((HRESULT)0x80092011L) 9313498266Sopenharmony_ci#endif 9413498266Sopenharmony_ci 9513498266Sopenharmony_ci#ifndef CRYPT_E_NO_REVOCATION_CHECK 9613498266Sopenharmony_ci# define CRYPT_E_NO_REVOCATION_CHECK ((HRESULT)0x80092012L) 9713498266Sopenharmony_ci#endif 9813498266Sopenharmony_ci 9913498266Sopenharmony_ci#ifndef CRYPT_E_REVOCATION_OFFLINE 10013498266Sopenharmony_ci# define CRYPT_E_REVOCATION_OFFLINE ((HRESULT)0x80092013L) 10113498266Sopenharmony_ci#endif 10213498266Sopenharmony_ci 10313498266Sopenharmony_ci#ifndef CRYPT_E_NOT_IN_REVOCATION_DATABASE 10413498266Sopenharmony_ci# define CRYPT_E_NOT_IN_REVOCATION_DATABASE ((HRESULT)0x80092014L) 10513498266Sopenharmony_ci#endif 10613498266Sopenharmony_ci 10713498266Sopenharmony_ci#ifdef UNICODE 10813498266Sopenharmony_ci# define SECFLAG_WINNT_AUTH_IDENTITY \ 10913498266Sopenharmony_ci (unsigned long)SEC_WINNT_AUTH_IDENTITY_UNICODE 11013498266Sopenharmony_ci#else 11113498266Sopenharmony_ci# define SECFLAG_WINNT_AUTH_IDENTITY \ 11213498266Sopenharmony_ci (unsigned long)SEC_WINNT_AUTH_IDENTITY_ANSI 11313498266Sopenharmony_ci#endif 11413498266Sopenharmony_ci 11513498266Sopenharmony_ci/* 11613498266Sopenharmony_ci * Definitions required from ntsecapi.h are directly provided below this point 11713498266Sopenharmony_ci * to avoid including ntsecapi.h due to a conflict with OpenSSL's safestack.h 11813498266Sopenharmony_ci */ 11913498266Sopenharmony_ci#define KERB_WRAP_NO_ENCRYPT 0x80000001 12013498266Sopenharmony_ci 12113498266Sopenharmony_ci#endif /* USE_WINDOWS_SSPI */ 12213498266Sopenharmony_ci 12313498266Sopenharmony_ci#endif /* HEADER_CURL_SSPI_H */ 124