Skip to content

Commit 9b4f382

Browse files
author
schwarze
committed
tweaks regarding X509_LOOKUP_by_subject(3):
* document the X509_OBJECT output parameter * more precision regarding return values * clarify relationship with X509_LOOKUP_ctrl(3) for the dir lookup method
1 parent a02c8fb commit 9b4f382

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

src/lib/libcrypto/man/X509_LOOKUP_new.3

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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 $
22
.\"
33
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
44
.\"
@@ -14,7 +14,7 @@
1414
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1515
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616
.\"
17-
.Dd $Mdocdate: July 31 2021 $
17+
.Dd $Mdocdate: August 2 2021 $
1818
.Dt X509_LOOKUP_NEW 3
1919
.Os
2020
.Sh NAME
@@ -70,7 +70,7 @@
7070
.Fa "X509_LOOKUP *lookup"
7171
.Fa "int type"
7272
.Fa "X509_NAME *name"
73-
.Fa "X509_OBJECT *ret"
73+
.Fa "X509_OBJECT *object"
7474
.Fc
7575
.Ft int
7676
.Fn X509_LOOKUP_init "X509_LOOKUP *lookup"
@@ -82,23 +82,23 @@
8282
.Fa "int type"
8383
.Fa "X509_NAME *name"
8484
.Fa "ASN1_INTEGER *serial"
85-
.Fa "X509_OBJECT *ret"
85+
.Fa "X509_OBJECT *object"
8686
.Fc
8787
.Ft int
8888
.Fo X509_LOOKUP_by_fingerprint
8989
.Fa "X509_LOOKUP *lookup"
9090
.Fa "int type"
9191
.Fa "const unsigned char *bytes"
9292
.Fa "int length"
93-
.Fa "X509_OBJECT *ret"
93+
.Fa "X509_OBJECT *object"
9494
.Fc
9595
.Ft int
9696
.Fo X509_LOOKUP_by_alias
9797
.Fa "X509_LOOKUP *lookup"
9898
.Fa "int type"
9999
.Fa "const char *string"
100100
.Fa "int length"
101-
.Fa "X509_OBJECT *ret"
101+
.Fa "X509_OBJECT *object"
102102
.Fc
103103
.In openssl/x509.h
104104
.Ft const char *
@@ -170,6 +170,14 @@ and
170170
.Fa ret
171171
set to
172172
.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 .
173181
.It Xr X509_LOOKUP_file 3
174182
The
175183
.Fa command
@@ -290,6 +298,7 @@ to
290298
.Xr X509_NAME_hash 3
291299
and converts the resulting hash to an eight-digit lower-case
292300
hexadecimal number.
301+
.Pp
293302
If the
294303
.Fa type
295304
is
@@ -314,6 +323,10 @@ i.e. they start with
314323
and the files are read with
315324
.Xr X509_load_crl_file 3 .
316325
.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
317330
Unless an application program manually constructs its own
318331
.Vt X509_LOOKUP_METHOD
319332
object containing its own callback functions,
@@ -369,7 +382,12 @@ is neither
369382
.Dv X509_LU_X509
370383
nor
371384
.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.
373391
.Pp
374392
.Fn X509_LOOKUP_init
375393
and
@@ -487,6 +505,7 @@ or calling
487505
with a
488506
.Dv NULL
489507
.Fa name
508+
or with arguments that yield no match
490509
causes failure but provides no diagnostics.
491510
.Sh SEE ALSO
492511
.Xr d2i_X509_bio 3 ,
@@ -497,7 +516,8 @@ causes failure but provides no diagnostics.
497516
.Xr X509_NAME_new 3 ,
498517
.Xr X509_new 3 ,
499518
.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
501521
.Sh HISTORY
502522
.Fn X509_get_default_cert_dir
503523
and

0 commit comments

Comments
 (0)