提交 b2c0518e 编写于 作者: D Dr. Stephen Henson

Fix bug in DSA, EC methods.

上级 d82e2718
...@@ -108,7 +108,7 @@ static int dsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) ...@@ -108,7 +108,7 @@ static int dsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
} }
ASN1_INTEGER_free(public_key); ASN1_INTEGER_free(public_key);
EVP_PKEY_assign_DSA(pkey, dsa);
return 1; return 1;
err: err:
...@@ -139,6 +139,7 @@ static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) ...@@ -139,6 +139,7 @@ static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE); DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
goto err; goto err;
} }
pval = str;
ptype = V_ASN1_SEQUENCE; ptype = V_ASN1_SEQUENCE;
} }
else else
......
...@@ -445,7 +445,6 @@ static int do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype) ...@@ -445,7 +445,6 @@ static int do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype)
goto err; goto err;
} }
if (ktype > 0) if (ktype > 0)
{ {
public_key = EC_KEY_get0_public_key(x); 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) ...@@ -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; reason = ERR_R_EC_LIB;
goto err; 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 (ktype == 2)
{ {
if ((i = (size_t)BN_num_bytes(priv_key)) > buf_len)
buf_len = i;
priv_key = EC_KEY_get0_private_key(x); 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 else
priv_key = NULL; priv_key = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册