2004-03-02 04:57:35 +00:00
|
|
|
/*
|
|
|
|
* secur32 private definitions.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Juan Lang
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-03-02 04:57:35 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SECUR32_PRIV_H__
|
|
|
|
#define __SECUR32_PRIV_H__
|
|
|
|
|
2005-10-30 19:06:24 +00:00
|
|
|
#include <sys/types.h>
|
2011-03-13 23:58:40 +00:00
|
|
|
#include <limits.h>
|
|
|
|
#include "schannel.h"
|
2023-07-31 14:25:50 +00:00
|
|
|
#include "ntsecapi.h"
|
|
|
|
#include "ntsecpkg.h"
|
2021-05-07 09:54:44 +00:00
|
|
|
#include "wine/list.h"
|
2005-08-30 08:55:20 +00:00
|
|
|
|
2004-03-02 04:57:35 +00:00
|
|
|
typedef struct _SecureProvider
|
|
|
|
{
|
2005-08-30 08:55:20 +00:00
|
|
|
struct list entry;
|
2005-05-13 17:44:47 +00:00
|
|
|
BOOL loaded;
|
2004-03-02 04:57:35 +00:00
|
|
|
PWSTR moduleName;
|
|
|
|
HMODULE lib;
|
|
|
|
SecurityFunctionTableA fnTableA;
|
|
|
|
SecurityFunctionTableW fnTableW;
|
|
|
|
} SecureProvider;
|
|
|
|
|
|
|
|
typedef struct _SecurePackage
|
|
|
|
{
|
2005-08-30 08:55:20 +00:00
|
|
|
struct list entry;
|
2004-03-02 04:57:35 +00:00
|
|
|
SecPkgInfoW infoW;
|
|
|
|
SecureProvider *provider;
|
|
|
|
} SecurePackage;
|
|
|
|
|
2005-05-13 17:44:47 +00:00
|
|
|
/* Allocates space for and initializes a new provider. If fnTableA or fnTableW
|
2008-07-02 15:18:49 +00:00
|
|
|
* is non-NULL, assumes the provider is built-in, and if moduleName is non-NULL,
|
|
|
|
* means must load the LSA/user mode functions tables from external SSP/AP module.
|
2005-05-13 17:44:47 +00:00
|
|
|
* Otherwise moduleName must not be NULL.
|
|
|
|
* Returns a pointer to the stored provider entry, for use adding packages.
|
|
|
|
*/
|
2006-01-24 13:00:32 +00:00
|
|
|
SecureProvider *SECUR32_addProvider(const SecurityFunctionTableA *fnTableA,
|
2011-04-21 09:37:02 +00:00
|
|
|
const SecurityFunctionTableW *fnTableW, PCWSTR moduleName) DECLSPEC_HIDDEN;
|
2005-05-13 17:44:47 +00:00
|
|
|
|
|
|
|
/* Allocates space for and adds toAdd packages with the given provider.
|
|
|
|
* provider must not be NULL, and either infoA or infoW may be NULL, but not
|
|
|
|
* both.
|
|
|
|
*/
|
|
|
|
void SECUR32_addPackages(SecureProvider *provider, ULONG toAdd,
|
2011-04-21 09:37:02 +00:00
|
|
|
const SecPkgInfoA *infoA, const SecPkgInfoW *infoW) DECLSPEC_HIDDEN;
|
2005-05-13 17:44:47 +00:00
|
|
|
|
2004-03-02 04:57:35 +00:00
|
|
|
/* Tries to find the package named packageName. If it finds it, implicitly
|
|
|
|
* loads the package if it isn't already loaded.
|
|
|
|
*/
|
2011-04-21 09:37:02 +00:00
|
|
|
SecurePackage *SECUR32_findPackageW(PCWSTR packageName) DECLSPEC_HIDDEN;
|
2004-03-02 04:57:35 +00:00
|
|
|
|
|
|
|
/* Tries to find the package named packageName. (Thunks to _findPackageW)
|
|
|
|
*/
|
2011-04-21 09:37:02 +00:00
|
|
|
SecurePackage *SECUR32_findPackageA(PCSTR packageName) DECLSPEC_HIDDEN;
|
2004-03-02 04:57:35 +00:00
|
|
|
|
2005-05-13 17:44:47 +00:00
|
|
|
/* Initialization functions for built-in providers */
|
2011-04-21 09:37:02 +00:00
|
|
|
void SECUR32_initSchannelSP(void) DECLSPEC_HIDDEN;
|
2018-02-01 10:04:33 +00:00
|
|
|
void load_auth_packages(void) DECLSPEC_HIDDEN;
|
2023-07-31 14:25:50 +00:00
|
|
|
NTSTATUS NTAPI nego_SpLsaModeInitialize(ULONG, PULONG, PSECPKG_FUNCTION_TABLE *, PULONG) DECLSPEC_HIDDEN;
|
|
|
|
NTSTATUS NTAPI nego_SpUserModeInitialize(ULONG, PULONG, PSECPKG_USER_FUNCTION_TABLE *, PULONG) DECLSPEC_HIDDEN;
|
|
|
|
SECPKG_FUNCTION_TABLE *lsa_find_package(const char *name, SECPKG_USER_FUNCTION_TABLE **user_api) DECLSPEC_HIDDEN;
|
2005-05-13 17:44:47 +00:00
|
|
|
|
2008-09-22 20:14:04 +00:00
|
|
|
/* Cleanup functions for built-in providers */
|
2011-04-21 09:37:02 +00:00
|
|
|
void SECUR32_deinitSchannelSP(void) DECLSPEC_HIDDEN;
|
2008-09-22 20:14:04 +00:00
|
|
|
|
2011-03-13 23:58:40 +00:00
|
|
|
/* schannel internal interface */
|
2022-05-27 07:35:43 +00:00
|
|
|
typedef UINT64 schan_session;
|
2013-03-25 12:55:20 +00:00
|
|
|
|
|
|
|
typedef struct schan_credentials
|
|
|
|
{
|
|
|
|
ULONG credential_use;
|
2013-03-27 11:22:23 +00:00
|
|
|
DWORD enabled_protocols;
|
2022-05-31 09:10:22 +00:00
|
|
|
UINT64 credentials;
|
2013-03-25 12:55:20 +00:00
|
|
|
} schan_credentials;
|
2011-03-13 23:58:40 +00:00
|
|
|
|
2021-12-04 12:18:34 +00:00
|
|
|
struct session_params
|
|
|
|
{
|
|
|
|
schan_session session;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct allocate_certificate_credentials_params
|
|
|
|
{
|
|
|
|
schan_credentials *c;
|
2022-05-27 07:35:44 +00:00
|
|
|
ULONG cert_encoding;
|
|
|
|
ULONG cert_size;
|
|
|
|
BYTE *cert_blob;
|
|
|
|
ULONG key_size;
|
|
|
|
BYTE *key_blob;
|
2021-12-04 12:18:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct create_session_params
|
|
|
|
{
|
|
|
|
schan_credentials *cred;
|
2022-05-27 07:35:45 +00:00
|
|
|
schan_session *session;
|
2021-12-04 12:18:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct free_certificate_credentials_params
|
|
|
|
{
|
|
|
|
schan_credentials *c;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct get_application_protocol_params
|
|
|
|
{
|
|
|
|
schan_session session;
|
|
|
|
SecPkgContext_ApplicationProtocol *protocol;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct get_connection_info_params
|
|
|
|
{
|
|
|
|
schan_session session;
|
|
|
|
SecPkgContext_ConnectionInfo *info;
|
|
|
|
};
|
|
|
|
|
2022-06-20 18:06:55 +00:00
|
|
|
struct get_cipher_info_params
|
|
|
|
{
|
|
|
|
schan_session session;
|
|
|
|
SecPkgContext_CipherInfo *info;
|
|
|
|
};
|
|
|
|
|
2021-12-04 12:18:34 +00:00
|
|
|
struct get_session_peer_certificate_params
|
|
|
|
{
|
|
|
|
schan_session session;
|
2022-05-27 07:35:42 +00:00
|
|
|
BYTE *buffer; /* Starts with array of ULONG sizes, followed by contiguous data blob. */
|
2021-12-04 12:18:34 +00:00
|
|
|
ULONG *bufsize;
|
|
|
|
ULONG *retcount;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct get_unique_channel_binding_params
|
|
|
|
{
|
|
|
|
schan_session session;
|
|
|
|
void *buffer;
|
|
|
|
ULONG *bufsize;
|
|
|
|
};
|
|
|
|
|
2022-10-27 21:40:11 +00:00
|
|
|
enum control_token
|
|
|
|
{
|
2023-06-20 12:34:57 +00:00
|
|
|
CONTROL_TOKEN_NONE,
|
|
|
|
CONTROL_TOKEN_SHUTDOWN,
|
|
|
|
CONTROL_TOKEN_ALERT,
|
2022-10-27 21:40:11 +00:00
|
|
|
};
|
|
|
|
|
2021-12-04 12:18:34 +00:00
|
|
|
struct handshake_params
|
|
|
|
{
|
|
|
|
schan_session session;
|
|
|
|
SecBufferDesc *input;
|
2022-05-31 08:59:44 +00:00
|
|
|
ULONG input_size;
|
2021-12-04 12:18:34 +00:00
|
|
|
SecBufferDesc *output;
|
2022-05-30 12:53:27 +00:00
|
|
|
ULONG *input_offset;
|
|
|
|
int *output_buffer_idx;
|
|
|
|
ULONG *output_offset;
|
2022-10-27 21:40:11 +00:00
|
|
|
enum control_token control_token;
|
2023-06-20 12:34:57 +00:00
|
|
|
unsigned int alert_type;
|
|
|
|
unsigned int alert_number;
|
2021-12-04 12:18:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct recv_params
|
|
|
|
{
|
|
|
|
schan_session session;
|
|
|
|
SecBufferDesc *input;
|
2022-05-31 08:59:44 +00:00
|
|
|
ULONG input_size;
|
2021-12-04 12:18:34 +00:00
|
|
|
void *buffer;
|
2022-05-31 08:59:44 +00:00
|
|
|
ULONG *length;
|
2021-12-04 12:18:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct send_params
|
|
|
|
{
|
|
|
|
schan_session session;
|
|
|
|
SecBufferDesc *output;
|
|
|
|
const void *buffer;
|
2022-05-31 08:29:41 +00:00
|
|
|
ULONG length;
|
2022-05-31 06:20:07 +00:00
|
|
|
int *output_buffer_idx;
|
|
|
|
ULONG *output_offset;
|
2021-12-04 12:18:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct set_application_protocols_params
|
|
|
|
{
|
|
|
|
schan_session session;
|
|
|
|
unsigned char *buffer;
|
|
|
|
unsigned int buflen;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct set_dtls_mtu_params
|
|
|
|
{
|
|
|
|
schan_session session;
|
|
|
|
unsigned int mtu;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct set_session_target_params
|
|
|
|
{
|
|
|
|
schan_session session;
|
|
|
|
const char *target;
|
|
|
|
};
|
|
|
|
|
2022-01-27 10:11:26 +00:00
|
|
|
struct set_dtls_timeouts_params
|
|
|
|
{
|
|
|
|
schan_session session;
|
|
|
|
unsigned int retrans_timeout;
|
|
|
|
unsigned int total_timeout;
|
|
|
|
};
|
|
|
|
|
2021-12-04 12:18:34 +00:00
|
|
|
enum schan_funcs
|
|
|
|
{
|
|
|
|
unix_process_attach,
|
|
|
|
unix_process_detach,
|
|
|
|
unix_allocate_certificate_credentials,
|
|
|
|
unix_create_session,
|
|
|
|
unix_dispose_session,
|
|
|
|
unix_free_certificate_credentials,
|
|
|
|
unix_get_application_protocol,
|
2022-06-20 18:06:55 +00:00
|
|
|
unix_get_cipher_info,
|
2021-12-04 12:18:34 +00:00
|
|
|
unix_get_connection_info,
|
|
|
|
unix_get_enabled_protocols,
|
|
|
|
unix_get_key_signature_algorithm,
|
|
|
|
unix_get_max_message_size,
|
|
|
|
unix_get_session_cipher_block_size,
|
|
|
|
unix_get_session_peer_certificate,
|
|
|
|
unix_get_unique_channel_binding,
|
|
|
|
unix_handshake,
|
|
|
|
unix_recv,
|
|
|
|
unix_send,
|
|
|
|
unix_set_application_protocols,
|
|
|
|
unix_set_dtls_mtu,
|
|
|
|
unix_set_session_target,
|
2022-01-27 10:11:26 +00:00
|
|
|
unix_set_dtls_timeouts,
|
2021-12-04 12:18:34 +00:00
|
|
|
};
|
2021-05-07 09:54:41 +00:00
|
|
|
|
|
|
|
#endif /* __SECUR32_PRIV_H__ */
|