summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-11-19 09:19:54 +0000
committertb <>2023-11-19 09:19:54 +0000
commit17a25acb120829ec363541442e473586b1812714 (patch)
tree3daeb37de92dadf7f6de358fac902210ff0c57e2
parent3e25494c5893929089adcb46ca2253f6458f75cb (diff)
downloadopenbsd-17a25acb120829ec363541442e473586b1812714.tar.gz
openbsd-17a25acb120829ec363541442e473586b1812714.tar.bz2
openbsd-17a25acb120829ec363541442e473586b1812714.zip
openssl ts: convert to X509_ALGOR_set0()
ok jsing
-rw-r--r--src/usr.bin/openssl/ts.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/usr.bin/openssl/ts.c b/src/usr.bin/openssl/ts.c
index 84008183e7..c62f1dd6b5 100644
--- a/src/usr.bin/openssl/ts.c
+++ b/src/usr.bin/openssl/ts.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts.c,v 1.26 2023/03/06 14:32:06 tb Exp $ */ 1/* $OpenBSD: ts.c,v 1.27 2023/11/19 09:19:54 tb Exp $ */
2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL 2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
3 * project 2002. 3 * project 2002.
4 */ 4 */
@@ -599,7 +599,7 @@ create_query(BIO *data_bio, char *digest, const EVP_MD *md, const char *policy,
599 TS_MSG_IMPRINT *msg_imprint = NULL; 599 TS_MSG_IMPRINT *msg_imprint = NULL;
600 X509_ALGOR *algo = NULL; 600 X509_ALGOR *algo = NULL;
601 unsigned char *data = NULL; 601 unsigned char *data = NULL;
602 ASN1_OBJECT *policy_obj = NULL; 602 ASN1_OBJECT *md_obj = NULL, *policy_obj = NULL;
603 ASN1_INTEGER *nonce_asn1 = NULL; 603 ASN1_INTEGER *nonce_asn1 = NULL;
604 604
605 /* Setting default message digest. */ 605 /* Setting default message digest. */
@@ -621,11 +621,14 @@ create_query(BIO *data_bio, char *digest, const EVP_MD *md, const char *policy,
621 /* Adding algorithm. */ 621 /* Adding algorithm. */
622 if ((algo = X509_ALGOR_new()) == NULL) 622 if ((algo = X509_ALGOR_new()) == NULL)
623 goto err; 623 goto err;
624 if ((algo->algorithm = OBJ_nid2obj(EVP_MD_type(md))) == NULL) 624 if ((md_obj = OBJ_nid2obj(EVP_MD_type(md))) == NULL)
625 goto err; 625 goto err;
626 if ((algo->parameter = ASN1_TYPE_new()) == NULL) 626 /*
627 * This does not use X509_ALGOR_set_md() for historical reasons.
628 * See the comment in PKCS7_SIGNER_INFO_set() for details.
629 */
630 if (!X509_ALGOR_set0(algo, md_obj, V_ASN1_NULL, NULL))
627 goto err; 631 goto err;
628 algo->parameter->type = V_ASN1_NULL;
629 if (!TS_MSG_IMPRINT_set_algo(msg_imprint, algo)) 632 if (!TS_MSG_IMPRINT_set_algo(msg_imprint, algo))
630 goto err; 633 goto err;
631 634