xref: /openbsd-src/lib/libcrypto/man/X509_STORE_set1_param.3 (revision 68dd5bb1859285b71cb62a10bf107b8ad54064d9)
1.\" $OpenBSD: X509_STORE_set1_param.3,v 1.20 2023/11/16 20:27:43 schwarze Exp $
2.\" content checked up to:
3.\" OpenSSL man3/X509_STORE_add_cert b0edda11 Mar 20 13:00:17 2018 +0000
4.\" OpenSSL man3/X509_STORE_get0_param e90fc053 Jul 15 09:39:45 2017 -0400
5.\"
6.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
7.\"
8.\" Permission to use, copy, modify, and distribute this software for any
9.\" purpose with or without fee is hereby granted, provided that the above
10.\" copyright notice and this permission notice appear in all copies.
11.\"
12.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19.\"
20.Dd $Mdocdate: November 16 2023 $
21.Dt X509_STORE_SET1_PARAM 3
22.Os
23.Sh NAME
24.Nm X509_STORE_set1_param ,
25.Nm X509_STORE_set_flags ,
26.Nm X509_STORE_set_purpose ,
27.Nm X509_STORE_set_trust ,
28.Nm X509_STORE_set_depth ,
29.Nm X509_STORE_add_cert ,
30.Nm X509_STORE_add_crl ,
31.Nm X509_STORE_get0_param ,
32.Nm X509_STORE_get0_objects ,
33.Nm X509_STORE_get_ex_new_index ,
34.Nm X509_STORE_set_ex_data ,
35.Nm X509_STORE_get_ex_data
36.Nd get and set X509_STORE data
37.Sh SYNOPSIS
38.In openssl/x509_vfy.h
39.Ft int
40.Fo X509_STORE_set1_param
41.Fa "X509_STORE *store"
42.Fa "X509_VERIFY_PARAM *pm"
43.Fc
44.Ft int
45.Fo X509_STORE_set_flags
46.Fa "X509_STORE *store"
47.Fa "unsigned long flags"
48.Fc
49.Ft int
50.Fo X509_STORE_set_purpose
51.Fa "X509_STORE *store"
52.Fa "int purpose"
53.Fc
54.Ft int
55.Fo X509_STORE_set_trust
56.Fa "X509_STORE *store"
57.Fa "int trust"
58.Fc
59.Ft int
60.Fo X509_STORE_set_depth
61.Fa "X509_STORE *store"
62.Fa "int depth"
63.Fc
64.Ft int
65.Fo X509_STORE_add_cert
66.Fa "X509_STORE *store"
67.Fa "X509 *x"
68.Fc
69.Ft int
70.Fo X509_STORE_add_crl
71.Fa "X509_STORE *store"
72.Fa "X509_CRL *crl"
73.Fc
74.Ft X509_VERIFY_PARAM *
75.Fo X509_STORE_get0_param
76.Fa "X509_STORE *store"
77.Fc
78.Ft STACK_OF(X509_OBJECT) *
79.Fo X509_STORE_get0_objects
80.Fa "X509_STORE *store"
81.Fc
82.Ft int
83.Fo X509_STORE_get_ex_new_index
84.Fa "long argl"
85.Fa "void *argp"
86.Fa "CRYPTO_EX_new *new_func"
87.Fa "CRYPTO_EX_dup *dup_func"
88.Fa "CRYPTO_EX_free *free_func"
89.Fc
90.Ft int
91.Fo X509_STORE_set_ex_data
92.Fa "X509_STORE *store"
93.Fa "int idx"
94.Fa "void *arg"
95.Fc
96.Ft void *
97.Fo X509_STORE_get_ex_data
98.Fa "X509_STORE *store"
99.Fa "int idx"
100.Fc
101.Sh DESCRIPTION
102.Fn X509_STORE_set1_param
103copies the verification parameters from
104.Fa pm
105using
106.Xr X509_VERIFY_PARAM_set1 3
107into the verification parameter object contained in the
108.Fa store .
109.Pp
110.Fn X509_VERIFY_PARAM_set_flags ,
111.Fn X509_STORE_set_purpose ,
112.Fn X509_STORE_set_trust ,
113and
114.Fn X509_STORE_set_depth
115call
116.Fn X509_VERIFY_PARAM_set_flags ,
117.Fn X509_VERIFY_PARAM_set_purpose ,
118.Fn X509_VERIFY_PARAM_set_trust ,
119and
120.Fn X509_VERIFY_PARAM_set_depth
121on the verification parameter object contained in the
122.Fa store .
123.Pp
124.Fn X509_STORE_add_cert
125and
126.Fn X509_STORE_add_crl
127add the certificate
128.Fa x
129or the certificate revocation list
130.Fa crl
131to the
132.Fa store ,
133increasing its reference count by 1 in case of success.
134Untrusted objects should not be added in this way.
135.Pp
136.Fn X509_STORE_get_ex_new_index ,
137.Fn X509_STORE_set_ex_data ,
138and
139.Fn X509_STORE_get_ex_data
140handle application specific data in
141.Vt X509_STORE
142objects.
143Their usage is identical to that of
144.Xr RSA_get_ex_new_index 3 ,
145.Xr RSA_set_ex_data 3 ,
146and
147.Xr RSA_get_ex_data 3 .
148.Fn X509_STORE_get_ex_new_index
149is implemented as a macro.
150.Sh RETURN VALUES
151.Fn X509_STORE_set1_param ,
152.Fn X509_STORE_set_purpose ,
153.Fn X509_STORE_set_trust ,
154and
155.Fn X509_STORE_set_ex_data
156return 1 for success or 0 for failure.
157.Pp
158.Fn X509_STORE_set_flags
159and
160.Fn X509_STORE_set_depth
161always return 1, indicating success.
162.Pp
163.Fn X509_STORE_add_cert
164and
165.Fn X509_STORE_add_crl
166return 1 for success or 0 for failure.
167For example, they fail if
168.Fa x
169or
170.Fa crl
171is a
172.Dv NULL
173pointer, if a certificate with the same subject name as
174.Fa x
175or a revocation list with the same issuer name as
176.Fa crl
177are already contained in the
178.Fa store ,
179or if memory allocation fails.
180.Pp
181.Fn X509_STORE_get0_param
182returns an internal pointer to the verification parameter object
183contained in the
184.Fa store ,
185.Fn X509_STORE_get0_objects
186to the stack of certificates, revocation lists, and private keys.
187The returned pointers must not be freed by the calling application.
188.Pp
189.Fn X509_STORE_get_ex_new_index
190returns a new index or \-1 on failure.
191.Pp
192.Fn X509_STORE_get_ex_data
193returns the application data or
194.Dv NULL
195on failure.
196.Sh SEE ALSO
197.Xr RSA_get_ex_new_index 3 ,
198.Xr SSL_set1_param 3 ,
199.Xr X509_LOOKUP_new 3 ,
200.Xr X509_OBJECT_get0_X509 3 ,
201.Xr X509_STORE_CTX_set0_param 3 ,
202.Xr X509_STORE_load_locations 3 ,
203.Xr X509_STORE_new 3 ,
204.Xr X509_VERIFY_PARAM_new 3 ,
205.Xr X509_VERIFY_PARAM_set_flags 3
206.Sh HISTORY
207.Fn X509_STORE_add_cert
208first appeared in SSLeay 0.8.0.
209.Fn X509_STORE_add_crl
210first appeared in SSLeay 0.9.0.
211These functions have been available since
212.Ox 2.4 .
213.Pp
214.Fn X509_STORE_set_flags ,
215.Fn X509_STORE_set_purpose ,
216and
217.Fn X509_STORE_set_trust
218first appeared in OpenSSL 0.9.7 and have been available since
219.Ox 3.2 .
220.Pp
221.Fn X509_STORE_set1_param
222and
223.Fn X509_STORE_set_depth
224first appeared in OpenSSL 0.9.8 and have been available since
225.Ox 4.5 .
226.Pp
227.Fn X509_STORE_get0_param ,
228.Fn X509_STORE_get0_objects ,
229.Fn X509_STORE_get_ex_new_index ,
230.Fn X509_STORE_set_ex_data ,
231and
232.Fn X509_STORE_get_ex_data
233first appeared in OpenSSL 1.1.0 and have been available since
234.Ox 6.3 .
235