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

Unable to compile with 32 bits using Mingw on mbedTLS v 3.5.0 #8334

Closed
g-tardy opened this issue Oct 10, 2023 · 1 comment · Fixed by #8339
Closed

Unable to compile with 32 bits using Mingw on mbedTLS v 3.5.0 #8334

g-tardy opened this issue Oct 10, 2023 · 1 comment · Fixed by #8339
Labels
bug component-crypto Crypto primitives and low-level interfaces size-s Estimated task size: small (~2d)

Comments

@g-tardy
Copy link

g-tardy commented Oct 10, 2023

Summary

Since version 3.5.0 we are unable to compile mbedTLS version 3.5.0.

Works pretty well on previous 3.* versions (and 2.28.5). It stops with error message:

(...)
\mbedtls\library\aesni.h:69:
5: error: #error "Must use `-mpclmul -msse2 -maes` for MBEDTLS_AESNI_C"
 #   error "Must use `-mpclmul -msse2 -maes` for MBEDTLS_AESNI_C"

Seems to be linked to commit d6e312d applied on

(...)
#if defined(MBEDTLS_AESNI_HAVE_INTRINSICS)
#define MBEDTLS_AESNI_HAVE_CODE 2 // via intrinsics
#elif defined(MBEDTLS_HAVE_ASM) && \
    defined(__GNUC__) && defined(MBEDTLS_ARCH_IS_X64)
/* Can we do AESNI with inline assembly?
 * (Only implemented with gas syntax, only for 64-bit.)
 */
#define MBEDTLS_AESNI_HAVE_CODE 1 // via assembly
#elif defined(__GNUC__)
#   error "Must use `-mpclmul -msse2 -maes` for MBEDTLS_AESNI_C"
#else
#error "MBEDTLS_AESNI_C defined, but neither intrinsics nor assembly available"
#endif
(...)

Where line defined(__GNUC__) && defined(MBEDTLS_HAVE_X86_64) changed to :
defined(__GNUC__) && defined(MBEDTLS_ARCH_IS_X64)

System information

Mbed TLS version (number or commit id): 3.5.0
Operating system and version: Windows 7 x64 SP1, MingW32
Configuration (if not default, please attach mbedtls_config.h): Default
Compiler and options (if you used a pre-built binary, please indicate how you obtained it):

cmake . -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=OFF -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32
cmake --build .

Additional environment information:

Bin path for Mingw:
C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin

Expected behavior

Compile version should pass

Actual behavior

Compile version fails

Steps to reproduce

Compile mbedTLS using 32 bits capabilities

Additional information

@ronald-cron-arm ronald-cron-arm added bug component-crypto Crypto primitives and low-level interfaces size-s Estimated task size: small (~2d) labels Oct 10, 2023
@ronald-cron-arm ronald-cron-arm added this to Mbed TLS 3.6 release in EPICs for Mbed TLS Oct 10, 2023
@ronald-cron-arm
Copy link
Contributor

Thanks for the bug report. We will look at fixing it before the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component-crypto Crypto primitives and low-level interfaces size-s Estimated task size: small (~2d)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants