VirtualBox

source: vbox/trunk/src/libs/openssl-3.4.1/crypto/async/arch/async_win.c

Last change on this file was 109052, checked in by vboxsync, 4 weeks ago

openssl-3.4.1: Applied our changes, regenerated files, added missing files and functions. This time with a three way merge. ​bugref:10890

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1/*
2 * Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10/* This must be the first #include file */
11#include "../async_local.h"
12
13#ifdef ASYNC_WIN
14
15# include <windows.h>
16# include "internal/cryptlib.h"
17
18int ASYNC_is_capable(void)
19{
20 return 1;
21}
22
23int ASYNC_set_mem_functions(ASYNC_stack_alloc_fn alloc_fn,
24 ASYNC_stack_free_fn free_fn)
25{
26 return 0;
27}
28
29void ASYNC_get_mem_functions(ASYNC_stack_alloc_fn *alloc_fn,
30 ASYNC_stack_free_fn *free_fn)
31{
32 if (alloc_fn != NULL)
33 *alloc_fn = NULL;
34 if (free_fn != NULL)
35 *free_fn = NULL;
36}
37
38void async_local_cleanup(void)
39{
40 async_ctx *ctx = async_get_ctx();
41 if (ctx != NULL) {
42 async_fibre *fibre = &ctx->dispatcher;
43 if (fibre != NULL && fibre->fibre != NULL && fibre->converted) {
44 ConvertFiberToThread();
45 fibre->fibre = NULL;
46 }
47 }
48}
49
50int async_fibre_init_dispatcher(async_fibre *fibre)
51{
52# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
53 fibre->fibre = ConvertThreadToFiberEx(NULL, FIBER_FLAG_FLOAT_SWITCH);
54# else
55 fibre->fibre = ConvertThreadToFiber(NULL);
56# endif
57 if (fibre->fibre == NULL) {
58 fibre->converted = 0;
59 fibre->fibre = GetCurrentFiber();
60 if (fibre->fibre == NULL)
61 return 0;
62 } else {
63 fibre->converted = 1;
64 }
65
66 return 1;
67}
68
69VOID CALLBACK async_start_func_win(PVOID unused)
70{
71 async_start_func();
72}
73
74#endif
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette