-/* $OpenBSD: x509_set.c,v 1.26 2023/06/23 08:00:28 tb Exp $ */
+/* $OpenBSD: x509_set.c,v 1.27 2024/03/26 11:09:37 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
{
if (x == NULL)
return (0);
+ /*
+ * RFC 5280, 4.1: versions 1 - 3 are specified as follows.
+ * Version ::= INTEGER { v1(0), v2(1), v3(2) }
+ */
+ if (version < 0 || version > 2)
+ return (0);
if (x->cert_info->version == NULL) {
if ((x->cert_info->version = ASN1_INTEGER_new()) == NULL)
return (0);
-/* $OpenBSD: x509cset.c,v 1.19 2023/02/16 08:38:17 tb Exp $ */
+/* $OpenBSD: x509cset.c,v 1.20 2024/03/26 11:09:37 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2001.
*/
{
if (x == NULL)
return (0);
+ /*
+ * RFC 5280, 4.1: versions 1 - 3 are specified as follows.
+ * Version ::= INTEGER { v1(0), v2(1), v3(2) }
+ */
+ if (version < 0 || version > 1)
+ return (0);
if (x->crl->version == NULL) {
if ((x->crl->version = ASN1_INTEGER_new()) == NULL)
return (0);
-/* $OpenBSD: x509rset.c,v 1.14 2024/03/25 12:10:57 jsing Exp $ */
+/* $OpenBSD: x509rset.c,v 1.15 2024/03/26 11:09:37 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
{
if (x == NULL)
return (0);
+ /* RFC 2986 section 4.1 only specifies version 1, encoded as a 0. */
+ if (version != 0)
+ return (0);
x->req_info->enc.modified = 1;
return (ASN1_INTEGER_set(x->req_info->version, version));
}