1 /* Copyright (C) 2005 Juan Lang
2 * Copyright 2008 Henri Verbeet
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 * This file implements the schannel provider, or, the SSL/TLS implementations.
19 * FIXME: It should be rather obvious that this file is empty of any
23 #include "wine/port.h"
28 #ifdef SONAME_LIBGNUTLS
29 #include <gnutls/gnutls.h>
37 #include "secur32_priv.h"
38 #include "wine/debug.h"
39 #include "wine/library.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(secur32);
43 #ifdef SONAME_LIBGNUTLS
45 static void *libgnutls_handle;
46 #define MAKE_FUNCPTR(f) static typeof(f) * p##f
47 MAKE_FUNCPTR(gnutls_alert_get);
48 MAKE_FUNCPTR(gnutls_alert_get_name);
49 MAKE_FUNCPTR(gnutls_certificate_allocate_credentials);
50 MAKE_FUNCPTR(gnutls_certificate_free_credentials);
51 MAKE_FUNCPTR(gnutls_certificate_get_peers);
52 MAKE_FUNCPTR(gnutls_cipher_get);
53 MAKE_FUNCPTR(gnutls_cipher_get_key_size);
54 MAKE_FUNCPTR(gnutls_credentials_set);
55 MAKE_FUNCPTR(gnutls_deinit);
56 MAKE_FUNCPTR(gnutls_global_deinit);
57 MAKE_FUNCPTR(gnutls_global_init);
58 MAKE_FUNCPTR(gnutls_global_set_log_function);
59 MAKE_FUNCPTR(gnutls_global_set_log_level);
60 MAKE_FUNCPTR(gnutls_handshake);
61 MAKE_FUNCPTR(gnutls_init);
62 MAKE_FUNCPTR(gnutls_kx_get);
63 MAKE_FUNCPTR(gnutls_mac_get);
64 MAKE_FUNCPTR(gnutls_mac_get_key_size);
65 MAKE_FUNCPTR(gnutls_perror);
66 MAKE_FUNCPTR(gnutls_protocol_get_version);
67 MAKE_FUNCPTR(gnutls_set_default_priority);
68 MAKE_FUNCPTR(gnutls_record_recv);
69 MAKE_FUNCPTR(gnutls_record_send);
70 MAKE_FUNCPTR(gnutls_transport_set_errno);
71 MAKE_FUNCPTR(gnutls_transport_set_ptr);
72 MAKE_FUNCPTR(gnutls_transport_set_pull_function);
73 MAKE_FUNCPTR(gnutls_transport_set_push_function);
76 #define SCHAN_INVALID_HANDLE ~0UL
78 enum schan_handle_type
88 enum schan_handle_type type;
91 struct schan_credentials
94 gnutls_certificate_credentials credentials;
99 gnutls_session_t session;
103 struct schan_transport;
108 const SecBufferDesc *desc;
109 int current_buffer_idx;
110 BOOL allow_buffer_resize;
111 int (*get_next_buffer)(const struct schan_transport *, struct schan_buffers *);
114 struct schan_transport
116 struct schan_context *ctx;
117 struct schan_buffers in;
118 struct schan_buffers out;
121 static struct schan_handle *schan_handle_table;
122 static struct schan_handle *schan_free_handles;
123 static SIZE_T schan_handle_table_size;
124 static SIZE_T schan_handle_count;
126 static ULONG_PTR schan_alloc_handle(void *object, enum schan_handle_type type)
128 struct schan_handle *handle;
130 if (schan_free_handles)
132 /* Use a free handle */
133 handle = schan_free_handles;
134 if (handle->type != SCHAN_HANDLE_FREE)
136 ERR("Handle %d(%p) is in the free list, but has type %#x.\n", (handle-schan_handle_table), handle, handle->type);
137 return SCHAN_INVALID_HANDLE;
139 schan_free_handles = handle->object;
140 handle->object = object;
143 return handle - schan_handle_table;
145 if (!(schan_handle_count < schan_handle_table_size))
148 SIZE_T new_size = schan_handle_table_size + (schan_handle_table_size >> 1);
149 struct schan_handle *new_table = HeapReAlloc(GetProcessHeap(), 0, schan_handle_table, new_size * sizeof(*schan_handle_table));
152 ERR("Failed to grow the handle table\n");
153 return SCHAN_INVALID_HANDLE;
155 schan_handle_table = new_table;
156 schan_handle_table_size = new_size;
159 handle = &schan_handle_table[schan_handle_count++];
160 handle->object = object;
163 return handle - schan_handle_table;
166 static void *schan_free_handle(ULONG_PTR handle_idx, enum schan_handle_type type)
168 struct schan_handle *handle;
171 if (handle_idx == SCHAN_INVALID_HANDLE) return NULL;
172 if (handle_idx >= schan_handle_count) return NULL;
173 handle = &schan_handle_table[handle_idx];
174 if (handle->type != type)
176 ERR("Handle %ld(%p) is not of type %#x\n", handle_idx, handle, type);
180 object = handle->object;
181 handle->object = schan_free_handles;
182 handle->type = SCHAN_HANDLE_FREE;
183 schan_free_handles = handle;
188 static void *schan_get_object(ULONG_PTR handle_idx, enum schan_handle_type type)
190 struct schan_handle *handle;
192 if (handle_idx == SCHAN_INVALID_HANDLE) return NULL;
193 if (handle_idx >= schan_handle_count) return NULL;
194 handle = &schan_handle_table[handle_idx];
195 if (handle->type != type)
197 ERR("Handle %ld(%p) is not of type %#x\n", handle_idx, handle, type);
201 return handle->object;
204 static SECURITY_STATUS schan_QueryCredentialsAttributes(
205 PCredHandle phCredential, ULONG ulAttribute, VOID *pBuffer)
211 case SECPKG_ATTR_SUPPORTED_ALGS:
214 /* FIXME: get from CryptoAPI */
215 FIXME("SECPKG_ATTR_SUPPORTED_ALGS: stub\n");
216 ret = SEC_E_UNSUPPORTED_FUNCTION;
219 ret = SEC_E_INTERNAL_ERROR;
221 case SECPKG_ATTR_CIPHER_STRENGTHS:
224 SecPkgCred_CipherStrengths *r = pBuffer;
226 /* FIXME: get from CryptoAPI */
227 FIXME("SECPKG_ATTR_CIPHER_STRENGTHS: semi-stub\n");
228 r->dwMinimumCipherStrength = 40;
229 r->dwMaximumCipherStrength = 168;
233 ret = SEC_E_INTERNAL_ERROR;
235 case SECPKG_ATTR_SUPPORTED_PROTOCOLS:
238 /* FIXME: get from OpenSSL? */
239 FIXME("SECPKG_ATTR_SUPPORTED_PROTOCOLS: stub\n");
240 ret = SEC_E_UNSUPPORTED_FUNCTION;
243 ret = SEC_E_INTERNAL_ERROR;
246 ret = SEC_E_UNSUPPORTED_FUNCTION;
251 static SECURITY_STATUS SEC_ENTRY schan_QueryCredentialsAttributesA(
252 PCredHandle phCredential, ULONG ulAttribute, PVOID pBuffer)
256 TRACE("(%p, %d, %p)\n", phCredential, ulAttribute, pBuffer);
260 case SECPKG_CRED_ATTR_NAMES:
261 FIXME("SECPKG_CRED_ATTR_NAMES: stub\n");
262 ret = SEC_E_UNSUPPORTED_FUNCTION;
265 ret = schan_QueryCredentialsAttributes(phCredential, ulAttribute,
271 static SECURITY_STATUS SEC_ENTRY schan_QueryCredentialsAttributesW(
272 PCredHandle phCredential, ULONG ulAttribute, PVOID pBuffer)
276 TRACE("(%p, %d, %p)\n", phCredential, ulAttribute, pBuffer);
280 case SECPKG_CRED_ATTR_NAMES:
281 FIXME("SECPKG_CRED_ATTR_NAMES: stub\n");
282 ret = SEC_E_UNSUPPORTED_FUNCTION;
285 ret = schan_QueryCredentialsAttributes(phCredential, ulAttribute,
291 static SECURITY_STATUS schan_CheckCreds(const SCHANNEL_CRED *schanCred)
296 TRACE("dwVersion = %d\n", schanCred->dwVersion);
297 TRACE("cCreds = %d\n", schanCred->cCreds);
298 TRACE("hRootStore = %p\n", schanCred->hRootStore);
299 TRACE("cMappers = %d\n", schanCred->cMappers);
300 TRACE("cSupportedAlgs = %d:\n", schanCred->cSupportedAlgs);
301 for (i = 0; i < schanCred->cSupportedAlgs; i++)
302 TRACE("%08x\n", schanCred->palgSupportedAlgs[i]);
303 TRACE("grbitEnabledProtocols = %08x\n", schanCred->grbitEnabledProtocols);
304 TRACE("dwMinimumCipherStrength = %d\n", schanCred->dwMinimumCipherStrength);
305 TRACE("dwMaximumCipherStrength = %d\n", schanCred->dwMaximumCipherStrength);
306 TRACE("dwSessionLifespan = %d\n", schanCred->dwSessionLifespan);
307 TRACE("dwFlags = %08x\n", schanCred->dwFlags);
308 TRACE("dwCredFormat = %d\n", schanCred->dwCredFormat);
310 switch (schanCred->dwVersion)
313 case SCHANNEL_CRED_VERSION:
316 return SEC_E_INTERNAL_ERROR;
319 if (schanCred->cCreds == 0)
320 st = SEC_E_NO_CREDENTIALS;
321 else if (schanCred->cCreds > 1)
322 st = SEC_E_UNKNOWN_CREDENTIALS;
329 ret = CryptAcquireCertificatePrivateKey(schanCred->paCred[0],
330 0, /* FIXME: what flags to use? */ NULL,
331 &csp, &keySpec, &freeCSP);
336 CryptReleaseContext(csp, 0);
339 st = SEC_E_UNKNOWN_CREDENTIALS;
344 static SECURITY_STATUS schan_AcquireClientCredentials(const SCHANNEL_CRED *schanCred,
345 PCredHandle phCredential, PTimeStamp ptsExpiry)
347 struct schan_credentials *creds;
348 SECURITY_STATUS st = SEC_E_OK;
350 TRACE("schanCred %p, phCredential %p, ptsExpiry %p\n", schanCred, phCredential, ptsExpiry);
354 st = schan_CheckCreds(schanCred);
355 if (st == SEC_E_NO_CREDENTIALS)
359 /* For now, the only thing I'm interested in is the direction of the
360 * connection, so just store it.
367 creds = HeapAlloc(GetProcessHeap(), 0, sizeof(*creds));
368 if (!creds) return SEC_E_INSUFFICIENT_MEMORY;
370 handle = schan_alloc_handle(creds, SCHAN_HANDLE_CRED);
371 if (handle == SCHAN_INVALID_HANDLE) goto fail;
373 creds->credential_use = SECPKG_CRED_OUTBOUND;
374 ret = pgnutls_certificate_allocate_credentials(&creds->credentials);
375 if (ret != GNUTLS_E_SUCCESS)
378 schan_free_handle(handle, SCHAN_HANDLE_CRED);
382 phCredential->dwLower = handle;
383 phCredential->dwUpper = 0;
385 /* Outbound credentials have no expiry */
388 ptsExpiry->LowPart = 0;
389 ptsExpiry->HighPart = 0;
395 HeapFree(GetProcessHeap(), 0, creds);
396 return SEC_E_INTERNAL_ERROR;
399 static SECURITY_STATUS schan_AcquireServerCredentials(const SCHANNEL_CRED *schanCred,
400 PCredHandle phCredential, PTimeStamp ptsExpiry)
404 TRACE("schanCred %p, phCredential %p, ptsExpiry %p\n", schanCred, phCredential, ptsExpiry);
406 if (!schanCred) return SEC_E_NO_CREDENTIALS;
408 st = schan_CheckCreds(schanCred);
412 struct schan_credentials *creds;
414 creds = HeapAlloc(GetProcessHeap(), 0, sizeof(*creds));
415 if (!creds) return SEC_E_INSUFFICIENT_MEMORY;
416 creds->credential_use = SECPKG_CRED_INBOUND;
418 handle = schan_alloc_handle(creds, SCHAN_HANDLE_CRED);
419 if (handle == SCHAN_INVALID_HANDLE)
421 HeapFree(GetProcessHeap(), 0, creds);
422 return SEC_E_INTERNAL_ERROR;
425 phCredential->dwLower = handle;
426 phCredential->dwUpper = 0;
428 /* FIXME: get expiry from cert */
433 static SECURITY_STATUS schan_AcquireCredentialsHandle(ULONG fCredentialUse,
434 const SCHANNEL_CRED *schanCred, PCredHandle phCredential, PTimeStamp ptsExpiry)
438 if (fCredentialUse == SECPKG_CRED_OUTBOUND)
439 ret = schan_AcquireClientCredentials(schanCred, phCredential,
442 ret = schan_AcquireServerCredentials(schanCred, phCredential,
447 static SECURITY_STATUS SEC_ENTRY schan_AcquireCredentialsHandleA(
448 SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialUse,
449 PLUID pLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn,
450 PVOID pGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
452 TRACE("(%s, %s, 0x%08x, %p, %p, %p, %p, %p, %p)\n",
453 debugstr_a(pszPrincipal), debugstr_a(pszPackage), fCredentialUse,
454 pLogonID, pAuthData, pGetKeyFn, pGetKeyArgument, phCredential, ptsExpiry);
455 return schan_AcquireCredentialsHandle(fCredentialUse,
456 pAuthData, phCredential, ptsExpiry);
459 static SECURITY_STATUS SEC_ENTRY schan_AcquireCredentialsHandleW(
460 SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialUse,
461 PLUID pLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn,
462 PVOID pGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
464 TRACE("(%s, %s, 0x%08x, %p, %p, %p, %p, %p, %p)\n",
465 debugstr_w(pszPrincipal), debugstr_w(pszPackage), fCredentialUse,
466 pLogonID, pAuthData, pGetKeyFn, pGetKeyArgument, phCredential, ptsExpiry);
467 return schan_AcquireCredentialsHandle(fCredentialUse,
468 pAuthData, phCredential, ptsExpiry);
471 static SECURITY_STATUS SEC_ENTRY schan_FreeCredentialsHandle(
472 PCredHandle phCredential)
474 struct schan_credentials *creds;
476 TRACE("phCredential %p\n", phCredential);
478 if (!phCredential) return SEC_E_INVALID_HANDLE;
480 creds = schan_free_handle(phCredential->dwLower, SCHAN_HANDLE_CRED);
481 if (!creds) return SEC_E_INVALID_HANDLE;
483 if (creds->credential_use == SECPKG_CRED_OUTBOUND)
484 pgnutls_certificate_free_credentials(creds->credentials);
485 HeapFree(GetProcessHeap(), 0, creds);
490 static void init_schan_buffers(struct schan_buffers *s, const PSecBufferDesc desc,
491 int (*get_next_buffer)(const struct schan_transport *, struct schan_buffers *))
495 s->current_buffer_idx = -1;
496 s->allow_buffer_resize = FALSE;
497 s->get_next_buffer = get_next_buffer;
500 static int schan_find_sec_buffer_idx(const SecBufferDesc *desc, unsigned int start_idx, ULONG buffer_type)
505 for (i = start_idx; i < desc->cBuffers; ++i)
507 buffer = &desc->pBuffers[i];
508 if (buffer->BufferType == buffer_type) return i;
514 static void schan_resize_current_buffer(const struct schan_buffers *s, SIZE_T min_size)
516 SecBuffer *b = &s->desc->pBuffers[s->current_buffer_idx];
517 SIZE_T new_size = b->cbBuffer ? b->cbBuffer * 2 : 128;
520 if (b->cbBuffer >= min_size || !s->allow_buffer_resize || min_size > UINT_MAX / 2) return;
522 while (new_size < min_size) new_size *= 2;
525 new_data = HeapReAlloc(GetProcessHeap(), 0, b->pvBuffer, new_size);
527 new_data = HeapAlloc(GetProcessHeap(), 0, new_size);
531 TRACE("Failed to resize %p from %d to %ld\n", b->pvBuffer, b->cbBuffer, new_size);
535 b->cbBuffer = new_size;
536 b->pvBuffer = new_data;
539 static char *schan_get_buffer(const struct schan_transport *t, struct schan_buffers *s, size_t *count)
550 if (s->current_buffer_idx == -1)
553 int buffer_idx = s->get_next_buffer(t, s);
554 if (buffer_idx == -1)
556 TRACE("No next buffer\n");
559 s->current_buffer_idx = buffer_idx;
562 buffer = &s->desc->pBuffers[s->current_buffer_idx];
563 TRACE("Using buffer %d: cbBuffer %d, BufferType %#x, pvBuffer %p\n", s->current_buffer_idx, buffer->cbBuffer, buffer->BufferType, buffer->pvBuffer);
565 schan_resize_current_buffer(s, s->offset + *count);
566 max_count = buffer->cbBuffer - s->offset;
571 s->allow_buffer_resize = FALSE;
572 buffer_idx = s->get_next_buffer(t, s);
573 if (buffer_idx == -1)
575 TRACE("No next buffer\n");
578 s->current_buffer_idx = buffer_idx;
580 return schan_get_buffer(t, s, count);
583 if (*count > max_count) *count = max_count;
584 return (char *)buffer->pvBuffer + s->offset;
587 static ssize_t schan_pull(gnutls_transport_ptr_t transport, void *buff, size_t buff_len)
589 struct schan_transport *t = transport;
592 TRACE("Pull %zu bytes\n", buff_len);
594 b = schan_get_buffer(t, &t->in, &buff_len);
597 pgnutls_transport_set_errno(t->ctx->session, EAGAIN);
601 memcpy(buff, b, buff_len);
602 t->in.offset += buff_len;
604 TRACE("Read %zu bytes\n", buff_len);
609 static ssize_t schan_push(gnutls_transport_ptr_t transport, const void *buff, size_t buff_len)
611 struct schan_transport *t = transport;
614 TRACE("Push %zu bytes\n", buff_len);
616 b = schan_get_buffer(t, &t->out, &buff_len);
619 pgnutls_transport_set_errno(t->ctx->session, EAGAIN);
623 memcpy(b, buff, buff_len);
624 t->out.offset += buff_len;
626 TRACE("Wrote %zu bytes\n", buff_len);
631 static int schan_init_sec_ctx_get_next_buffer(const struct schan_transport *t, struct schan_buffers *s)
633 if (s->current_buffer_idx == -1)
635 int idx = schan_find_sec_buffer_idx(s->desc, 0, SECBUFFER_TOKEN);
636 if (t->ctx->req_ctx_attr & ISC_REQ_ALLOCATE_MEMORY)
640 idx = schan_find_sec_buffer_idx(s->desc, 0, SECBUFFER_EMPTY);
641 if (idx != -1) s->desc->pBuffers[idx].BufferType = SECBUFFER_TOKEN;
643 if (idx != -1 && !s->desc->pBuffers[idx].pvBuffer)
645 s->desc->pBuffers[idx].cbBuffer = 0;
646 s->allow_buffer_resize = TRUE;
655 static void dump_buffer_desc(SecBufferDesc *desc)
660 TRACE("Buffer desc %p:\n", desc);
661 for (i = 0; i < desc->cBuffers; ++i)
663 SecBuffer *b = &desc->pBuffers[i];
664 TRACE("\tbuffer %u: cbBuffer %d, BufferType %#x pvBuffer %p\n", i, b->cbBuffer, b->BufferType, b->pvBuffer);
668 /***********************************************************************
669 * InitializeSecurityContextW
671 static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextW(
672 PCredHandle phCredential, PCtxtHandle phContext, SEC_WCHAR *pszTargetName,
673 ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
674 PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
675 PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
677 struct schan_context *ctx;
678 struct schan_buffers *out_buffers;
679 struct schan_credentials *cred;
680 struct schan_transport transport;
683 TRACE("%p %p %s %d %d %d %p %d %p %p %p %p\n", phCredential, phContext,
684 debugstr_w(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
685 Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
687 dump_buffer_desc(pInput);
688 dump_buffer_desc(pOutput);
694 if (!phCredential) return SEC_E_INVALID_HANDLE;
696 cred = schan_get_object(phCredential->dwLower, SCHAN_HANDLE_CRED);
697 if (!cred) return SEC_E_INVALID_HANDLE;
699 if (!(cred->credential_use & SECPKG_CRED_OUTBOUND))
701 WARN("Invalid credential use %#x\n", cred->credential_use);
702 return SEC_E_INVALID_HANDLE;
705 ctx = HeapAlloc(GetProcessHeap(), 0, sizeof(*ctx));
706 if (!ctx) return SEC_E_INSUFFICIENT_MEMORY;
708 handle = schan_alloc_handle(ctx, SCHAN_HANDLE_CTX);
709 if (handle == SCHAN_INVALID_HANDLE)
711 HeapFree(GetProcessHeap(), 0, ctx);
712 return SEC_E_INTERNAL_ERROR;
715 err = pgnutls_init(&ctx->session, GNUTLS_CLIENT);
716 if (err != GNUTLS_E_SUCCESS)
719 schan_free_handle(handle, SCHAN_HANDLE_CTX);
720 HeapFree(GetProcessHeap(), 0, ctx);
721 return SEC_E_INTERNAL_ERROR;
724 /* FIXME: We should be using the information from the credentials here. */
725 FIXME("Using hardcoded \"NORMAL\" priority\n");
726 err = pgnutls_set_default_priority(ctx->session);
727 if (err != GNUTLS_E_SUCCESS)
730 pgnutls_deinit(ctx->session);
731 schan_free_handle(handle, SCHAN_HANDLE_CTX);
732 HeapFree(GetProcessHeap(), 0, ctx);
735 err = pgnutls_credentials_set(ctx->session, GNUTLS_CRD_CERTIFICATE, cred->credentials);
736 if (err != GNUTLS_E_SUCCESS)
739 pgnutls_deinit(ctx->session);
740 schan_free_handle(handle, SCHAN_HANDLE_CTX);
741 HeapFree(GetProcessHeap(), 0, ctx);
744 pgnutls_transport_set_pull_function(ctx->session, schan_pull);
745 pgnutls_transport_set_push_function(ctx->session, schan_push);
747 phNewContext->dwLower = handle;
748 phNewContext->dwUpper = 0;
752 ctx = schan_get_object(phContext->dwLower, SCHAN_HANDLE_CTX);
755 ctx->req_ctx_attr = fContextReq;
758 init_schan_buffers(&transport.in, pInput, schan_init_sec_ctx_get_next_buffer);
759 init_schan_buffers(&transport.out, pOutput, schan_init_sec_ctx_get_next_buffer);
760 pgnutls_transport_set_ptr(ctx->session, &transport);
762 /* Perform the TLS handshake */
763 err = pgnutls_handshake(ctx->session);
765 out_buffers = &transport.out;
766 if (out_buffers->current_buffer_idx != -1)
768 SecBuffer *buffer = &out_buffers->desc->pBuffers[out_buffers->current_buffer_idx];
769 buffer->cbBuffer = out_buffers->offset;
773 if (ctx->req_ctx_attr & ISC_REQ_ALLOCATE_MEMORY)
774 *pfContextAttr |= ISC_RET_ALLOCATED_MEMORY;
778 case GNUTLS_E_SUCCESS:
779 TRACE("Handshake completed\n");
783 TRACE("Continue...\n");
784 return SEC_I_CONTINUE_NEEDED;
786 case GNUTLS_E_WARNING_ALERT_RECEIVED:
787 case GNUTLS_E_FATAL_ALERT_RECEIVED:
789 gnutls_alert_description_t alert = pgnutls_alert_get(ctx->session);
790 const char *alert_name = pgnutls_alert_get_name(alert);
791 WARN("ALERT: %d %s\n", alert, alert_name);
792 return SEC_E_INTERNAL_ERROR;
797 return SEC_E_INTERNAL_ERROR;
801 /***********************************************************************
802 * InitializeSecurityContextA
804 static SECURITY_STATUS SEC_ENTRY schan_InitializeSecurityContextA(
805 PCredHandle phCredential, PCtxtHandle phContext, SEC_CHAR *pszTargetName,
806 ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
807 PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
808 PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
811 SEC_WCHAR *target_name = NULL;
813 TRACE("%p %p %s %d %d %d %p %d %p %p %p %p\n", phCredential, phContext,
814 debugstr_a(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
815 Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
819 INT len = MultiByteToWideChar(CP_ACP, 0, pszTargetName, -1, NULL, 0);
820 target_name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*target_name));
821 MultiByteToWideChar(CP_ACP, 0, pszTargetName, -1, target_name, len);
824 ret = schan_InitializeSecurityContextW(phCredential, phContext, target_name,
825 fContextReq, Reserved1, TargetDataRep, pInput, Reserved2,
826 phNewContext, pOutput, pfContextAttr, ptsExpiry);
828 HeapFree(GetProcessHeap(), 0, target_name);
833 static unsigned int schannel_get_cipher_block_size(gnutls_cipher_algorithm_t cipher)
837 gnutls_cipher_algorithm_t cipher;
838 unsigned int block_size;
842 {GNUTLS_CIPHER_3DES_CBC, 8},
843 {GNUTLS_CIPHER_AES_128_CBC, 16},
844 {GNUTLS_CIPHER_AES_256_CBC, 16},
845 {GNUTLS_CIPHER_ARCFOUR_128, 1},
846 {GNUTLS_CIPHER_ARCFOUR_40, 1},
847 {GNUTLS_CIPHER_DES_CBC, 8},
848 {GNUTLS_CIPHER_NULL, 1},
849 {GNUTLS_CIPHER_RC2_40_CBC, 8},
853 for (i = 0; i < sizeof(algorithms) / sizeof(*algorithms); ++i)
855 if (algorithms[i].cipher == cipher)
856 return algorithms[i].block_size;
859 FIXME("Unknown cipher %#x, returning 1\n", cipher);
864 static DWORD schannel_get_protocol(gnutls_protocol_t proto)
866 /* FIXME: currently schannel only implements client connections, but
867 * there's no reason it couldn't be used for servers as well. The
868 * context doesn't tell us which it is, so assume client for now.
872 case GNUTLS_SSL3: return SP_PROT_SSL3_CLIENT;
873 case GNUTLS_TLS1_0: return SP_PROT_TLS1_CLIENT;
875 FIXME("unknown protocol %d\n", proto);
880 static ALG_ID schannel_get_cipher_algid(gnutls_cipher_algorithm_t cipher)
884 case GNUTLS_CIPHER_UNKNOWN:
885 case GNUTLS_CIPHER_NULL: return 0;
886 case GNUTLS_CIPHER_ARCFOUR_40:
887 case GNUTLS_CIPHER_ARCFOUR_128: return CALG_RC4;
888 case GNUTLS_CIPHER_DES_CBC:
889 case GNUTLS_CIPHER_3DES_CBC: return CALG_DES;
890 case GNUTLS_CIPHER_AES_128_CBC:
891 case GNUTLS_CIPHER_AES_256_CBC: return CALG_AES;
892 case GNUTLS_CIPHER_RC2_40_CBC: return CALG_RC2;
894 FIXME("unknown algorithm %d\n", cipher);
899 static ALG_ID schannel_get_mac_algid(gnutls_mac_algorithm_t mac)
903 case GNUTLS_MAC_UNKNOWN:
904 case GNUTLS_MAC_NULL: return 0;
905 case GNUTLS_MAC_MD5: return CALG_MD5;
906 case GNUTLS_MAC_SHA1:
907 case GNUTLS_MAC_SHA256:
908 case GNUTLS_MAC_SHA384:
909 case GNUTLS_MAC_SHA512: return CALG_SHA;
911 FIXME("unknown algorithm %d\n", mac);
916 static ALG_ID schannel_get_kx_algid(gnutls_kx_algorithm_t kx)
920 case GNUTLS_KX_RSA: return CALG_RSA_KEYX;
921 case GNUTLS_KX_DHE_DSS:
922 case GNUTLS_KX_DHE_RSA: return CALG_DH_EPHEM;
924 FIXME("unknown algorithm %d\n", kx);
929 static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
930 PCtxtHandle context_handle, ULONG attribute, PVOID buffer)
932 struct schan_context *ctx;
934 TRACE("context_handle %p, attribute %#x, buffer %p\n",
935 context_handle, attribute, buffer);
937 if (!context_handle) return SEC_E_INVALID_HANDLE;
938 ctx = schan_get_object(context_handle->dwLower, SCHAN_HANDLE_CTX);
942 case SECPKG_ATTR_STREAM_SIZES:
944 SecPkgContext_StreamSizes *stream_sizes = buffer;
945 gnutls_mac_algorithm_t mac = pgnutls_mac_get(ctx->session);
946 size_t mac_size = pgnutls_mac_get_key_size(mac);
947 gnutls_cipher_algorithm_t cipher = pgnutls_cipher_get(ctx->session);
948 unsigned int block_size = schannel_get_cipher_block_size(cipher);
950 TRACE("Using %zu mac bytes, block size %u\n", mac_size, block_size);
952 /* These are defined by the TLS RFC */
953 stream_sizes->cbHeader = 5;
954 stream_sizes->cbTrailer = mac_size + 256; /* Max 255 bytes padding + 1 for padding size */
955 stream_sizes->cbMaximumMessage = 1 << 14;
956 stream_sizes->cbBuffers = 4;
957 stream_sizes->cbBlockSize = block_size;
960 case SECPKG_ATTR_REMOTE_CERT_CONTEXT:
962 unsigned int list_size;
963 const gnutls_datum_t *datum;
965 datum = pgnutls_certificate_get_peers(ctx->session, &list_size);
968 PCCERT_CONTEXT *cert = buffer;
970 *cert = CertCreateCertificateContext(X509_ASN_ENCODING,
971 datum->data, datum->size);
973 return GetLastError();
978 return SEC_E_INTERNAL_ERROR;
980 case SECPKG_ATTR_CONNECTION_INFO:
982 SecPkgContext_ConnectionInfo *info = buffer;
983 gnutls_protocol_t proto = pgnutls_protocol_get_version(ctx->session);
984 gnutls_cipher_algorithm_t alg = pgnutls_cipher_get(ctx->session);
985 gnutls_mac_algorithm_t mac = pgnutls_mac_get(ctx->session);
986 gnutls_kx_algorithm_t kx = pgnutls_kx_get(ctx->session);
988 info->dwProtocol = schannel_get_protocol(proto);
989 info->aiCipher = schannel_get_cipher_algid(alg);
990 info->dwCipherStrength = pgnutls_cipher_get_key_size(alg);
991 info->aiHash = schannel_get_mac_algid(mac);
992 info->dwHashStrength = pgnutls_mac_get_key_size(mac);
993 info->aiExch = schannel_get_kx_algid(kx);
994 /* FIXME: info->dwExchStrength? */
995 info->dwExchStrength = 0;
1000 FIXME("Unhandled attribute %#x\n", attribute);
1001 return SEC_E_UNSUPPORTED_FUNCTION;
1005 static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesA(
1006 PCtxtHandle context_handle, ULONG attribute, PVOID buffer)
1008 TRACE("context_handle %p, attribute %#x, buffer %p\n",
1009 context_handle, attribute, buffer);
1013 case SECPKG_ATTR_STREAM_SIZES:
1014 return schan_QueryContextAttributesW(context_handle, attribute, buffer);
1015 case SECPKG_ATTR_REMOTE_CERT_CONTEXT:
1016 return schan_QueryContextAttributesW(context_handle, attribute, buffer);
1017 case SECPKG_ATTR_CONNECTION_INFO:
1018 return schan_QueryContextAttributesW(context_handle, attribute, buffer);
1021 FIXME("Unhandled attribute %#x\n", attribute);
1022 return SEC_E_UNSUPPORTED_FUNCTION;
1026 static int schan_encrypt_message_get_next_buffer(const struct schan_transport *t, struct schan_buffers *s)
1030 if (s->current_buffer_idx == -1)
1031 return schan_find_sec_buffer_idx(s->desc, 0, SECBUFFER_STREAM_HEADER);
1033 b = &s->desc->pBuffers[s->current_buffer_idx];
1035 if (b->BufferType == SECBUFFER_STREAM_HEADER)
1036 return schan_find_sec_buffer_idx(s->desc, 0, SECBUFFER_DATA);
1038 if (b->BufferType == SECBUFFER_DATA)
1039 return schan_find_sec_buffer_idx(s->desc, 0, SECBUFFER_STREAM_TRAILER);
1044 static int schan_encrypt_message_get_next_buffer_token(const struct schan_transport *t, struct schan_buffers *s)
1048 if (s->current_buffer_idx == -1)
1049 return schan_find_sec_buffer_idx(s->desc, 0, SECBUFFER_TOKEN);
1051 b = &s->desc->pBuffers[s->current_buffer_idx];
1053 if (b->BufferType == SECBUFFER_TOKEN)
1055 int idx = schan_find_sec_buffer_idx(s->desc, 0, SECBUFFER_TOKEN);
1056 if (idx != s->current_buffer_idx) return -1;
1057 return schan_find_sec_buffer_idx(s->desc, 0, SECBUFFER_DATA);
1060 if (b->BufferType == SECBUFFER_DATA)
1062 int idx = schan_find_sec_buffer_idx(s->desc, 0, SECBUFFER_TOKEN);
1064 idx = schan_find_sec_buffer_idx(s->desc, idx + 1, SECBUFFER_TOKEN);
1071 static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle,
1072 ULONG quality, PSecBufferDesc message, ULONG message_seq_no)
1074 struct schan_transport transport;
1075 struct schan_context *ctx;
1076 struct schan_buffers *b;
1084 TRACE("context_handle %p, quality %d, message %p, message_seq_no %d\n",
1085 context_handle, quality, message, message_seq_no);
1087 if (!context_handle) return SEC_E_INVALID_HANDLE;
1088 ctx = schan_get_object(context_handle->dwLower, SCHAN_HANDLE_CTX);
1090 dump_buffer_desc(message);
1092 idx = schan_find_sec_buffer_idx(message, 0, SECBUFFER_DATA);
1095 WARN("No data buffer passed\n");
1096 return SEC_E_INTERNAL_ERROR;
1098 buffer = &message->pBuffers[idx];
1100 data_size = buffer->cbBuffer;
1101 data = HeapAlloc(GetProcessHeap(), 0, data_size);
1102 memcpy(data, buffer->pvBuffer, data_size);
1104 transport.ctx = ctx;
1105 init_schan_buffers(&transport.in, NULL, NULL);
1106 if (schan_find_sec_buffer_idx(message, 0, SECBUFFER_STREAM_HEADER) != -1)
1107 init_schan_buffers(&transport.out, message, schan_encrypt_message_get_next_buffer);
1109 init_schan_buffers(&transport.out, message, schan_encrypt_message_get_next_buffer_token);
1110 pgnutls_transport_set_ptr(ctx->session, &transport);
1112 while (sent < data_size)
1114 ret = pgnutls_record_send(ctx->session, data + sent, data_size - sent);
1117 if (ret != GNUTLS_E_AGAIN)
1119 pgnutls_perror(ret);
1120 HeapFree(GetProcessHeap(), 0, data);
1121 ERR("Returning SEC_E_INTERNAL_ERROR\n");
1122 return SEC_E_INTERNAL_ERROR;
1129 TRACE("Sent %zd bytes\n", sent);
1132 b->desc->pBuffers[b->current_buffer_idx].cbBuffer = b->offset;
1133 HeapFree(GetProcessHeap(), 0, data);
1138 static int schan_decrypt_message_get_next_buffer(const struct schan_transport *t, struct schan_buffers *s)
1140 if (s->current_buffer_idx == -1)
1141 return schan_find_sec_buffer_idx(s->desc, 0, SECBUFFER_DATA);
1146 static SECURITY_STATUS SEC_ENTRY schan_DecryptMessage(PCtxtHandle context_handle,
1147 PSecBufferDesc message, ULONG message_seq_no, PULONG quality)
1149 struct schan_transport transport;
1150 struct schan_context *ctx;
1154 ssize_t received = 0;
1158 TRACE("context_handle %p, message %p, message_seq_no %d, quality %p\n",
1159 context_handle, message, message_seq_no, quality);
1161 if (!context_handle) return SEC_E_INVALID_HANDLE;
1162 ctx = schan_get_object(context_handle->dwLower, SCHAN_HANDLE_CTX);
1164 dump_buffer_desc(message);
1166 idx = schan_find_sec_buffer_idx(message, 0, SECBUFFER_DATA);
1169 WARN("No data buffer passed\n");
1170 return SEC_E_INTERNAL_ERROR;
1172 buffer = &message->pBuffers[idx];
1174 data_size = buffer->cbBuffer;
1175 data = HeapAlloc(GetProcessHeap(), 0, data_size);
1177 transport.ctx = ctx;
1178 init_schan_buffers(&transport.in, message, schan_decrypt_message_get_next_buffer);
1179 init_schan_buffers(&transport.out, NULL, NULL);
1180 pgnutls_transport_set_ptr(ctx->session, (gnutls_transport_ptr_t)&transport);
1182 while (received < data_size)
1184 ret = pgnutls_record_recv(ctx->session, data + received, data_size - received);
1187 if (ret == GNUTLS_E_AGAIN)
1191 pgnutls_perror(ret);
1192 HeapFree(GetProcessHeap(), 0, data);
1193 TRACE("Returning SEC_E_INCOMPLETE_MESSAGE\n");
1194 return SEC_E_INCOMPLETE_MESSAGE;
1200 pgnutls_perror(ret);
1201 HeapFree(GetProcessHeap(), 0, data);
1202 ERR("Returning SEC_E_INTERNAL_ERROR\n");
1203 return SEC_E_INTERNAL_ERROR;
1209 TRACE("Received %zd bytes\n", received);
1211 memcpy(buffer->pvBuffer, data, received);
1212 buffer->cbBuffer = received;
1213 HeapFree(GetProcessHeap(), 0, data);
1218 static SECURITY_STATUS SEC_ENTRY schan_DeleteSecurityContext(PCtxtHandle context_handle)
1220 struct schan_context *ctx;
1222 TRACE("context_handle %p\n", context_handle);
1224 if (!context_handle) return SEC_E_INVALID_HANDLE;
1226 ctx = schan_free_handle(context_handle->dwLower, SCHAN_HANDLE_CTX);
1227 if (!ctx) return SEC_E_INVALID_HANDLE;
1229 pgnutls_deinit(ctx->session);
1230 HeapFree(GetProcessHeap(), 0, ctx);
1235 static void schan_gnutls_log(int level, const char *msg)
1237 TRACE("<%d> %s", level, msg);
1240 static const SecurityFunctionTableA schanTableA = {
1242 NULL, /* EnumerateSecurityPackagesA */
1243 schan_QueryCredentialsAttributesA,
1244 schan_AcquireCredentialsHandleA,
1245 schan_FreeCredentialsHandle,
1246 NULL, /* Reserved2 */
1247 schan_InitializeSecurityContextA,
1248 NULL, /* AcceptSecurityContext */
1249 NULL, /* CompleteAuthToken */
1250 schan_DeleteSecurityContext,
1251 NULL, /* ApplyControlToken */
1252 schan_QueryContextAttributesA,
1253 NULL, /* ImpersonateSecurityContext */
1254 NULL, /* RevertSecurityContext */
1255 NULL, /* MakeSignature */
1256 NULL, /* VerifySignature */
1258 NULL, /* QuerySecurityPackageInfoA */
1259 NULL, /* Reserved3 */
1260 NULL, /* Reserved4 */
1261 NULL, /* ExportSecurityContext */
1262 NULL, /* ImportSecurityContextA */
1263 NULL, /* AddCredentialsA */
1264 NULL, /* Reserved8 */
1265 NULL, /* QuerySecurityContextToken */
1266 schan_EncryptMessage,
1267 schan_DecryptMessage,
1268 NULL, /* SetContextAttributesA */
1271 static const SecurityFunctionTableW schanTableW = {
1273 NULL, /* EnumerateSecurityPackagesW */
1274 schan_QueryCredentialsAttributesW,
1275 schan_AcquireCredentialsHandleW,
1276 schan_FreeCredentialsHandle,
1277 NULL, /* Reserved2 */
1278 schan_InitializeSecurityContextW,
1279 NULL, /* AcceptSecurityContext */
1280 NULL, /* CompleteAuthToken */
1281 schan_DeleteSecurityContext,
1282 NULL, /* ApplyControlToken */
1283 schan_QueryContextAttributesW,
1284 NULL, /* ImpersonateSecurityContext */
1285 NULL, /* RevertSecurityContext */
1286 NULL, /* MakeSignature */
1287 NULL, /* VerifySignature */
1289 NULL, /* QuerySecurityPackageInfoW */
1290 NULL, /* Reserved3 */
1291 NULL, /* Reserved4 */
1292 NULL, /* ExportSecurityContext */
1293 NULL, /* ImportSecurityContextW */
1294 NULL, /* AddCredentialsW */
1295 NULL, /* Reserved8 */
1296 NULL, /* QuerySecurityContextToken */
1297 schan_EncryptMessage,
1298 schan_DecryptMessage,
1299 NULL, /* SetContextAttributesW */
1302 static const WCHAR schannelComment[] = { 'S','c','h','a','n','n','e','l',' ',
1303 'S','e','c','u','r','i','t','y',' ','P','a','c','k','a','g','e',0 };
1304 static const WCHAR schannelDllName[] = { 's','c','h','a','n','n','e','l','.','d','l','l',0 };
1306 void SECUR32_initSchannelSP(void)
1308 /* This is what Windows reports. This shouldn't break any applications
1309 * even though the functions are missing, because the wrapper will
1310 * return SEC_E_UNSUPPORTED_FUNCTION if our function is NULL.
1312 static const long caps =
1313 SECPKG_FLAG_INTEGRITY |
1314 SECPKG_FLAG_PRIVACY |
1315 SECPKG_FLAG_CONNECTION |
1316 SECPKG_FLAG_MULTI_REQUIRED |
1317 SECPKG_FLAG_EXTENDED_ERROR |
1318 SECPKG_FLAG_IMPERSONATION |
1319 SECPKG_FLAG_ACCEPT_WIN32_NAME |
1321 static const short version = 1;
1322 static const long maxToken = 16384;
1323 SEC_WCHAR *uniSPName = (SEC_WCHAR *)UNISP_NAME_W,
1324 *schannel = (SEC_WCHAR *)SCHANNEL_NAME_W;
1325 const SecPkgInfoW info[] = {
1326 { caps, version, UNISP_RPC_ID, maxToken, uniSPName, uniSPName },
1327 { caps, version, UNISP_RPC_ID, maxToken, schannel,
1328 (SEC_WCHAR *)schannelComment },
1330 SecureProvider *provider;
1333 libgnutls_handle = wine_dlopen(SONAME_LIBGNUTLS, RTLD_NOW, NULL, 0);
1334 if (!libgnutls_handle)
1336 WARN("Failed to load libgnutls.\n");
1340 #define LOAD_FUNCPTR(f) \
1341 if (!(p##f = wine_dlsym(libgnutls_handle, #f, NULL, 0))) \
1343 ERR("Failed to load %s\n", #f); \
1347 LOAD_FUNCPTR(gnutls_alert_get)
1348 LOAD_FUNCPTR(gnutls_alert_get_name)
1349 LOAD_FUNCPTR(gnutls_certificate_allocate_credentials)
1350 LOAD_FUNCPTR(gnutls_certificate_free_credentials)
1351 LOAD_FUNCPTR(gnutls_certificate_get_peers)
1352 LOAD_FUNCPTR(gnutls_cipher_get)
1353 LOAD_FUNCPTR(gnutls_cipher_get_key_size)
1354 LOAD_FUNCPTR(gnutls_credentials_set)
1355 LOAD_FUNCPTR(gnutls_deinit)
1356 LOAD_FUNCPTR(gnutls_global_deinit)
1357 LOAD_FUNCPTR(gnutls_global_init)
1358 LOAD_FUNCPTR(gnutls_global_set_log_function)
1359 LOAD_FUNCPTR(gnutls_global_set_log_level)
1360 LOAD_FUNCPTR(gnutls_handshake)
1361 LOAD_FUNCPTR(gnutls_init)
1362 LOAD_FUNCPTR(gnutls_kx_get)
1363 LOAD_FUNCPTR(gnutls_mac_get)
1364 LOAD_FUNCPTR(gnutls_mac_get_key_size)
1365 LOAD_FUNCPTR(gnutls_perror)
1366 LOAD_FUNCPTR(gnutls_protocol_get_version)
1367 LOAD_FUNCPTR(gnutls_set_default_priority)
1368 LOAD_FUNCPTR(gnutls_record_recv);
1369 LOAD_FUNCPTR(gnutls_record_send);
1370 LOAD_FUNCPTR(gnutls_transport_set_errno)
1371 LOAD_FUNCPTR(gnutls_transport_set_ptr)
1372 LOAD_FUNCPTR(gnutls_transport_set_pull_function)
1373 LOAD_FUNCPTR(gnutls_transport_set_push_function)
1376 ret = pgnutls_global_init();
1377 if (ret != GNUTLS_E_SUCCESS)
1379 pgnutls_perror(ret);
1383 if (TRACE_ON(secur32))
1385 pgnutls_global_set_log_level(4);
1386 pgnutls_global_set_log_function(schan_gnutls_log);
1389 schan_handle_table = HeapAlloc(GetProcessHeap(), 0, 64 * sizeof(*schan_handle_table));
1390 if (!schan_handle_table)
1392 ERR("Failed to allocate schannel handle table.\n");
1395 schan_handle_table_size = 64;
1397 provider = SECUR32_addProvider(&schanTableA, &schanTableW, schannelDllName);
1400 ERR("Failed to add schannel provider.\n");
1404 SECUR32_addPackages(provider, sizeof(info) / sizeof(info[0]), NULL, info);
1409 HeapFree(GetProcessHeap(), 0, schan_handle_table);
1410 schan_handle_table = NULL;
1411 wine_dlclose(libgnutls_handle, NULL, 0);
1412 libgnutls_handle = NULL;
1416 void SECUR32_deinitSchannelSP(void)
1418 SIZE_T i = schan_handle_count;
1420 if (!libgnutls_handle) return;
1422 /* deinitialized sessions first because a pointer to the credentials
1423 * are stored for the session by calling gnutls_credentials_set. */
1426 if (schan_handle_table[i].type == SCHAN_HANDLE_CTX)
1428 struct schan_context *ctx = schan_free_handle(i, SCHAN_HANDLE_CTX);
1429 pgnutls_deinit(ctx->session);
1430 HeapFree(GetProcessHeap(), 0, ctx);
1433 i = schan_handle_count;
1436 if (schan_handle_table[i].type != SCHAN_HANDLE_FREE)
1438 struct schan_credentials *cred;
1439 cred = schan_free_handle(i, SCHAN_HANDLE_CRED);
1440 pgnutls_certificate_free_credentials(cred->credentials);
1441 HeapFree(GetProcessHeap(), 0, cred);
1444 HeapFree(GetProcessHeap(), 0, schan_handle_table);
1445 pgnutls_global_deinit();
1446 wine_dlclose(libgnutls_handle, NULL, 0);
1449 #else /* SONAME_LIBGNUTLS */
1451 void SECUR32_initSchannelSP(void) {}
1452 void SECUR32_deinitSchannelSP(void) {}
1454 #endif /* SONAME_LIBGNUTLS */