Skip to contentSkip to conversation

crypto.c: remove (dead) OpenSSL specific code

PATCH In review Antonio Quartulli 2 participants 2 messages Jan 26, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto.c: remove (dead) OpenSSL specific code

Originally we wanted to move this OpenSSL specific code to its own backend and use a proper abstraction in the crypto.c code.

However, tests have revealed that OpenVPN will never try to print a cipher that is not supported by FIPS (assuming FIPS is enabled), because along the chain of calls we already call cipher_get() which returns NULL for FIPS-disabled ciphers.

For this reason, we can just remove any FIPS specific code from print_cipher() and be done with it.

This patch fixes compilations with mbedTLS when some OpenSSL is also installed. The issue was introduced with:
544330fe ("crypto: Fix OPENSSL_FIPS enabled builds")

---
 src/openvpn/crypto.c | 11 -----------
 1 file changed, 11 deletions(-)
src/openvpn/crypto.c +0 -11
index 0aa76e05..b0a3cf81 100644
@@ -34,7 +34,6 @@
 #include "error.h"
 #include "integer.h"
 #include "platform.h"
-#include "openssl_compat.h"
 
 #include "memdbg.h"
 
@@ -1704,16 +1703,6 @@ print_cipher(const char *ciphername)
     {
         printf(", TLS client/server mode only");
     }
-#ifdef OPENSSL_FIPS
-    evp_cipher_type *cipher = EVP_CIPHER_fetch(NULL, ciphername, NULL);
-
-    if (FIPS_mode() && cipher
-        && !(EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_FIPS))
-    {
-        printf(", disabled by FIPS mode");
-    }
-    EVP_CIPHER_free(cipher);
-#endif
 
     printf(")\n");
 }
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw

Am 26.01.22 um 16:11 schrieb Antonio Quartulli:

Quoted 11 lines

Originally we wanted to move this OpenSSL specific code to its own backend and use a proper abstraction in the crypto.c code.

However, tests have revealed that OpenVPN will never try to print a cipher that is not supported by FIPS (assuming FIPS is enabled), because along the chain of calls we already call cipher_get() which returns NULL for FIPS-disabled ciphers.

For this reason, we can just remove any FIPS specific code from print_cipher() and be done with it.