early-access version 2853

This commit is contained in:
pineappleEA
2022-07-23 03:01:36 +02:00
parent 1f2b5081b5
commit 1f111bb69c
8955 changed files with 418777 additions and 999 deletions

View File

@@ -0,0 +1,102 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8833246..f68ab02 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,6 +28,7 @@ set(MBEDTLS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
option(USE_PKCS11_HELPER_LIBRARY "Build mbed TLS with the pkcs11-helper library." OFF)
option(ENABLE_ZLIB_SUPPORT "Build mbed TLS with zlib library." OFF)
+option(ENABLE_PTHREAD "Build mbed TLS with pthread" OFF)
option(ENABLE_PROGRAMS "Build mbed TLS programs." ON)
@@ -231,6 +232,8 @@ else()
set(LIB_INSTALL_DIR lib)
endif()
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
+
if(ENABLE_ZLIB_SUPPORT)
find_package(ZLIB)
@@ -239,6 +242,17 @@ if(ENABLE_ZLIB_SUPPORT)
endif(ZLIB_FOUND)
endif(ENABLE_ZLIB_SUPPORT)
+if(ENABLE_PTHREAD)
+ if(WIN32)
+ find_package(pthreads_windows REQUIRED)
+ include_directories(${PThreads4W_INCLUDE_DIR})
+ else()
+ set(CMAKE_THREAD_PREFER_PTHREAD ON)
+ find_package(Threads REQUIRED)
+ endif()
+ set(LINK_WITH_PTHREAD ON)
+endif()
+
add_subdirectory(include)
add_subdirectory(3rdparty)
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 62c0f62..7923202 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -1,10 +1,14 @@
option(INSTALL_MBEDTLS_HEADERS "Install mbed TLS headers." ON)
+configure_file(mbedtls/config_threading.h.in mbedtls/config_threading.h)
+
if(INSTALL_MBEDTLS_HEADERS)
file(GLOB headers "mbedtls/*.h")
file(GLOB psa_headers "psa/*.h")
-
+
+ set(headers ${headers} ${CMAKE_CURRENT_BINARY_DIR}/mbedtls/config_threading.h)
+
install(FILES ${headers}
DESTINATION include/mbedtls
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h
index 1e6e052..51c20da 100644
--- a/include/mbedtls/config.h
+++ b/include/mbedtls/config.h
@@ -24,6 +24,8 @@
* limitations under the License.
*/
+#include "mbedtls/config_threading.h"
+
#ifndef MBEDTLS_CONFIG_H
#define MBEDTLS_CONFIG_H
diff --git a/include/mbedtls/config_threading.h.in b/include/mbedtls/config_threading.h.in
new file mode 100644
index 0000000..9d5d42e
--- /dev/null
+++ b/include/mbedtls/config_threading.h.in
@@ -0,0 +1,6 @@
+#cmakedefine ENABLE_PTHREAD
+
+#ifdef ENABLE_PTHREAD
+#define MBEDTLS_THREADING_C
+#define MBEDTLS_THREADING_PTHREAD
+#endif
\ No newline at end of file
diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
index 33e2cfc..4b99331 100644
--- a/library/CMakeLists.txt
+++ b/library/CMakeLists.txt
@@ -137,7 +137,11 @@ if(ENABLE_ZLIB_SUPPORT)
endif(ENABLE_ZLIB_SUPPORT)
if(LINK_WITH_PTHREAD)
- set(libs ${libs} pthread)
+ if(WIN32)
+ set(libs ${libs} ${PThreads4W_LIBRARY})
+ else()
+ set(libs ${libs} pthread)
+ endif()
endif()
if(LINK_WITH_TRUSTED_STORAGE)

38
externals/vcpkg/ports/mbedtls/portfile.cmake vendored Executable file
View File

@@ -0,0 +1,38 @@
set(VCPKG_LIBRARY_LINKAGE static)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ARMmbed/mbedtls
REF 8b3f26a5ac38d4fdccbc5c5366229f3e01dafcc0 # mbedtls-2.28.0
SHA512 a5d2694ae87347be7ebf5c32b86d7bb809cc696b549947efb3d12d41d5f726d4f7caed3cc6ee3f3c9b9e46b3c42c4ce8a5f9741b1b0a3c644b6ae615d2f4c55a
HEAD_REF mbedtls-2.28
PATCHES
enable-pthread.patch
)
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
pthreads ENABLE_PTHREAD
)
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
${FEATURE_OPTIONS}
-DENABLE_TESTING=OFF
-DENABLE_PROGRAMS=OFF
-DMBEDTLS_FATAL_WARNINGS=FALSE
)
vcpkg_cmake_install()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
if (VCPKG_TARGET_IS_WINDOWS AND pthreads IN_LIST FEATURES)
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
endif ()
vcpkg_copy_pdbs()

View File

@@ -0,0 +1,29 @@
include(FindPackageHandleStandardArgs)
find_path(MBEDTLS_INCLUDE_DIR mbedtls/ssl.h)
find_library(MBEDTLS_CRYPTO_LIBRARY mbedcrypto)
find_package(pthreads_windows QUIET)
set(MBEDTLS_CRYPTO_LIBRARY ${MBEDTLS_CRYPTO_LIBRARY} ${PThreads4W_LIBRARY})
find_library(MBEDTLS_X509_LIBRARY mbedx509)
find_library(MBEDTLS_TLS_LIBRARY mbedtls)
set(MBEDTLS_LIBRARIES ${MBEDTLS_CRYPTO_LIBRARY} ${MBEDTLS_X509_LIBRARY} ${MBEDTLS_TLS_LIBRARY})
if (MBEDTLS_INCLUDE_DIR AND EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h")
file(
STRINGS ${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h _MBEDTLS_VERLINE
REGEX "^#define[ \t]+MBEDTLS_VERSION_STRING[\t ].*"
)
string(REGEX REPLACE ".*MBEDTLS_VERSION_STRING[\t ]+\"(.*)\"" "\\1" MBEDTLS_VERSION ${_MBEDTLS_VERLINE})
endif()
find_package_handle_standard_args(
mbedTLS
REQUIRED_VARS
MBEDTLS_INCLUDE_DIR
MBEDTLS_CRYPTO_LIBRARY
MBEDTLS_X509_LIBRARY
MBEDTLS_TLS_LIBRARY
PThreads4W_FOUND
VERSION_VAR MBEDTLS_VERSION
)

29
externals/vcpkg/ports/mbedtls/vcpkg.json vendored Executable file
View File

@@ -0,0 +1,29 @@
{
"name": "mbedtls",
"version": "2.28.0",
"description": "An open source, portable, easy to use, readable and flexible SSL library",
"homepage": "https://github.com/ARMmbed/mbedtls",
"license": "Apache-2.0",
"supports": "!uwp",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"pthreads": {
"description": "Multi-threading support",
"dependencies": [
{
"name": "pthreads",
"platform": "windows"
}
]
}
}
}