diff options
author | tb <> | 2023-08-12 07:43:48 +0000 |
---|---|---|
committer | tb <> | 2023-08-12 07:43:48 +0000 |
commit | d41a567de0fd7170b5310581914561415f1aa46e (patch) | |
tree | 64b4906da67f40c6a74b53f10f0c1672b4b5633a /src | |
parent | ee8f35a481544e1c6c9d242ebca90dff32e0a3c2 (diff) | |
download | openbsd-d41a567de0fd7170b5310581914561415f1aa46e.tar.gz openbsd-d41a567de0fd7170b5310581914561415f1aa46e.tar.bz2 openbsd-d41a567de0fd7170b5310581914561415f1aa46e.zip |
Simplify and unify missing_parameters() for DH and DSA
ok jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/dh/dh_ameth.c | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_ameth.c | 9 |
2 files changed, 8 insertions, 11 deletions
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 @@ | |||
1 | /* $OpenBSD: dh_ameth.c,v 1.36 2023/08/11 13:57:24 tb Exp $ */ | 1 | /* $OpenBSD: dh_ameth.c,v 1.37 2023/08/12 07:43:48 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -432,11 +432,11 @@ dh_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) | |||
432 | } | 432 | } |
433 | 433 | ||
434 | static int | 434 | static int |
435 | dh_missing_parameters(const EVP_PKEY *a) | 435 | dh_missing_parameters(const EVP_PKEY *pkey) |
436 | { | 436 | { |
437 | if (!a->pkey.dh->p || !a->pkey.dh->g) | 437 | const DH *dh = pkey->pkey.dh; |
438 | return 1; | 438 | |
439 | return 0; | 439 | return dh->p == NULL || dh->g == NULL; |
440 | } | 440 | } |
441 | 441 | ||
442 | static int | 442 | 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 @@ | |||
1 | /* $OpenBSD: dsa_ameth.c,v 1.51 2023/08/11 13:57:24 tb Exp $ */ | 1 | /* $OpenBSD: dsa_ameth.c,v 1.52 2023/08/12 07:43:48 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -353,12 +353,9 @@ dsa_security_bits(const EVP_PKEY *pkey) | |||
353 | static int | 353 | static int |
354 | dsa_missing_parameters(const EVP_PKEY *pkey) | 354 | dsa_missing_parameters(const EVP_PKEY *pkey) |
355 | { | 355 | { |
356 | DSA *dsa; | 356 | const DSA *dsa = pkey->pkey.dsa; |
357 | 357 | ||
358 | dsa = pkey->pkey.dsa; | 358 | return dsa->p == NULL || dsa->q == NULL || dsa->g == NULL; |
359 | if (dsa->p == NULL || dsa->q == NULL || dsa->g == NULL) | ||
360 | return 1; | ||
361 | return 0; | ||
362 | } | 359 | } |
363 | 360 | ||
364 | static int | 361 | static int |