summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/asn1/x_attrib.c7
-rw-r--r--src/lib/libcrypto/man/PKCS7_add_attribute.316
2 files changed, 9 insertions, 14 deletions
diff --git a/src/lib/libcrypto/asn1/x_attrib.c b/src/lib/libcrypto/asn1/x_attrib.c
index bb74a1b6c7..04816eab77 100644
--- a/src/lib/libcrypto/asn1/x_attrib.c
+++ b/src/lib/libcrypto/asn1/x_attrib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_attrib.c,v 1.13 2015/02/14 14:56:45 jsing Exp $ */ 1/* $OpenBSD: x_attrib.c,v 1.14 2020/06/04 21:21:03 schwarze 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 *
@@ -174,10 +174,13 @@ X509_ATTRIBUTE_create(int nid, int atrtype, void *value)
174{ 174{
175 X509_ATTRIBUTE *ret = NULL; 175 X509_ATTRIBUTE *ret = NULL;
176 ASN1_TYPE *val = NULL; 176 ASN1_TYPE *val = NULL;
177 ASN1_OBJECT *oid;
177 178
179 if ((oid = OBJ_nid2obj(nid)) == NULL)
180 return (NULL);
178 if ((ret = X509_ATTRIBUTE_new()) == NULL) 181 if ((ret = X509_ATTRIBUTE_new()) == NULL)
179 return (NULL); 182 return (NULL);
180 ret->object = OBJ_nid2obj(nid); 183 ret->object = oid;
181 ret->single = 0; 184 ret->single = 0;
182 if ((ret->value.set = sk_ASN1_TYPE_new_null()) == NULL) 185 if ((ret->value.set = sk_ASN1_TYPE_new_null()) == NULL)
183 goto err; 186 goto err;
diff --git a/src/lib/libcrypto/man/PKCS7_add_attribute.3 b/src/lib/libcrypto/man/PKCS7_add_attribute.3
index 09c36a4d5d..081703f0f3 100644
--- a/src/lib/libcrypto/man/PKCS7_add_attribute.3
+++ b/src/lib/libcrypto/man/PKCS7_add_attribute.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PKCS7_add_attribute.3,v 1.1 2020/06/04 10:24:27 schwarze Exp $ 1.\" $OpenBSD: PKCS7_add_attribute.3,v 1.2 2020/06/04 21:21:03 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
4.\" 4.\"
@@ -123,7 +123,9 @@ exist.
123and 123and
124.Fn PKCS7_add_signed_attribute 124.Fn PKCS7_add_signed_attribute
125return 1 on success or 0 on failure. 125return 1 on success or 0 on failure.
126The most common reason for failure is lack of memory. 126The most common reasons for failure are an invalid
127.Fa nid
128argument or lack of memory.
127.Pp 129.Pp
128.Fn PKCS7_get_attribute 130.Fn PKCS7_get_attribute
129and 131and
@@ -153,16 +155,6 @@ These functions first appeared in OpenSSL 0.9.1
153and have been available since 155and have been available since
154.Ox 2.6 . 156.Ox 2.6 .
155.Sh BUGS 157.Sh BUGS
156Adding an attribute with an invalid
157.Fa nid
158ought to fail, but it actually succeeds
159setting the type of the new attribute to
160.Dv NULL .
161Subsequent attempts to retrieve attributes
162may cause the program to crash due to
163.Dv NULL
164pointer access.
165.Pp
166A function to remove individual attributes from these lists 158A function to remove individual attributes from these lists
167does not appear to exist. 159does not appear to exist.
168A program desiring to do that might have to manually iterate the fields 160A program desiring to do that might have to manually iterate the fields