Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mbedtls] update to 3.1.0 #20860

Closed
wants to merge 16 commits into from
78 changes: 35 additions & 43 deletions ports/mbedtls/enable-pthread.patch
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8833246..f68ab02 100644
index 6debe35..64e0674 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)
@@ -51,6 +51,7 @@ if(WIN32)
else()
option(GEN_FILES "Generate the auto-generated files as needed" ON)
endif()
+option(ENABLE_PTHREAD "Build mbed TLS with pthread" OFF)

option(ENABLE_PROGRAMS "Build mbed TLS programs." ON)

@@ -231,6 +232,8 @@ else()
string(REGEX MATCH "Clang" CMAKE_COMPILER_IS_CLANG "${CMAKE_C_COMPILER_ID}")
string(REGEX MATCH "GNU" CMAKE_COMPILER_IS_GNU "${CMAKE_C_COMPILER_ID}")
@@ -243,12 +244,26 @@ else()
set(LIB_INSTALL_DIR lib)
endif()

+include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
+#include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
+
if(ENABLE_ZLIB_SUPPORT)
find_package(ZLIB)
add_subdirectory(include)

@@ -239,6 +242,17 @@ if(ENABLE_ZLIB_SUPPORT)
endif(ZLIB_FOUND)
endif(ENABLE_ZLIB_SUPPORT)
add_subdirectory(3rdparty)

add_subdirectory(library)

+if(ENABLE_PTHREAD)
+ if(WIN32)
Expand All @@ -34,61 +33,54 @@ index 8833246..f68ab02 100644
+ set(LINK_WITH_PTHREAD ON)
+endif()
+
add_subdirectory(include)

add_subdirectory(3rdparty)
+
#
# The C files in tests/src directory contain test code shared among test suites
# and programs. This shared test code is compiled and linked to test suites and
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 62c0f62..7923202 100644
index e693bc1..7f5216a 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -1,10 +1,14 @@
@@ -1,9 +1,13 @@
option(INSTALL_MBEDTLS_HEADERS "Install mbed TLS headers." ON)

+configure_file(mbedtls/config_threading.h.in mbedtls/config_threading.h)
+#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)
+
+ #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 @@
diff --git a/include/mbedtls/mbedtls_config.h b/include/mbedtls/mbedtls_config.h
index 0558ee0..d2fd425 100644
--- a/include/mbedtls/mbedtls_config.h
+++ b/include/mbedtls/mbedtls_config.h
@@ -24,6 +24,15 @@
* 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
+
/**
* This is an optional version symbol that enables comatibility handling of
* config files.
diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
index 33e2cfc..4b99331 100644
index 07599f5..27e426d 100644
--- a/library/CMakeLists.txt
+++ b/library/CMakeLists.txt
@@ -137,7 +137,11 @@ if(ENABLE_ZLIB_SUPPORT)
endif(ENABLE_ZLIB_SUPPORT)
@@ -189,7 +189,11 @@ if(HAIKU)
endif(HAIKU)

if(LINK_WITH_PTHREAD)
- set(libs ${libs} pthread)
Expand Down
25 changes: 13 additions & 12 deletions ports/mbedtls/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ set(VCPKG_LIBRARY_LINKAGE static)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ARMmbed/mbedtls
REF 523f0554b6cdc7ace5d360885c3f5bbcc73ec0e8 # mbedtls-2.24.0
SHA512 1ce78f34e8d87c2ce0454e0a08f4c6e5b3129d4b24cfa44162af21c2e8b5dc7feabf849e4fa547ce3781b5ce11aaf675cfed47412bae40091fbdd87bbcdbee07
REF d65aeb37349ad1a50e0f6c9b694d4b5290d60e49 #v3.1.0
SHA512 a3fde5e6e206d0ab43282502fec45da14f1ccb24974db7a9348a18870d3c07b10fe72419ebf5130cec1b9e819ef804608b0f7b48670f619e328f5b798a8d9eb1
HEAD_REF master
PATCHES
enable-pthread.patch
Expand All @@ -15,27 +15,28 @@ vcpkg_from_github(
vcpkg_check_features(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
pthreads ENABLE_PTHREAD
pthreads ENABLE_PTHREAD
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DENABLE_TESTING=OFF
-DENABLE_PROGRAMS=OFF
-DMBEDTLS_FATAL_WARNINGS=FALSE
)

vcpkg_install_cmake()
vcpkg_cmake_install()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
vcpkg_cmake_config_fixup(CONFIG_PATH "CMake")

file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
vcpkg_copy_pdbs()

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})
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
endif ()

vcpkg_copy_pdbs()
13 changes: 11 additions & 2 deletions ports/mbedtls/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
{
"name": "mbedtls",
"version-string": "2.24.0",
"port-version": 3,
"version": "3.1.0",
"description": "An open source, portable, easy to use, readable and flexible SSL library",
"homepage": "https://github.com/ARMmbed/mbedtls",
"supports": "!uwp",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"pthreads": {
"description": "Multi-threading support",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4325,8 +4325,8 @@
"port-version": 0
},
"mbedtls": {
"baseline": "2.24.0",
"port-version": 3
"baseline": "3.1.0",
"port-version": 0
},
"mcpp": {
"baseline": "2.7.2.14",
Expand Down
5 changes: 5 additions & 0 deletions versions/m-/mbedtls.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d166fd001341f0db9228c7ebc0e1ce26b49c492c",
"version": "3.1.0",
"port-version": 0
},
{
"git-tree": "a68475211755b3999de8cb2ec1d2fdfe9bb8ab10",
"version-string": "2.24.0",
Expand Down