[openssl] master update
beldmit at gmail.com
beldmit at gmail.com
Thu Feb 18 11:05:25 UTC 2021
The branch master has been updated
via 5d8ffebbcdf4992d3c428201b1f3330020bbe92e (commit)
from 0b3139e815d3d14c4d7506488add6e02a2b682ec (commit)
- Log -----------------------------------------------------------------
commit 5d8ffebbcdf4992d3c428201b1f3330020bbe92e
Author: Sahana Prasad <sahana at redhat.com>
Date: Mon Jan 25 14:44:29 2021 +0100
DH: Make DH_bits(), DH_size(), and DH_security_bits() check that there are key parameters
Fixes #13569
Signed-off-by: Sahana Prasad <sahana at redhat.com>
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Paul Dale <pauli at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13955)
-----------------------------------------------------------------------
Summary of changes:
crypto/dh/dh_lib.c | 12 +++++++++---
doc/man3/DH_size.pod | 9 ++++++---
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c
index e8a66878ab..46aba02bad 100644
--- a/crypto/dh/dh_lib.c
+++ b/crypto/dh/dh_lib.c
@@ -187,12 +187,16 @@ void *DH_get_ex_data(const DH *d, int idx)
int DH_bits(const DH *dh)
{
- return BN_num_bits(dh->params.p);
+ if (dh->params.p != NULL)
+ return BN_num_bits(dh->params.p);
+ return -1;
}
int DH_size(const DH *dh)
{
- return BN_num_bytes(dh->params.p);
+ if (dh->params.p != NULL)
+ return BN_num_bytes(dh->params.p);
+ return -1;
}
int DH_security_bits(const DH *dh)
@@ -204,7 +208,9 @@ int DH_security_bits(const DH *dh)
N = dh->length;
else
N = -1;
- return BN_security_bits(BN_num_bits(dh->params.p), N);
+ if (dh->params.p != NULL)
+ return BN_security_bits(BN_num_bits(dh->params.p), N);
+ return -1;
}
void DH_get0_pqg(const DH *dh,
diff --git a/doc/man3/DH_size.pod b/doc/man3/DH_size.pod
index 099c1bad3f..99e34034f2 100644
--- a/doc/man3/DH_size.pod
+++ b/doc/man3/DH_size.pod
@@ -38,11 +38,14 @@ key. See L<BN_security_bits(3)>.
=head1 RETURN VALUES
-DH_bits() returns the number of bits in the key.
+DH_bits() returns the number of bits in the key, or -1 if
+B<dh> doesn't hold any key parameters.
-DH_size() returns the prime size of Diffie-Hellman in bytes.
+DH_size() returns the prime size of Diffie-Hellman in bytes, or -1 if
+B<dh> doesn't hold any key parameters.
-DH_security_bits() returns the number of security bits.
+DH_security_bits() returns the number of security bits, or -1 if
+B<dh> doesn't hold any key parameters.
=head1 SEE ALSO
More information about the openssl-commits
mailing list