Skip to content

CBL-8182: Upgrade mbedTLS to 3.6.6#2487

Merged
jianminzhao merged 1 commit into
release/3.3from
cbl-8182
May 2, 2026
Merged

CBL-8182: Upgrade mbedTLS to 3.6.6#2487
jianminzhao merged 1 commit into
release/3.3from
cbl-8182

Conversation

@jianminzhao

Copy link
Copy Markdown
Contributor

Also includes:

Windows threading abstraction for mbedTLS (#2435)

  1. Cmake will now use config.py to switch PTHREAD for ALT in the mbedTLS threading implementation (ifdef causes python errors)
  2. Add a static instance that will set up the threading model (mbedThreading.cc)
  3. Add a threading_alt.h header that CMake will copy into mbedTLS's include directory so that the downstream library can find it
  4. Bump mbedTLS submodule to get rid of header ifdef

Also includes:

Windows threading abstraction for mbedTLS (#2435)

1. Cmake will now use config.py to switch PTHREAD for ALT in the mbedTLS threading implementation (ifdef causes python errors)
2. Add a static instance that will set up the threading model (mbedThreading.cc)
3. Add a threading_alt.h header that CMake will copy into mbedTLS's include directory so that the downstream library can find it
4. Bump mbedTLS submodule to get rid of header ifdef
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

This is a release branch and commits are restricted.

Please confirm this PR is one of the following:

  • A response to a customer ask
  • A change per our security policy
  • A non-functional change (i.e. changes needed for building an older version)
  • A change that has been granted an exception (please comment)

@cbl-bot

cbl-bot commented May 1, 2026

Copy link
Copy Markdown

Code Coverage Results:

Type Percentage
branches 65.58
functions 78.18
instantiations 71.74
lines 77.18
regions 73.45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Upgrades the vendored mbedTLS dependency to 3.6.6 and updates the Windows build to use mbedTLS’s alternate threading abstraction (ALT) via a CMake-time configuration step and a Windows CRITICAL_SECTION-based mutex implementation.

Changes:

  • Bump mbedTLS version in the Black Duck manifest to 3.6.6.
  • Update Windows CMake configure step to switch mbedTLS threading from PTHREAD to ALT and copy threading_alt.h into the mbedTLS include tree.
  • Add Windows-specific threading_alt.h and a static initializer (mbedThreading.cc) that wires mbedTLS threading callbacks to CRITICAL_SECTION.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

File Description
jenkins/couchbase-lite-core-black-duck-manifest.yaml Updates the recorded mbedTLS component version to 3.6.6.
cmake/platform_win.cmake Adds Windows configure-time mbedTLS threading configuration and copies the ALT header into vendor includes.
MSVC/threading_alt.h Introduces the Windows ALT mutex type definition for mbedTLS.
MSVC/mbedThreading.cc Registers Windows mutex init/free/lock/unlock callbacks with mbedTLS at startup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmake/platform_win.cmake
Comment on lines +41 to +42
file(COPY ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../MSVC/threading_alt.h
DESTINATION ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../vendor/mbedtls/include/mbedtls)
Comment thread MSVC/threading_alt.h
Comment on lines +33 to +37
#endif //_WIN32

#ifdef __cplusplus
}
#endif
Comment thread MSVC/mbedThreading.cc
Comment on lines +1 to +5
#include "threading_alt.h"
#include "mbedtls/threading.h"

#if defined(_WIN32) && defined(MBEDTLS_THREADING_ALT)

Comment thread cmake/platform_win.cmake
Comment on lines +35 to +40
WORKING_DIRECTORY "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/.."
)
execute_process(
COMMAND "${Python3_EXECUTABLE}" "${_mbedtls_config_py}" set MBEDTLS_THREADING_ALT
WORKING_DIRECTORY "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/.."
)
@jianminzhao jianminzhao merged commit 3e5cf74 into release/3.3 May 2, 2026
14 checks passed
@jianminzhao jianminzhao deleted the cbl-8182 branch May 2, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants