--- /dev/null
+.\" $OpenBSD: X509at_add1_attr.3,v 1.1 2021/10/22 13:29:41 schwarze Exp $
+.\"
+.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: October 22 2021 $
+.Dt X509AT_ADD1_ATTR 3
+.Os
+.Sh NAME
+.Nm X509at_add1_attr ,
+.Nm X509at_add1_attr_by_OBJ ,
+.Nm X509at_add1_attr_by_NID ,
+.Nm X509at_add1_attr_by_txt ,
+.Nm X509at_delete_attr
+.Nd change an array of X.501 Attribute objects
+.Sh SYNOPSIS
+.In openssl/x509.h
+.Ft STACK_OF(X509_ATTRIBUTE) *
+.Fo X509at_add1_attr
+.Fa "STACK_OF(X509_ATTRIBUTE) **pattrs"
+.Fa "X509_ATTRIBUTE *attr"
+.Fc
+.Ft STACK_OF(X509_ATTRIBUTE) *
+.Fo X509at_add1_attr_by_OBJ
+.Fa "STACK_OF(X509_ATTRIBUTE) **pattrs"
+.Fa "const ASN1_OBJECT *obj"
+.Fa "int type"
+.Fa "const unsigned char *data"
+.Fa "int len"
+.Fc
+.Ft STACK_OF(X509_ATTRIBUTE) *
+.Fo X509at_add1_attr_by_NID
+.Fa "STACK_OF(X509_ATTRIBUTE) **pattrs"
+.Fa "int nid"
+.Fa "int type"
+.Fa "const unsigned char *data"
+.Fa "int len"
+.Fc
+.Ft STACK_OF(X509_ATTRIBUTE) *
+.Fo X509at_add1_attr_by_txt
+.Fa "STACK_OF(X509_ATTRIBUTE) **pattrs"
+.Fa "const char *name"
+.Fa "int type"
+.Fa "const unsigned char *data"
+.Fa "int len"
+.Fc
+.Ft X509_ATTRIBUTE *
+.Fo X509at_delete_attr
+.Fa "STACK_OF(X509_ATTRIBUTE) *attrs"
+.Fa "int index"
+.Fc
+.Sh DESCRIPTION
+.Fn X509at_add1_attr
+appends a deep copy of
+.Fa attr
+to the end of
+.Pf ** Fa pattrs .
+If
+.Pf * Fa pattrs
+is
+.Dv NULL ,
+a new array is allocated, and in case of success,
+a pointer to it is assigned to
+.Pf * Fa pattrs .
+.Pp
+.Fn X509at_add1_attr_by_OBJ ,
+.Fn X509at_add1_attr_by_NID ,
+and
+.Fn X509at_add1_attr_by_txt
+create a new X.501 Attribute object using
+.Xr X509_ATTRIBUTE_create_by_OBJ 3 ,
+.Xr X509_ATTRIBUTE_create_by_NID 3 ,
+or
+.Xr X509_ATTRIBUTE_create_by_txt 3 ,
+respectively, and append it to
+.Pf ** Fa pattrs
+using
+.Fn X509at_add1_attr .
+.Pp
+.Fn X509at_delete_attr
+deletes the element with the zero-based
+.Fa index
+from the array
+.Pf * Fa attrs .
+.Sh RETURN VALUES
+.Fn X509at_add1_attr ,
+.Fn X509at_add1_attr_by_OBJ ,
+.Fn X509at_add1_attr_by_NID ,
+and
+.Fn X509at_add1_attr_by_txt
+return a pointer to the modified or new array or
+.Dv NULL
+if the
+.Fa pattrs
+argument is
+.Dv NULL
+or if creating or copying the X.501 Attribute object
+or memory allocation fails.
+.Pp
+.Fn X509at_delete_attr
+returns the deleted element or
+.Dv NULL
+if
+.Fa attrs
+is
+.Dv NULL
+or if the requested
+.Fa index
+is negative or greater than or equal to the number of objects in
+.Pf * Fa attrs .
+.Sh SEE ALSO
+.Xr OBJ_nid2obj 3 ,
+.Xr STACK_OF 3 ,
+.Xr X509_ATTRIBUTE_create_by_OBJ 3 ,
+.Xr X509_ATTRIBUTE_new 3 ,
+.Xr X509at_get_attr 3
+.Sh HISTORY
+These funtions first appeared in OpenSSL 0.9.5
+and have been available since
+.Ox 2.7 .