xref: /openbsd-src/lib/libcrypto/man/X509_STORE_set1_param.3 (revision 99fd087599a8791921855f21bd7e36130f39aadc)
1.\" $OpenBSD: X509_STORE_set1_param.3,v 1.16 2019/06/06 01:06:59 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: June 6 2019 $
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
105into the verification parameter object contained in the
106.Fa store .
107.Pp
108.Fn X509_VERIFY_PARAM_set_flags ,
109.Fn X509_STORE_set_purpose ,
110.Fn X509_STORE_set_trust ,
111and
112.Fn X509_STORE_set_depth
113call
114.Fn X509_VERIFY_PARAM_set_flags ,
115.Fn X509_VERIFY_PARAM_set_purpose ,
116.Fn X509_VERIFY_PARAM_set_trust ,
117and
118.Fn X509_VERIFY_PARAM_set_depth
119on the verification parameter object contained in the
120.Fa store .
121.Pp
122.Fn X509_STORE_add_cert
123and
124.Fn X509_STORE_add_crl
125add the certificate
126.Fa x
127or the certificate revocation list
128.Fa crl
129to the
130.Fa store ,
131increasing its reference count by 1 in case of success.
132Untrusted objects should not be added in this way.
133.Pp
134.Fn X509_STORE_get_ex_new_index ,
135.Fn X509_STORE_set_ex_data ,
136and
137.Fn X509_STORE_get_ex_data
138handle application specific data in
139.Vt X509_STORE
140objects.
141Their usage is identical to that of
142.Xr RSA_get_ex_new_index 3 ,
143.Xr RSA_set_ex_data 3 ,
144and
145.Xr RSA_get_ex_data 3 .
146.Sh RETURN VALUES
147.Fn X509_STORE_set1_param ,
148.Fn X509_STORE_set_purpose ,
149.Fn X509_STORE_set_trust ,
150and
151.Fn X509_STORE_set_ex_data
152return 1 for success or 0 for failure.
153.Pp
154.Fn X509_STORE_set_flags
155and
156.Fn X509_STORE_set_depth
157always return 1, indicating success.
158.Pp
159.Fn X509_STORE_add_cert
160and
161.Fn X509_STORE_add_crl
162return 1 for success or 0 for failure.
163For example, they fail if
164.Fa x
165or
166.Fa crl
167is a
168.Dv NULL
169pointer, if a certificate with the same subject name as
170.Fa x
171or a revocation list with the same issuer name as
172.Fa crl
173are already contained in the
174.Fa store ,
175or if memory allocation fails.
176.Pp
177.Fn X509_STORE_get0_param
178returns an internal pointer to the verification parameter object
179contained in the
180.Fa store ,
181.Fn X509_STORE_get0_objects
182to the stack of certificates, revocation lists, and private keys.
183The returned pointers must not be freed by the calling application.
184.Pp
185.Fn X509_STORE_get_ex_new_index
186returns a new index or \-1 on failure.
187.Pp
188.Fn X509_STORE_get_ex_data
189returns the application data or
190.Dv NULL
191on failure.
192.Sh SEE ALSO
193.Xr RSA_get_ex_new_index 3 ,
194.Xr SSL_set1_param 3 ,
195.Xr X509_OBJECT_get0_X509 3 ,
196.Xr X509_STORE_CTX_set0_param 3 ,
197.Xr X509_STORE_load_locations 3 ,
198.Xr X509_STORE_new 3 ,
199.Xr X509_VERIFY_PARAM_set_flags 3
200.Sh HISTORY
201.Fn X509_STORE_add_cert
202first appeared in SSLeay 0.8.0.
203.Fn X509_STORE_add_crl
204first appeared in SSLeay 0.9.0.
205These functions have been available since
206.Ox 2.4 .
207.Pp
208.Fn X509_STORE_set_flags ,
209.Fn X509_STORE_set_purpose ,
210and
211.Fn X509_STORE_set_trust
212first appeared in OpenSSL 0.9.7 and have been available since
213.Ox 3.2 .
214.Pp
215.Fn X509_STORE_set1_param
216and
217.Fn X509_STORE_set_depth
218first appeared in OpenSSL 0.9.8 and have been available since
219.Ox 4.5 .
220.Pp
221.Fn X509_STORE_get0_param ,
222.Fn X509_STORE_get0_objects ,
223.Fn X509_STORE_get_ex_new_index ,
224.Fn X509_STORE_set_ex_data ,
225and
226.Fn X509_STORE_get_ex_data
227first appeared in OpenSSL 1.1.0 and have been available since
228.Ox 6.3 .
229