crypto: Fix mbedtls builds
PATCH 1/1 crypto: Fix mbedtls builds
From: David Sommerseth <[email protected]...>
With commit 544330fefedc87, the openssl_compat.h got included in crypto.c. This caused issues when building against mbed TLS, which this compat layer is not targeting.
This issue is resolved by only including this header when the OpenSSL library is in use. The OPENSSL_FIPS macro should never be set when compiling against the mbed TLS library. But we check against the main ENABLE_CRYPTO_OPENSSL macro here, in case future updates adds more OpenSSL specific fragments.
--- src/openvpn/crypto.c | 2 ++ 1 file changed, 2 insertions(+)
src/openvpn/crypto.c +2 -0
@@ -34,7 +34,9 @@#include "error.h" #include "integer.h" #include "platform.h" +#ifdef ENABLE_CRYPTO_OPENSSL #include "openssl_compat.h" +#endif #include "memdbg.h"
Signature · 1 line
2.27.0
Hi,
Quoted 6 lines · David Sommerseth
From: David Sommerseth <[email protected]...>
With commit
544330fefedc87, theopenssl_compat.hgot included incrypto.c. This caused issues when building against mbed TLS, which this compat layer is not targeting.
Quoted 7 lines
This issue is resolved by only including this header when the OpenSSL library is in use. The
OPENSSL_FIPSmacro should never be set when compiling against the mbed TLS library. But we check against the mainENABLE_CRYPTO_OPENSSLmacro here, in case future updates adds more OpenSSL specific fragments.Signed-off-by David Sommerseth <[email protected]...>
I am personally NAK'ing this patch, however, after further discussion on IRC I can say that this was the consensus reached with David and Arne as well.
The idea is that having OpenSSL specific code in crypto.c is a no-go.
Like all other functionalities, we need to hide the FIPS check behind our SSL abstraction, so that each backend can decie what to do (mbedtls will probably just say "sure, go ahead").
So this patch should be dropped.
Best Regards,
Signature · 1 line
Antonio Quartulli