From 178d7934f9a01a3f3429217de850187b85ddfdd4 Mon Sep 17 00:00:00 2001 From: Norbert Pocs Date: Tue, 11 Oct 2022 15:47:13 +0200 Subject: [PATCH] Remove HAVE_OPENSSL_EVP_POLY1305 ifdefs POLY1305 is implicitly included in new (>1.1.1) openssl version, no need to check it explicitly. CHACHA20 is implicitly included too, but it can be turned off at config in openssl, so we still need to check it. Signed-off-by: Norbert Pocs Reviewed-by: Jakub Jelen Reviewed-by: Andreas Schneider --- src/libcrypto.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libcrypto.c b/src/libcrypto.c index 92c33234..1eebba89 100644 --- a/src/libcrypto.c +++ b/src/libcrypto.c @@ -34,7 +34,7 @@ #include "libssh/wrapper.h" #include "libssh/libcrypto.h" #include "libssh/pki.h" -#if defined(HAVE_OPENSSL_EVP_CHACHA20) && defined(HAVE_OPENSSL_EVP_POLY1305) +#ifdef HAVE_OPENSSL_EVP_CHACHA20 #include "libssh/bytearray.h" #include "libssh/chacha20-poly1305-common.h" #endif @@ -742,7 +742,7 @@ evp_cipher_aead_decrypt(struct ssh_cipher_struct *cipher, return SSH_OK; } -#if defined(HAVE_OPENSSL_EVP_CHACHA20) && defined(HAVE_OPENSSL_EVP_POLY1305) +#ifdef HAVE_OPENSSL_EVP_CHACHA20 struct chacha20_poly1305_keysched { /* cipher handle used for encrypting the packets */ @@ -1186,7 +1186,7 @@ chacha20_poly1305_aead_encrypt(struct ssh_cipher_struct *cipher, } #endif /* OPENSSL_VERSION_NUMBER */ } -#endif /* defined(HAVE_OPENSSL_EVP_CHACHA20) && defined(HAVE_OPENSSL_EVP_POLY1305) */ +#endif /* HAVE_OPENSSL_EVP_CHACHA20 */ #ifdef WITH_INSECURE_NONE static void @@ -1326,7 +1326,7 @@ static struct ssh_cipher_struct ssh_ciphertab[] = { }, #endif /* HAS_DES */ { -#if defined(HAVE_OPENSSL_EVP_CHACHA20) && defined(HAVE_OPENSSL_EVP_POLY1305) +#ifdef HAVE_OPENSSL_EVP_CHACHA20 .ciphertype = SSH_AEAD_CHACHA20_POLY1305, .name = "chacha20-poly1305@openssh.com", .blocksize = CHACHA20_BLOCKSIZE/8, @@ -1342,7 +1342,7 @@ static struct ssh_cipher_struct ssh_ciphertab[] = { .cleanup = chacha20_poly1305_cleanup #else .name = "chacha20-poly1305@openssh.com" -#endif /* defined(HAVE_OPENSSL_EVP_CHACHA20) && defined(HAVE_OPENSSL_EVP_POLY1305) */ +#endif /* HAVE_OPENSSL_EVP_CHACHA20 */ }, #ifdef WITH_INSECURE_NONE { @@ -1369,7 +1369,7 @@ struct ssh_cipher_struct *ssh_get_ciphertab(void) */ int ssh_crypto_init(void) { -#if !defined(HAVE_OPENSSL_EVP_CHACHA20) || !defined(HAVE_OPENSSL_EVP_POLY1305) +#ifndef HAVE_OPENSSL_EVP_CHACHA20 size_t i; #endif @@ -1395,7 +1395,7 @@ int ssh_crypto_init(void) } #endif /* CAN_DISABLE_AESNI */ -#if !defined(HAVE_OPENSSL_EVP_CHACHA20) || !defined(HAVE_OPENSSL_EVP_POLY1305) +#ifndef HAVE_OPENSSL_EVP_CHACHA20 for (i = 0; ssh_ciphertab[i].name != NULL; i++) { int cmp; @@ -1407,7 +1407,7 @@ int ssh_crypto_init(void) break; } } -#endif /* !defined(HAVE_OPENSSL_EVP_CHACHA20) || !defined(HAVE_OPENSSL_EVP_POLY1305) */ +#endif /* HAVE_OPENSSL_EVP_CHACHA20 */ libcrypto_initialized = 1;