xref: /openbsd-src/lib/libcrypto/man/X509_STORE_set1_param.3 (revision 4e1ee0786f11cc571bd0be17d38e46f635c719fc)
1.\" $OpenBSD: X509_STORE_set1_param.3,v 1.19 2021/10/18 18:20:39 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: October 18 2021 $
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.Sh RETURN VALUES
149.Fn X509_STORE_set1_param ,
150.Fn X509_STORE_set_purpose ,
151.Fn X509_STORE_set_trust ,
152and
153.Fn X509_STORE_set_ex_data
154return 1 for success or 0 for failure.
155.Pp
156.Fn X509_STORE_set_flags
157and
158.Fn X509_STORE_set_depth
159always return 1, indicating success.
160.Pp
161.Fn X509_STORE_add_cert
162and
163.Fn X509_STORE_add_crl
164return 1 for success or 0 for failure.
165For example, they fail if
166.Fa x
167or
168.Fa crl
169is a
170.Dv NULL
171pointer, if a certificate with the same subject name as
172.Fa x
173or a revocation list with the same issuer name as
174.Fa crl
175are already contained in the
176.Fa store ,
177or if memory allocation fails.
178.Pp
179.Fn X509_STORE_get0_param
180returns an internal pointer to the verification parameter object
181contained in the
182.Fa store ,
183.Fn X509_STORE_get0_objects
184to the stack of certificates, revocation lists, and private keys.
185The returned pointers must not be freed by the calling application.
186.Pp
187.Fn X509_STORE_get_ex_new_index
188returns a new index or \-1 on failure.
189.Pp
190.Fn X509_STORE_get_ex_data
191returns the application data or
192.Dv NULL
193on failure.
194.Sh SEE ALSO
195.Xr RSA_get_ex_new_index 3 ,
196.Xr SSL_set1_param 3 ,
197.Xr X509_LOOKUP_new 3 ,
198.Xr X509_OBJECT_get0_X509 3 ,
199.Xr X509_STORE_CTX_set0_param 3 ,
200.Xr X509_STORE_load_locations 3 ,
201.Xr X509_STORE_new 3 ,
202.Xr X509_VERIFY_PARAM_new 3 ,
203.Xr X509_VERIFY_PARAM_set_flags 3
204.Sh HISTORY
205.Fn X509_STORE_add_cert
206first appeared in SSLeay 0.8.0.
207.Fn X509_STORE_add_crl
208first appeared in SSLeay 0.9.0.
209These functions have been available since
210.Ox 2.4 .
211.Pp
212.Fn X509_STORE_set_flags ,
213.Fn X509_STORE_set_purpose ,
214and
215.Fn X509_STORE_set_trust
216first appeared in OpenSSL 0.9.7 and have been available since
217.Ox 3.2 .
218.Pp
219.Fn X509_STORE_set1_param
220and
221.Fn X509_STORE_set_depth
222first appeared in OpenSSL 0.9.8 and have been available since
223.Ox 4.5 .
224.Pp
225.Fn X509_STORE_get0_param ,
226.Fn X509_STORE_get0_objects ,
227.Fn X509_STORE_get_ex_new_index ,
228.Fn X509_STORE_set_ex_data ,
229and
230.Fn X509_STORE_get_ex_data
231first appeared in OpenSSL 1.1.0 and have been available since
232.Ox 6.3 .
233