aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ec/ec_ameth.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2006-03-23 14:04:39 +0000
committerDr. Stephen Henson <steve@openssl.org>2006-03-23 14:04:39 +0000
commitb2c0518e6ae73f09abadaac3d00e65ee0c315f14 (patch)
treeaed328c848822ba6f36ad80c009a2f45802769ac /crypto/ec/ec_ameth.c
parentd82e2718e2a1346b231abda31a102b144ac21090 (diff)
downloadopenssl-b2c0518e6ae73f09abadaac3d00e65ee0c315f14.tar.gz
Fix bug in DSA, EC methods.
Diffstat (limited to 'crypto/ec/ec_ameth.c')
-rw-r--r--crypto/ec/ec_ameth.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c
index da437faf2b..4a136619ab 100644
--- a/crypto/ec/ec_ameth.c
+++ b/crypto/ec/ec_ameth.c
@@ -445,7 +445,6 @@ static int do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype)
goto err;
}
-
if (ktype > 0)
{
public_key = EC_KEY_get0_public_key(x);
@@ -455,15 +454,15 @@ static int do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype)
reason = ERR_R_EC_LIB;
goto err;
}
- buf_len = (size_t)BN_num_bytes(pub_key);
+ if (pub_key)
+ buf_len = (size_t)BN_num_bytes(pub_key);
}
- else
if (ktype == 2)
{
- if ((i = (size_t)BN_num_bytes(priv_key)) > buf_len)
- buf_len = i;
priv_key = EC_KEY_get0_private_key(x);
+ if (priv_key && (i = (size_t)BN_num_bytes(priv_key)) > buf_len)
+ buf_len = i;
}
else
priv_key = NULL;