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

More EVP_PKEY patches for new functionality.

上级 cb0f35d7
......@@ -1228,6 +1228,7 @@ int verbose;
goto err;
}
i=X509_REQ_verify(req,pktmp);
EVP_PKEY_free(pktmp);
if (i < 0)
{
ok=0;
......@@ -1297,6 +1298,7 @@ int verbose;
goto err;
}
i=X509_verify(req,pktmp);
EVP_PKEY_free(pktmp);
if (i < 0)
{
ok=0;
......@@ -1651,7 +1653,9 @@ again2:
if (!X509_set_subject_name(ret,subject)) goto err;
pktmp=X509_REQ_get_pubkey(req);
if (!X509_set_pubkey(ret,pktmp)) goto err;
i = X509_set_pubkey(ret,pktmp);
EVP_PKEY_free(pktmp);
if (!i) goto err;
/* Lets add the extensions, if there are any */
if ((extensions != NULL) && (sk_num(extensions) > 0))
......@@ -1701,6 +1705,7 @@ again2:
if (EVP_PKEY_missing_parameters(pktmp) &&
!EVP_PKEY_missing_parameters(pkey))
EVP_PKEY_copy_parameters(pktmp,pkey);
EVP_PKEY_free(pktmp);
#endif
if (!X509_sign(ret,pkey,dgst))
......@@ -1953,6 +1958,7 @@ int verbose;
BIO_printf(bio_err,"Signature ok\n");
X509_REQ_set_pubkey(req,pktmp);
EVP_PKEY_free(pktmp);
ok=do_body(xret,pkey,x509,dgst,policy,db,serial,startdate,
days,1,verbose,req,extensions);
err:
......
......@@ -624,6 +624,7 @@ loop:
}
if (x509)
{
EVP_PKEY *tmppkey;
if ((x509ss=X509_new()) == NULL) goto end;
/* don't set the version number, for starters
......@@ -639,7 +640,9 @@ loop:
(long)60*60*24*days);
X509_set_subject_name(x509ss,
X509_REQ_get_subject_name(req));
X509_set_pubkey(x509ss,X509_REQ_get_pubkey(req));
tmppkey = X509_REQ_get_pubkey(req);
X509_set_pubkey(x509ss,tmppkey);
EVP_PKEY_free(tmppkey);
if (!(i=X509_sign(x509ss,pkey,digest)))
goto end;
......
......@@ -402,7 +402,9 @@ bad:
ci->key=req->req_info->pubkey;
req->req_info->pubkey=NULL;
#else
X509_set_pubkey(x,X509_REQ_get_pubkey(req));
pkey = X509_REQ_get_pubkey(req);
X509_set_pubkey(x,pkey);
EVP_PKEY_free(pkey);
#endif
}
else
......@@ -715,7 +717,9 @@ int days;
X509_STORE_CTX xsc;
EVP_PKEY *upkey;
EVP_PKEY_copy_parameters(X509_get_pubkey(xca),pkey);
upkey = X509_get_pubkey(xca);
EVP_PKEY_copy_parameters(upkey,pkey);
EVP_PKEY_free(upkey);
X509_STORE_CTX_init(&xsc,ctx,x,NULL);
buf=(char *)Malloc(EVP_PKEY_size(pkey)*2+
......@@ -833,6 +837,7 @@ int days;
/* Force a re-write */
X509_set_pubkey(x,upkey);
}
EVP_PKEY_free(upkey);
if (!X509_sign(x,pkey,digest)) goto end;
ret=1;
......@@ -1033,8 +1038,12 @@ int days;
EVP_MD *digest;
{
EVP_PKEY_copy_parameters(X509_get_pubkey(x),pkey);
EVP_PKEY_save_parameters(X509_get_pubkey(x),1);
EVP_PKEY *pktmp;
pktmp = X509_get_pubkey(x);
EVP_PKEY_copy_parameters(pktmp,pkey);
EVP_PKEY_save_parameters(pktmp,1);
EVP_PKEY_free(pktmp);
if (!X509_set_issuer_name(x,X509_get_subject_name(x))) goto err;
if (X509_gmtime_adj(X509_get_notBefore(x),0) == NULL) goto err;
......
......@@ -297,5 +297,6 @@ EVP_PKEY *k;
ok=1;
err:
EVP_PKEY_free(xk);
return(ok);
}
......@@ -74,6 +74,7 @@ EVP_MD *md;
X509_REQ *ret;
X509_REQ_INFO *ri;
int i;
EVP_PKEY *pktmp;
ret=X509_REQ_new();
if (ret == NULL)
......@@ -92,7 +93,9 @@ EVP_MD *md;
if (!X509_REQ_set_subject_name(ret,X509_get_subject_name(x)))
goto err;
i=X509_REQ_set_pubkey(ret,X509_get_pubkey(x));
pktmp = X509_get_pubkey(x);
i=X509_REQ_set_pubkey(ret,pktmp);
EVP_PKEY_free(pktmp);
if (!i) goto err;
if (pkey != NULL)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册