]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/lib/libcrypto/man/X509_LOOKUP_meth_new.3
Upgrade Unbound to 1.9.2.
[FreeBSD/FreeBSD.git] / secure / lib / libcrypto / man / X509_LOOKUP_meth_new.3
1 .\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 .    ds C`
42 .    ds C'
43 'br\}
44 .\"
45 .\" Escape single quotes in literal strings from groff's Unicode transform.
46 .ie \n(.g .ds Aq \(aq
47 .el       .ds Aq '
48 .\"
49 .\" If the F register is >0, we'll generate index entries on stderr for
50 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
51 .\" entries marked with X<> in POD.  Of course, you'll have to process the
52 .\" output yourself in some meaningful fashion.
53 .\"
54 .\" Avoid warning from groff about undefined register 'F'.
55 .de IX
56 ..
57 .nr rF 0
58 .if \n(.g .if rF .nr rF 1
59 .if (\n(rF:(\n(.g==0)) \{\
60 .    if \nF \{\
61 .        de IX
62 .        tm Index:\\$1\t\\n%\t"\\$2"
63 ..
64 .        if !\nF==2 \{\
65 .            nr % 0
66 .            nr F 2
67 .        \}
68 .    \}
69 .\}
70 .rr rF
71 .\"
72 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
73 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
74 .    \" fudge factors for nroff and troff
75 .if n \{\
76 .    ds #H 0
77 .    ds #V .8m
78 .    ds #F .3m
79 .    ds #[ \f1
80 .    ds #] \fP
81 .\}
82 .if t \{\
83 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
84 .    ds #V .6m
85 .    ds #F 0
86 .    ds #[ \&
87 .    ds #] \&
88 .\}
89 .    \" simple accents for nroff and troff
90 .if n \{\
91 .    ds ' \&
92 .    ds ` \&
93 .    ds ^ \&
94 .    ds , \&
95 .    ds ~ ~
96 .    ds /
97 .\}
98 .if t \{\
99 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
100 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
101 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
102 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
103 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
104 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
105 .\}
106 .    \" troff and (daisy-wheel) nroff accents
107 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
108 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
109 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
110 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
111 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
112 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
113 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
114 .ds ae a\h'-(\w'a'u*4/10)'e
115 .ds Ae A\h'-(\w'A'u*4/10)'E
116 .    \" corrections for vroff
117 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
118 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
119 .    \" for low resolution devices (crt and lpr)
120 .if \n(.H>23 .if \n(.V>19 \
121 \{\
122 .    ds : e
123 .    ds 8 ss
124 .    ds o a
125 .    ds d- d\h'-1'\(ga
126 .    ds D- D\h'-1'\(hy
127 .    ds th \o'bp'
128 .    ds Th \o'LP'
129 .    ds ae ae
130 .    ds Ae AE
131 .\}
132 .rm #[ #] #H #V #F C
133 .\" ========================================================================
134 .\"
135 .IX Title "X509_LOOKUP_METH_NEW 3"
136 .TH X509_LOOKUP_METH_NEW 3 "2019-05-28" "1.1.1c" "OpenSSL"
137 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
138 .\" way too many mistakes in technical documents.
139 .if n .ad l
140 .nh
141 .SH "NAME"
142 X509_LOOKUP_meth_new, X509_LOOKUP_meth_free, X509_LOOKUP_meth_set_new_item, X509_LOOKUP_meth_get_new_item, X509_LOOKUP_meth_set_free, X509_LOOKUP_meth_get_free, X509_LOOKUP_meth_set_init, X509_LOOKUP_meth_get_init, X509_LOOKUP_meth_set_shutdown, X509_LOOKUP_meth_get_shutdown, X509_LOOKUP_ctrl_fn, X509_LOOKUP_meth_set_ctrl, X509_LOOKUP_meth_get_ctrl, X509_LOOKUP_get_by_subject_fn, X509_LOOKUP_meth_set_get_by_subject, X509_LOOKUP_meth_get_get_by_subject, X509_LOOKUP_get_by_issuer_serial_fn, X509_LOOKUP_meth_set_get_by_issuer_serial, X509_LOOKUP_meth_get_get_by_issuer_serial, X509_LOOKUP_get_by_fingerprint_fn, X509_LOOKUP_meth_set_get_by_fingerprint, X509_LOOKUP_meth_get_get_by_fingerprint, X509_LOOKUP_get_by_alias_fn, X509_LOOKUP_meth_set_get_by_alias, X509_LOOKUP_meth_get_get_by_alias, X509_LOOKUP_set_method_data, X509_LOOKUP_get_method_data, X509_LOOKUP_get_store, X509_OBJECT_set1_X509, X509_OBJECT_set1_X509_CRL \&\- Routines to build up X509_LOOKUP methods
143 .SH "SYNOPSIS"
144 .IX Header "SYNOPSIS"
145 .Vb 1
146 \& #include <openssl/x509_vfy.h>
147 \&
148 \& X509_LOOKUP_METHOD *X509_LOOKUP_meth_new(const char *name);
149 \& void X509_LOOKUP_meth_free(X509_LOOKUP_METHOD *method);
150 \&
151 \& int X509_LOOKUP_meth_set_new_item(X509_LOOKUP_METHOD *method,
152 \&                                   int (*new_item) (X509_LOOKUP *ctx));
153 \& int (*X509_LOOKUP_meth_get_new_item(const X509_LOOKUP_METHOD* method))
154 \&     (X509_LOOKUP *ctx);
155 \&
156 \& int X509_LOOKUP_meth_set_free(X509_LOOKUP_METHOD *method,
157 \&                               void (*free) (X509_LOOKUP *ctx));
158 \& void (*X509_LOOKUP_meth_get_free(const X509_LOOKUP_METHOD* method))
159 \&     (X509_LOOKUP *ctx);
160 \&
161 \& int X509_LOOKUP_meth_set_init(X509_LOOKUP_METHOD *method,
162 \&                               int (*init) (X509_LOOKUP *ctx));
163 \& int (*X509_LOOKUP_meth_get_init(const X509_LOOKUP_METHOD* method))
164 \&     (X509_LOOKUP *ctx);
165 \&
166 \& int X509_LOOKUP_meth_set_shutdown(X509_LOOKUP_METHOD *method,
167 \&                                   int (*shutdown) (X509_LOOKUP *ctx));
168 \& int (*X509_LOOKUP_meth_get_shutdown(const X509_LOOKUP_METHOD* method))
169 \&     (X509_LOOKUP *ctx);
170 \&
171 \& typedef int (*X509_LOOKUP_ctrl_fn)(X509_LOOKUP *ctx, int cmd, const char *argc,
172 \&                                    long argl, char **ret);
173 \& int X509_LOOKUP_meth_set_ctrl(X509_LOOKUP_METHOD *method,
174 \&     X509_LOOKUP_ctrl_fn ctrl_fn);
175 \& X509_LOOKUP_ctrl_fn X509_LOOKUP_meth_get_ctrl(const X509_LOOKUP_METHOD *method);
176 \&
177 \& typedef int (*X509_LOOKUP_get_by_subject_fn)(X509_LOOKUP *ctx,
178 \&                                              X509_LOOKUP_TYPE type,
179 \&                                              X509_NAME *name,
180 \&                                              X509_OBJECT *ret);
181 \& int X509_LOOKUP_meth_set_get_by_subject(X509_LOOKUP_METHOD *method,
182 \&     X509_LOOKUP_get_by_subject_fn fn);
183 \& X509_LOOKUP_get_by_subject_fn X509_LOOKUP_meth_get_get_by_subject(
184 \&     const X509_LOOKUP_METHOD *method);
185 \&
186 \& typedef int (*X509_LOOKUP_get_by_issuer_serial_fn)(X509_LOOKUP *ctx,
187 \&                                                    X509_LOOKUP_TYPE type,
188 \&                                                    X509_NAME *name,
189 \&                                                    ASN1_INTEGER *serial,
190 \&                                                    X509_OBJECT *ret);
191 \& int X509_LOOKUP_meth_set_get_by_issuer_serial(
192 \&     X509_LOOKUP_METHOD *method, X509_LOOKUP_get_by_issuer_serial_fn fn);
193 \& X509_LOOKUP_get_by_issuer_serial_fn X509_LOOKUP_meth_get_get_by_issuer_serial(
194 \&     const X509_LOOKUP_METHOD *method);
195 \&
196 \& typedef int (*X509_LOOKUP_get_by_fingerprint_fn)(X509_LOOKUP *ctx,
197 \&                                                  X509_LOOKUP_TYPE type,
198 \&                                                  const unsigned char* bytes,
199 \&                                                  int len,
200 \&                                                  X509_OBJECT *ret);
201 \& int X509_LOOKUP_meth_set_get_by_fingerprint(X509_LOOKUP_METHOD *method,
202 \&     X509_LOOKUP_get_by_fingerprint_fn fn);
203 \& X509_LOOKUP_get_by_fingerprint_fn X509_LOOKUP_meth_get_get_by_fingerprint(
204 \&     const X509_LOOKUP_METHOD *method);
205 \&
206 \& typedef int (*X509_LOOKUP_get_by_alias_fn)(X509_LOOKUP *ctx,
207 \&                                            X509_LOOKUP_TYPE type,
208 \&                                            const char *str,
209 \&                                            int len,
210 \&                                            X509_OBJECT *ret);
211 \& int X509_LOOKUP_meth_set_get_by_alias(X509_LOOKUP_METHOD *method,
212 \&     X509_LOOKUP_get_by_alias_fn fn);
213 \& X509_LOOKUP_get_by_alias_fn X509_LOOKUP_meth_get_get_by_alias(
214 \&     const X509_LOOKUP_METHOD *method);
215 \&
216 \& int X509_LOOKUP_set_method_data(X509_LOOKUP *ctx, void *data);
217 \& void *X509_LOOKUP_get_method_data(const X509_LOOKUP *ctx);
218 \&
219 \& X509_STORE *X509_LOOKUP_get_store(const X509_LOOKUP *ctx);
220 \&
221 \& int X509_OBJECT_set1_X509(X509_OBJECT *a, X509 *obj);
222 \& int X509_OBJECT_set1_X509_CRL(X509_OBJECT *a, X509_CRL *obj);
223 .Ve
224 .SH "DESCRIPTION"
225 .IX Header "DESCRIPTION"
226 The \fBX509_LOOKUP_METHOD\fR type is a structure used for the implementation of new
227 X509_LOOKUP types. It provides a set of functions used by OpenSSL for the
228 implementation of various X509 and X509_CRL lookup capabilities. One instance
229 of an X509_LOOKUP_METHOD can be associated to many instantiations of an
230 \&\fBX509_LOOKUP\fR structure.
231 .PP
232 \&\fBX509_LOOKUP_meth_new()\fR creates a new \fBX509_LOOKUP_METHOD\fR structure. It should
233 be given a human-readable string containing a brief description of the lookup
234 method.
235 .PP
236 \&\fBX509_LOOKUP_meth_free()\fR destroys a \fBX509_LOOKUP_METHOD\fR structure.
237 .PP
238 \&\fBX509_LOOKUP_get_new_item()\fR and \fBX509_LOOKUP_set_new_item()\fR get and set the
239 function that is called when an \fBX509_LOOKUP\fR object is created with
240 \&\fBX509_LOOKUP_new()\fR. If an X509_LOOKUP_METHOD requires any per\-X509_LOOKUP
241 specific data, the supplied new_item function should allocate this data and
242 invoke \fBX509_LOOKUP_set_method_data()\fR.
243 .PP
244 \&\fBX509_LOOKUP_get_free()\fR and \fBX509_LOOKUP_set_free()\fR get and set the function
245 that is used to free any method data that was allocated and set from within
246 new_item function.
247 .PP
248 \&\fBX509_LOOKUP_meth_get_init()\fR and \fBX509_LOOKUP_meth_set_init()\fR get and set the
249 function that is used to initialize the method data that was set with
250 \&\fBX509_LOOKUP_set_method_data()\fR as part of the new_item routine.
251 .PP
252 \&\fBX509_LOOKUP_meth_get_shutdown()\fR and \fBX509_LOOKUP_meth_set_shutdown()\fR get and set
253 the function that is used to shut down the method data whose state was
254 previously initialized in the init function.
255 .PP
256 \&\fBX509_LOOKUP_meth_get_ctrl()\fR and \fBX509_LOOKUP_meth_set_ctrl()\fR get and set a
257 function to be used to handle arbitrary control commands issued by
258 \&\fBX509_LOOKUP_ctrl()\fR. The control function is given the X509_LOOKUP
259 \&\fBctx\fR, along with the arguments passed by X509_LOOKUP_ctrl. \fBcmd\fR is
260 an arbitrary integer that defines some operation. \fBargc\fR is a pointer
261 to an array of characters. \fBargl\fR is an integer. \fBret\fR, if set,
262 points to a location where any return data should be written to. How
263 \&\fBargc\fR and \fBargl\fR are used depends entirely on the control function.
264 .PP
265 \&\fBX509_LOOKUP_set_get_by_subject()\fR, \fBX509_LOOKUP_set_get_by_issuer_serial()\fR,
266 \&\fBX509_LOOKUP_set_get_by_fingerprint()\fR, \fBX509_LOOKUP_set_get_by_alias()\fR set
267 the functions used to retrieve an X509 or X509_CRL object by the object's
268 subject, issuer, fingerprint, and alias respectively. These functions are given
269 the X509_LOOKUP context, the type of the X509_OBJECT being requested, parameters
270 related to the lookup, and an X509_OBJECT that will receive the requested
271 object.
272 .PP
273 Implementations must add objects they find to the \fBX509_STORE\fR object
274 using \fBX509_STORE_add_cert()\fR or \fBX509_STORE_add_crl()\fR.  This increments
275 its reference count.  However, the \fBX509_STORE_CTX_get_by_subject()\fR
276 function also increases the reference count which leads to one too
277 many references being held.  Therefore applications should
278 additionally call \fBX509_free()\fR or \fBX509_CRL_free()\fR to decrement the
279 reference count again.
280 .PP
281 Implementations should also use either \fBX509_OBJECT_set1_X509()\fR or
282 \&\fBX509_OBJECT_set1_X509_CRL()\fR to set the result.  Note that this also
283 increments the result's reference count.
284 .PP
285 Any method data that was created as a result of the new_item function
286 set by \fBX509_LOOKUP_meth_set_new_item()\fR can be accessed with
287 \&\fBX509_LOOKUP_get_method_data()\fR. The \fBX509_STORE\fR object that owns the
288 X509_LOOKUP may be accessed with \fBX509_LOOKUP_get_store()\fR. Successful lookups
289 should return 1, and unsuccessful lookups should return 0.
290 .PP
291 \&\fBX509_LOOKUP_get_get_by_subject()\fR, \fBX509_LOOKUP_get_get_by_issuer_serial()\fR,
292 \&\fBX509_LOOKUP_get_get_by_fingerprint()\fR, \fBX509_LOOKUP_get_get_by_alias()\fR retrieve
293 the function set by the corresponding setter.
294 .SH "RETURN VALUES"
295 .IX Header "RETURN VALUES"
296 The \fBX509_LOOKUP_meth_set\fR functions return 1 on success or 0 on error.
297 .PP
298 The \fBX509_LOOKUP_meth_get\fR functions return the corresponding function
299 pointers.
300 .SH "SEE ALSO"
301 .IX Header "SEE ALSO"
302 \&\fBX509_STORE_new\fR\|(3), \fBSSL_CTX_set_cert_store\fR\|(3)
303 .SH "HISTORY"
304 .IX Header "HISTORY"
305 The functions described here were added in OpenSSL 1.1.0i.
306 .SH "COPYRIGHT"
307 .IX Header "COPYRIGHT"
308 Copyright 2018\-2019 The OpenSSL Project Authors. All Rights Reserved.
309 .PP
310 Licensed under the OpenSSL license (the \*(L"License\*(R").  You may not use
311 this file except in compliance with the License.  You can obtain a copy
312 in the file \s-1LICENSE\s0 in the source distribution or at
313 <https://www.openssl.org/source/license.html>.