From: tb Date: Sat, 12 Aug 2023 07:43:48 +0000 (+0000) Subject: Simplify and unify missing_parameters() for DH and DSA X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a13d6b7a2661d3f767907130eb4ba24a09df3db0;p=openbsd Simplify and unify missing_parameters() for DH and DSA ok jsing --- diff --git a/lib/libcrypto/dh/dh_ameth.c b/lib/libcrypto/dh/dh_ameth.c index f0c20f9a434..88fec6bf4ac 100644 --- a/lib/libcrypto/dh/dh_ameth.c +++ b/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/lib/libcrypto/dsa/dsa_ameth.c b/lib/libcrypto/dsa/dsa_ameth.c index 494bef3ce42..3b00ea97a4e 100644 --- a/lib/libcrypto/dsa/dsa_ameth.c +++ b/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