1
- .\" $OpenBSD: X509_LOOKUP_new.3,v 1.1 2021/07/31 14:54:33 schwarze Exp $
1
+ .\" $OpenBSD: X509_LOOKUP_new.3,v 1.2 2021/08/02 16:29:27 schwarze Exp $
2
2
.\"
3
3
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4
4
.\"
14
14
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
15
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
16
.\"
17
- .Dd $Mdocdate : July 31 2021 $
17
+ .Dd $Mdocdate : August 2 2021 $
18
18
.Dt X509_LOOKUP_NEW 3
19
19
.Os
20
20
.Sh NAME
70
70
.Fa " X509_LOOKUP *lookup"
71
71
.Fa " int type"
72
72
.Fa " X509_NAME *name"
73
- .Fa " X509_OBJECT *ret "
73
+ .Fa " X509_OBJECT *object "
74
74
.Fc
75
75
.Ft int
76
76
.Fn X509_LOOKUP_init " X509_LOOKUP *lookup"
82
82
.Fa " int type"
83
83
.Fa " X509_NAME *name"
84
84
.Fa " ASN1_INTEGER *serial"
85
- .Fa " X509_OBJECT *ret "
85
+ .Fa " X509_OBJECT *object "
86
86
.Fc
87
87
.Ft int
88
88
.Fo X509_LOOKUP_by_fingerprint
89
89
.Fa " X509_LOOKUP *lookup"
90
90
.Fa " int type"
91
91
.Fa " const unsigned char *bytes"
92
92
.Fa " int length"
93
- .Fa " X509_OBJECT *ret "
93
+ .Fa " X509_OBJECT *object "
94
94
.Fc
95
95
.Ft int
96
96
.Fo X509_LOOKUP_by_alias
97
97
.Fa " X509_LOOKUP *lookup"
98
98
.Fa " int type"
99
99
.Fa " const char *string"
100
100
.Fa " int length"
101
- .Fa " X509_OBJECT *ret "
101
+ .Fa " X509_OBJECT *object "
102
102
.Fc
103
103
.In openssl/x509.h
104
104
.Ft const char *
170
170
.Fa ret
171
171
set to
172
172
.Dv NULL .
173
+ .Pp
174
+ This lookup method is peculiar in so far as calling
175
+ .Fn X509_LOOKUP_ctrl
176
+ on a lookup object using it does not yet add any certificates to the associated
177
+ .Vt X509_STORE
178
+ object.
179
+ They need to be added selectively using
180
+ .Fn X509_LOOKUP_by_subject .
173
181
.It Xr X509_LOOKUP_file 3
174
182
The
175
183
.Fa command
290
298
.Xr X509_NAME_hash 3
291
299
and converts the resulting hash to an eight-digit lower-case
292
300
hexadecimal number.
301
+ .Pp
293
302
If the
294
303
.Fa type
295
304
is
@@ -314,6 +323,10 @@ i.e. they start with
314
323
and the files are read with
315
324
.Xr X509_load_crl_file 3 .
316
325
.Pp
326
+ In case of success, the first match is returned in the
327
+ .Pf * Fa object
328
+ provided by the caller, overwriting any previous content.
329
+ .Pp
317
330
Unless an application program manually constructs its own
318
331
.Vt X509_LOOKUP_METHOD
319
332
object containing its own callback functions,
@@ -369,7 +382,12 @@ is neither
369
382
.Dv X509_LU_X509
370
383
nor
371
384
.Dv X509_LU_CRL ,
372
- or if memory allocation fails.
385
+ if no match is found, or if memory allocation fails.
386
+ If
387
+ .Fa lookup
388
+ uses a user-defined
389
+ .Vt X509_LOOKUP_METHOD
390
+ object, it might also return negative values for internal errors.
373
391
.Pp
374
392
.Fn X509_LOOKUP_init
375
393
and
@@ -487,6 +505,7 @@ or calling
487
505
with a
488
506
.Dv NULL
489
507
.Fa name
508
+ or with arguments that yield no match
490
509
causes failure but provides no diagnostics.
491
510
.Sh SEE ALSO
492
511
.Xr d2i_X509_bio 3 ,
@@ -497,7 +516,8 @@ causes failure but provides no diagnostics.
497
516
.Xr X509_NAME_new 3 ,
498
517
.Xr X509_new 3 ,
499
518
.Xr X509_OBJECT_get_type 3 ,
500
- .Xr X509_STORE_add_cert 3
519
+ .Xr X509_STORE_add_cert 3 ,
520
+ .Xr X509_STORE_get_by_subject 3
501
521
.Sh HISTORY
502
522
.Fn X509_get_default_cert_dir
503
523
and
0 commit comments