From 316b1ed28e5a3c52a29ece57583350d992fbc6c7 Mon Sep 17 00:00:00 2001 From: tb <> Date: Wed, 20 Dec 2023 10:14:14 +0000 Subject: Remove preprocessor mess in EVP_PKEY_{de,en}crypt_old() This was done the worst possible way. It would be much simpler to invert the logic and use a single #ifdef. jsing prefers keeping the current logic and suggested we ditch the preprocessor mess altogether. ok jsing, claudio agreed with the initial diff --- src/lib/libcrypto/evp/p_dec.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'src/lib/libcrypto/evp/p_dec.c') diff --git a/src/lib/libcrypto/evp/p_dec.c b/src/lib/libcrypto/evp/p_dec.c index d55b48b771..2c63fe054e 100644 --- a/src/lib/libcrypto/evp/p_dec.c +++ b/src/lib/libcrypto/evp/p_dec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p_dec.c,v 1.15 2023/07/07 19:37:54 beck Exp $ */ +/* $OpenBSD: p_dec.c,v 1.16 2023/12/20 10:14:14 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -56,18 +56,10 @@ * [including the GNU Public Licence.] */ -#include - -#include - #include #include -#include -#include -#ifndef OPENSSL_NO_RSA #include -#endif #include "evp_local.h" @@ -75,20 +67,11 @@ int EVP_PKEY_decrypt_old(unsigned char *key, const unsigned char *ek, int ekl, EVP_PKEY *priv) { - int ret = -1; - -#ifndef OPENSSL_NO_RSA if (priv->type != EVP_PKEY_RSA) { -#endif EVPerror(EVP_R_PUBLIC_KEY_NOT_RSA); -#ifndef OPENSSL_NO_RSA - goto err; + return -1; } - ret = RSA_private_decrypt(ekl, ek, key, priv->pkey.rsa, + return RSA_private_decrypt(ekl, ek, key, priv->pkey.rsa, RSA_PKCS1_PADDING); - -err: -#endif - return (ret); } -- cgit v1.2.3-55-g6feb