summaryrefslogtreecommitdiffstats
path: root/crypto/dh
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-05-27 13:55:47 +0100
committerMatt Caswell <matt@openssl.org>2016-06-01 13:19:02 +0100
commit1d54ef340864507c1b6e86238183ab4cbc7423aa (patch)
treeb6b6764b719e7397a79289b717a1e68d00a5d313 /crypto/dh
parenteeb21772effdd385e44eed547d717f171487987e (diff)
Fix printing of DH Parameters
The -text argument to dhparam is broken, because the DHparams_print() function always returns an error. The problem is that always expects a public or private key to be present, even though that is never the case with parameters. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/dh')
-rw-r--r--crypto/dh/dh_ameth.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/dh/dh_ameth.c b/crypto/dh/dh_ameth.c
index b7b37177c1..78aea36093 100644
--- a/crypto/dh/dh_ameth.c
+++ b/crypto/dh/dh_ameth.c
@@ -280,7 +280,8 @@ static int do_dh_print(BIO *bp, const DH *x, int indent, int ptype)
else
pub_key = NULL;
- if (priv_key == NULL && pub_key == NULL) {
+ if (x->p == NULL || (ptype == 2 && priv_key == NULL)
+ || (ptype > 0 && pub_key == NULL)) {
reason = ERR_R_PASSED_NULL_PARAMETER;
goto err;
}