From d41a567de0fd7170b5310581914561415f1aa46e Mon Sep 17 00:00:00 2001 From: tb <> Date: Sat, 12 Aug 2023 07:43:48 +0000 Subject: Simplify and unify missing_parameters() for DH and DSA ok jsing --- src/lib/libcrypto/dh/dh_ameth.c | 10 +++++----- src/lib/libcrypto/dsa/dsa_ameth.c | 9 +++------ 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/dh/dh_ameth.c b/src/lib/libcrypto/dh/dh_ameth.c index f0c20f9a43..88fec6bf4a 100644 --- a/src/lib/libcrypto/dh/dh_ameth.c +++ b/src/lib/libcrypto/dh/dh_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_ameth.c,v 1.36 2023/08/11 13:57:24 tb Exp $ */ +/* $OpenBSD: dh_ameth.c,v 1.37 2023/08/12 07:43:48 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -432,11 +432,11 @@ dh_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) } static int -dh_missing_parameters(const EVP_PKEY *a) +dh_missing_parameters(const EVP_PKEY *pkey) { - if (!a->pkey.dh->p || !a->pkey.dh->g) - return 1; - return 0; + const DH *dh = pkey->pkey.dh; + + return dh->p == NULL || dh->g == NULL; } static int diff --git a/src/lib/libcrypto/dsa/dsa_ameth.c b/src/lib/libcrypto/dsa/dsa_ameth.c index 494bef3ce4..3b00ea97a4 100644 --- a/src/lib/libcrypto/dsa/dsa_ameth.c +++ b/src/lib/libcrypto/dsa/dsa_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_ameth.c,v 1.51 2023/08/11 13:57:24 tb Exp $ */ +/* $OpenBSD: dsa_ameth.c,v 1.52 2023/08/12 07:43:48 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -353,12 +353,9 @@ dsa_security_bits(const EVP_PKEY *pkey) static int dsa_missing_parameters(const EVP_PKEY *pkey) { - DSA *dsa; + const DSA *dsa = pkey->pkey.dsa; - dsa = pkey->pkey.dsa; - if (dsa->p == NULL || dsa->q == NULL || dsa->g == NULL) - return 1; - return 0; + return dsa->p == NULL || dsa->q == NULL || dsa->g == NULL; } static int -- cgit v1.2.3-55-g6feb