summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509/x509_r2x.c
diff options
context:
space:
mode:
authorjob <>2023-04-25 09:46:36 +0000
committerjob <>2023-04-25 09:46:36 +0000
commit9f5c114f2613c79b3a6f5e64b9c599927e5d059b (patch)
tree440ec05447db860a385379f907fa7dada2b34caa /src/lib/libcrypto/x509/x509_r2x.c
parent1bc29cdc7769c9ce6d69cbb60efbf25c96ef3917 (diff)
downloadopenbsd-9f5c114f2613c79b3a6f5e64b9c599927e5d059b.tar.gz
openbsd-9f5c114f2613c79b3a6f5e64b9c599927e5d059b.tar.bz2
openbsd-9f5c114f2613c79b3a6f5e64b9c599927e5d059b.zip
Use X509_set_version() and X509_REQ_set_version() instead doing it by hand
A small side-effect in X509_to_X509_REQ() is that 'x->req_info->enc.modified' now earlier on is set to 1. OK tb@ jsing@
Diffstat (limited to 'src/lib/libcrypto/x509/x509_r2x.c')
-rw-r--r--src/lib/libcrypto/x509/x509_r2x.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/lib/libcrypto/x509/x509_r2x.c b/src/lib/libcrypto/x509/x509_r2x.c
index 99c423d8c9..39b392259b 100644
--- a/src/lib/libcrypto/x509/x509_r2x.c
+++ b/src/lib/libcrypto/x509/x509_r2x.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_r2x.c,v 1.16 2023/02/16 08:38:17 tb Exp $ */ 1/* $OpenBSD: x509_r2x.c,v 1.17 2023/04/25 09:46:36 job Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -85,9 +85,7 @@ X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey)
85 xi = ret->cert_info; 85 xi = ret->cert_info;
86 86
87 if (sk_X509_ATTRIBUTE_num(r->req_info->attributes) != 0) { 87 if (sk_X509_ATTRIBUTE_num(r->req_info->attributes) != 0) {
88 if ((xi->version = ASN1_INTEGER_new()) == NULL) 88 if (!X509_set_version(ret, 2))
89 goto err;
90 if (!ASN1_INTEGER_set(xi->version, 2))
91 goto err; 89 goto err;
92 } 90 }
93 91