1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-12-25 09:39:52 +03:00

Add oqsprovider statically (built in) by default

This commit is contained in:
Siddharth 2024-06-20 22:08:38 -04:00
parent bc31a5cfd3
commit 102485a4b8
4 changed files with 28 additions and 1 deletions

3
.gitmodules vendored
View File

@ -10,3 +10,6 @@
[submodule "src/libhamcore"]
path = src/libhamcore
url = https://github.com/SoftEtherVPN/libhamcore.git
[submodule "src/Mayaqua/3rdparty/oqs-provider"]
path = src/Mayaqua/3rdparty/oqs-provider
url = https://github.com/open-quantum-safe/oqs-provider.git

1
src/Mayaqua/3rdparty/oqs-provider vendored Submodule

@ -0,0 +1 @@
Subproject commit bfaf29819e8e7679eb7b440c20312449d311e86a

View File

@ -93,6 +93,15 @@ if(UNIX)
$<$<BOOL:${LIB_RT}>:${LIB_RT}>
)
if (SKIP_OQS_PROVIDER)
add_definitions(-DSKIP_OQS_PROVIDER)
else()
set(OQS_PROVIDER_BUILD_STATIC ON CACHE BOOL "Build a static library instead of a shared library") # Build oqsprovider as a static library (defaults to shared)
add_subdirectory(3rdparty/oqs-provider)
set_property(TARGET oqsprovider PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries(mayaqua PRIVATE oqsprovider)
endif()
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv7l|aarch64|s390x)$" OR NOT HAVE_SYS_AUXV OR SKIP_CPU_FEATURES)
add_definitions(-DSKIP_CPU_FEATURES)
else()

View File

@ -40,6 +40,10 @@
#include <openssl/x509v3.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#include <openssl/provider.h>
// Static oqsprovider initialization function
#ifndef SKIP_OQS_PROVIDER
extern OSSL_provider_init_fn oqs_provider_init;
#endif
#endif
#ifdef _MSC_VER
@ -64,6 +68,10 @@
#endif
#endif // _MSC_VER
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#endif
// OpenSSL <1.1 Shims
#if OPENSSL_VERSION_NUMBER < 0x10100000L
# define EVP_PKEY_get0_RSA(obj) ((obj)->pkey.rsa)
@ -4003,7 +4011,13 @@ void InitCryptLibrary()
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
ossl_provider_default = OSSL_PROVIDER_load(NULL, "legacy");
ossl_provider_legacy = OSSL_PROVIDER_load(NULL, "default");
ossl_provider_oqsprovider = OSSL_PROVIDER_load(NULL, "oqsprovider");
char *oqs_provider_name = "oqsprovider";
#ifndef SKIP_OQS_PROVIDER
# Registers "oqsprovider" as a provider -- necessary because oqsprovider is built in now.
OSSL_PROVIDER_add_builtin(NULL, oqs_provider_name, oqs_provider_init);
#endif
ossl_provider_oqsprovider = OSSL_PROVIDER_load(NULL, oqs_provider_name);
#endif
ssl_clientcert_index = SSL_get_ex_new_index(0, "struct SslClientCertInfo *", NULL, NULL, NULL);