Add initial mbedTLS v4 support#3532
Add initial mbedTLS v4 support#3532Easton97-Jens wants to merge 7 commits intoowasp-modsecurity:v3/masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds initial build/runtime compatibility with Mbed TLS 4.x’s TF-PSA-Crypto layout by updating bundled Mbed TLS paths/sources and migrating MD5/SHA1 hashing to the generic mbedtls_md API.
Changes:
- Switch MD5/SHA1 helpers from deprecated per-hash headers/functions to
mbedtls_md(mbedtls/md.h+mbedtls_md()). - Update autotools build files to include TF-PSA-Crypto include paths and compile the new TF-PSA-Crypto source locations.
- Update Win32 CMake build to compile the TF-PSA-Crypto source set and adjust include directories accordingly.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/sha1.h | Migrates digest implementation to generic mbedtls_md API. |
| src/utils/md5.h | Updates MD5 wrapper to use the updated DigestImpl template. |
| src/Makefile.am | Adds TF-PSA-Crypto include paths for libmodsecurity compilation. |
| others/Makefile.am | Repoints bundled Mbed TLS subset headers/sources to TF-PSA-Crypto layout. |
| Makefile.am | Extends cppcheck include paths for TF-PSA-Crypto headers. |
| configure.ac | Updates configure-time check to detect TF-PSA-Crypto base64 source path. |
| build/win32/CMakeLists.txt | Rebuilds bundled crypto subset from TF-PSA-Crypto sources and updates include dirs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @Easton97-Jens, there are two SonarCloud reports in |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Migrate to TF-PSA-Crypto layout - Fix include and linkage issues - Harden runtime checks - Improve error and exception handling - Refactor digest helper and buffer usage
7c0e6e9 to
c43e0c8
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sha1/md5: fix exception safety, remove copy, and own exception message sha1/md5: fix exception safety, remove copy, and own exception message sha1/md5: fix exception safety, remove copy, and own exception message sha1/md5: fix exception safety, remove copy, and own exception message win update win update
efc6bb8 to
d713740
Compare
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } catch (const DigestCalculationException&) { | ||
| assert(false); | ||
| return std::string(DigestSize, '\0'); | ||
| } |
| } catch (const DigestCalculationException&) { | ||
| assert(false); | ||
| value.assign(DigestSize, '\0'); | ||
| } |
| } catch (const DigestCalculationException&) { | ||
| assert(false); | ||
| const std::array<unsigned char, DigestSize> digestBytes = {}; | ||
| const auto *digestByteData = |
|
|
||
| # Check for Mbed TLS | ||
| if ! test -f "${srcdir}/others/mbedtls/library/base64.c"; then | ||
| if ! test -f "${srcdir}/others/mbedtls/tf-psa-crypto/utilities/base64.c"; then |
| set(MBEDTLS_DIR ${BASE_DIR}/others/mbedtls) | ||
| set(TF_PSA_CRYPTO_DIR ${MBEDTLS_DIR}/tf-psa-crypto) | ||
|
|
||
| add_library(mbedcrypto STATIC | ||
| ${TF_PSA_CRYPTO_DIR}/utilities/base64.c |
| project(libModSecurity | ||
| VERSION | ||
| 3.0.12 | ||
| 3.0.14 | ||
| LANGUAGES | ||
| CXX |



what
md5.h,sha1.h) with genericmbedtls_mdAPIconfigure.acto work with Mbed TLS 4.x layoutwhy
library/base64.cwhich no longer exist in 4.x./configureand compilationreferences
library/base64.cwhen using Mbed TLS 4.x — Is support planned? #3450