summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2023-10-10 13:59:47 +0000
committertb <>2023-10-10 13:59:47 +0000
commit5cbf5fcfb7c8f024018bdd341230dd05f331967a (patch)
tree839fb7d8c6ba2e45887042205322c320300755fc /src
parentd808914bdc17a47e22e7adf00aa95bf465f95b4f (diff)
downloadopenbsd-5cbf5fcfb7c8f024018bdd341230dd05f331967a.tar.gz
openbsd-5cbf5fcfb7c8f024018bdd341230dd05f331967a.tar.bz2
openbsd-5cbf5fcfb7c8f024018bdd341230dd05f331967a.zip
Improve X509_ALGOR_new(3) documentation
The previous wording was misleading since the result of X509_ALGOR_new() is not actually an empty X509_ALGOR object. Rather, it contains the undefined ASN1_OBJECT returned by OBJ_nid2obj(NID_undef). Therefore using X509_ALGOR_get0(3) for error checking X509_ALGOR_set_md() is not trivial. So: change the initial paragraph into a general intro referring to the OpenSSL API needed to interface with X509_ALGOR and write a new paragraph documenting X509_ALGOR_new(3) and drop the incorrect suggestion of an error check. Notably there's now a reference to the OBJ_nid2obj() family without which one cannot really use X509_ALGOR_* for anything at all. With and ok schwarze
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/X509_ALGOR_dup.347
1 files changed, 33 insertions, 14 deletions
diff --git a/src/lib/libcrypto/man/X509_ALGOR_dup.3 b/src/lib/libcrypto/man/X509_ALGOR_dup.3
index 56d9674c7c..0b878b7a86 100644
--- a/src/lib/libcrypto/man/X509_ALGOR_dup.3
+++ b/src/lib/libcrypto/man/X509_ALGOR_dup.3
@@ -1,9 +1,10 @@
1.\" $OpenBSD: X509_ALGOR_dup.3,v 1.18 2023/10/09 16:59:55 tb Exp $ 1.\" $OpenBSD: X509_ALGOR_dup.3,v 1.19 2023/10/10 13:59:47 tb Exp $
2.\" OpenSSL 4692340e Jun 7 15:49:08 2016 -0400 2.\" OpenSSL 4692340e Jun 7 15:49:08 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license: 5.\" The changes are covered by the following Copyright and license:
6.\" 6.\"
7.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
7.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 8.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
8.\" 9.\"
9.\" Permission to use, copy, modify, and distribute this software for any 10.\" Permission to use, copy, modify, and distribute this software for any
@@ -65,7 +66,7 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 68.\"
68.Dd $Mdocdate: October 9 2023 $ 69.Dd $Mdocdate: October 10 2023 $
69.Dt X509_ALGOR_DUP 3 70.Dt X509_ALGOR_DUP 3
70.Os 71.Os
71.Sh NAME 72.Sh NAME
@@ -112,17 +113,39 @@
112.Fa "const X509_ALGOR *b" 113.Fa "const X509_ALGOR *b"
113.Fc 114.Fc
114.Sh DESCRIPTION 115.Sh DESCRIPTION
115.Fn X509_ALGOR_new 116An
116allocates and initializes an empty
117.Vt X509_ALGOR 117.Vt X509_ALGOR
118object, representing an ASN.1 118object represents an ASN.1
119.Vt AlgorithmIdentifier 119.Vt AlgorithmIdentifier
120structure defined in RFC 5280 section 4.1.1.2. 120structure defined in RFC 5280 section 4.1.1.2.
121Such objects can specify a cryptographic algorithm together 121It specifies a cryptographic
122with algorithm-specific parameters. 122.Fa algorithm
123They are used by many other objects, for example certificates, 123by an ASN.1 object identifier (OID) that can be obtained from
124.Xr OBJ_nid2obj 3 ,
125together with optional algorithm-specific
126.Fa parameters
127of the type
128.Vt ASN1_TYPE ,
129see
130.Xr ASN1_TYPE_set 3 .
131.Vt X509_ALGOR
132objects are used by many other objects, for example certificates,
124certificate revocation lists, and certificate requests. 133certificate revocation lists, and certificate requests.
125.Pp 134.Pp
135.Fn X509_ALGOR_new
136allocates a new
137.Vt X509_ALGOR
138object containing the object that
139.Xr OBJ_nid2obj 3
140returns for
141.Dv NID_undef
142as the
143.Fa algorithm
144and a
145.Dv NULL
146pointer as the
147.Fa parameters .
148.Pp
126.Fn X509_ALGOR_free 149.Fn X509_ALGOR_free
127frees 150frees
128.Fa alg 151.Fa alg
@@ -210,12 +233,7 @@ can leave
210.Fa alg 233.Fa alg
211in a corrupted state due to memory allocation failure. 234in a corrupted state due to memory allocation failure.
212This problem can be avoided by preallocating with an error-checked call to 235This problem can be avoided by preallocating with an error-checked call to
213.Fn X509_ALGOR_set0 alg NULL 0 NULL , 236.Fn X509_ALGOR_set0 alg NULL 0 NULL .
214or the failure can be identified by
215.Fn X509_ALGOR_get0 &aobj NULL NULL alg
216returning a
217.Dv NULL
218.Fa aobj .
219.Pp 237.Pp
220.Fn X509_ALGOR_cmp 238.Fn X509_ALGOR_cmp
221compares 239compares
@@ -249,6 +267,7 @@ have identical encodings or non-zero otherwise.
249.Xr ASN1_TYPE_set 3 , 267.Xr ASN1_TYPE_set 3 ,
250.Xr d2i_X509_ALGOR 3 , 268.Xr d2i_X509_ALGOR 3 ,
251.Xr EVP_DigestInit 3 , 269.Xr EVP_DigestInit 3 ,
270.Xr OBJ_nid2obj 3 ,
252.Xr X509_get0_signature 3 , 271.Xr X509_get0_signature 3 ,
253.Xr X509_new 3 , 272.Xr X509_new 3 ,
254.Xr X509_PUBKEY_get0_param 3 , 273.Xr X509_PUBKEY_get0_param 3 ,