summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/X509V3_parse_list.3
blob: 447f1a5e943c452d7723175efc905ca1bd051b9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.\" $OpenBSD: X509V3_parse_list.3,v 1.2 2024/12/24 09:48:56 schwarze Exp $
.\"
.\" Copyright (c) 2024 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: December 24 2024 $
.Dt X509V3_PARSE_LIST 3
.Os
.Sh NAME
.Nm X509V3_parse_list ,
.Nm X509V3_conf_free
.Nd create and destroy CONF_VALUE objects
.Sh SYNOPSIS
.In openssl/x509v3.h
.Ft STACK_OF(CONF_VALUE) *
.Fn X509V3_parse_list "const char *string"
.Ft void
.Fn X509V3_conf_free "CONF_VALUE *conf"
.Sh DESCRIPTION
.Fn X509V3_parse_list
parses the
.Fa string
and allocates an array of
.Vt CONF_VALUE
objects according to the following rules.
.Bl -enum -width 2n
.It
The string is split into fields at comma
.Pq Sq \&,
characters.
.It
If a field contains a colon
.Pq Sq \&:
character, the part before the colon is regarded as a name
and the part after the first colon as the associated value.
Otherwise, the whole field is regarded as the name and
.Dv NULL
is used as the associated value.
.It
For each name and each value, leading and trailing whitespace as defined by
.Xr isspace 3
is ignored.
.It
Parsing ends when a NUL, carriage return, or newline character
is encountered.
.El
.Pp
A new, empty
.Vt STACK_OF(CONF_VALUE)
is allocated and for each parsed name, one
.Vt CONF_VALUE
structure containing the optional value is pushed onto it.
.Pp
.Fn X509V3_conf_free
releases all memory used by
.Fa conf .
If
.Fa conf
is
.Dv NULL ,
no action occurs.
.Pp
The typical way to release the memory returned from
.Fn X509V3_parse_list
is by calling
.Fn sk_CONF_VALUE_pop_free
on it, passing a pointer to the function
.Fn X509V3_conf_free
as the second argument.
.Sh RETURN VALUES
.Fn X509V3_parse_list
returns the new
.Vt STACK_OF(CONF_VALUE)
object or
.Dv NULL
if an error occurs, in particular if there isn't any name,
if the name before a colon or after a comma is empty,
if the value after a colon is empty,
or if memory allocation fails.
.Sh SEE ALSO
.Xr isspace 3 ,
.Xr sk_pop_free 3 ,
.Xr STACK_OF 3 ,
.Xr v2i_ASN1_BIT_STRING 3
.Sh HISTORY
.Fn X509V3_parse_list
and
.Fn X509V3_conf_free
first appeared in OpenSSL 0.9.2 and have been available since
.Ox 2.6 .