.github
CMakeModules
dist
externals
FidelityFX-FSR
SDL
Vulkan-Headers
cmake-modules
cpp-httplib
cubeb
discord-rpc
dynarmic
ffmpeg
find-modules
getopt
glad
httplib
inih
libressl
crypto
aes
asn1
bf
bio
b_dump.c
b_posix.c
b_print.c
b_sock.c
b_win.c
bf_buff.c
bf_nbio.c
bf_null.c
bio_cb.c
bio_err.c
bio_lib.c
bio_meth.c
bss_acpt.c
bss_bio.c
bss_conn.c
bss_dgram.c
bss_fd.c
bss_file.c
bss_log.c
bss_mem.c
bss_null.c
bss_sock.c
bn
buffer
camellia
cast
chacha
cmac
cms
comp
compat
conf
curve25519
des
dh
dsa
dso
ec
ecdh
ecdsa
engine
err
evp
gost
hkdf
hmac
idea
lhash
md4
md5
modes
objects
ocsp
pem
pkcs12
pkcs7
poly1305
rand
rc2
rc4
ripemd
rsa
sha
sm3
sm4
stack
ts
txt_db
ui
whrlpool
x509
CMakeLists.txt
VERSION
arm_arch.h
armcap.c
armv4cpuid.S
constant_time_locl.h
cpt_err.c
cpuid-elf-x86_64.S
cpuid-macosx-x86_64.S
cpuid-masm-x86_64.S
cpuid-mingw64-x86_64.S
cryptlib.c
cryptlib.h
crypto.sym
crypto_init.c
crypto_lock.c
cversion.c
ex_data.c
malloc-wrapper.c
md32_common.h
mem_clr.c
mem_dbg.c
o_init.c
o_str.c
o_time.c
o_time.h
x86_arch.h
include
ssl
tls
.gitignore
CMakeLists.txt
COPYING
ChangeLog
FindLibreSSL.cmake
INSTALL
README.md
README.windows
VERSION
cmake_export_symbol.cmake
ltmain.sh
tap-driver.sh
test-driver
libusb
libzip
mbedtls
microprofile
opus
sirit
soundtouch
xbyak
CMakeLists.txt
patches
src
CMakeLists.txt
LICENSE
README.md
license.txt
55 lines
1.2 KiB
C
55 lines
1.2 KiB
C
![]() |
/*
|
||
|
* Public domain
|
||
|
*
|
||
|
* Dongsheng Song <dongsheng.song@gmail.com>
|
||
|
* Brent Cook <bcook@openbsd.org>
|
||
|
*/
|
||
|
|
||
|
#include <ws2tcpip.h>
|
||
|
|
||
|
#include <openssl/bio.h>
|
||
|
#include <openssl/err.h>
|
||
|
|
||
|
int
|
||
|
BIO_sock_init(void)
|
||
|
{
|
||
|
/*
|
||
|
* WSAStartup loads the winsock .dll and initializes the networking
|
||
|
* stack on Windows, or simply increases the reference count.
|
||
|
*/
|
||
|
static struct WSAData wsa_state = {0};
|
||
|
WORD version_requested = MAKEWORD(2, 2);
|
||
|
static int wsa_init_done = 0;
|
||
|
if (!wsa_init_done) {
|
||
|
if (WSAStartup(version_requested, &wsa_state) != 0) {
|
||
|
int err = WSAGetLastError();
|
||
|
SYSerror(err);
|
||
|
BIOerror(BIO_R_WSASTARTUP);
|
||
|
return (-1);
|
||
|
}
|
||
|
wsa_init_done = 1;
|
||
|
}
|
||
|
return (1);
|
||
|
}
|
||
|
|
||
|
void
|
||
|
BIO_sock_cleanup(void)
|
||
|
{
|
||
|
/*
|
||
|
* We could call WSACleanup here, but it is easy to get it wrong. Since
|
||
|
* this API provides no way to even tell if it failed, there is no safe
|
||
|
* way to expose that functionality here.
|
||
|
*
|
||
|
* The cost of leaving the networking DLLs loaded may have been large
|
||
|
* during the Windows 3.1/win32s era, but it is small in modern
|
||
|
* contexts, so don't bother.
|
||
|
*/
|
||
|
}
|
||
|
|
||
|
int
|
||
|
BIO_socket_nbio(int s, int mode)
|
||
|
{
|
||
|
u_long value = mode;
|
||
|
return ioctlsocket(s, FIONBIO, &value) != SOCKET_ERROR;
|
||
|
}
|