xref: /openbsd-src/lib/libfido2/man/fido_dev_open.3 (revision 8b51a2b13e7075d5cbacf4b960d2ea4c9d08c6b2)
1.\" Copyright (c) 2018 Yubico AB. All rights reserved.
2.\" Use of this source code is governed by a BSD-style
3.\" license that can be found in the LICENSE file.
4.\"
5.Dd $Mdocdate: August 23 2020 $
6.Dt FIDO_DEV_OPEN 3
7.Os
8.Sh NAME
9.Nm fido_dev_open ,
10.Nm fido_dev_close ,
11.Nm fido_dev_cancel ,
12.Nm fido_dev_new ,
13.Nm fido_dev_free ,
14.Nm fido_dev_force_fido2 ,
15.Nm fido_dev_force_u2f ,
16.Nm fido_dev_is_fido2 ,
17.Nm fido_dev_supports_cred_prot ,
18.Nm fido_dev_supports_pin ,
19.Nm fido_dev_has_pin ,
20.Nm fido_dev_protocol ,
21.Nm fido_dev_build ,
22.Nm fido_dev_flags ,
23.Nm fido_dev_major ,
24.Nm fido_dev_minor
25.Nd FIDO 2 device open/close and related functions
26.Sh SYNOPSIS
27.In fido.h
28.Ft int
29.Fn fido_dev_open "fido_dev_t *dev" "const char *path"
30.Ft int
31.Fn fido_dev_close "fido_dev_t *dev"
32.Ft int
33.Fn fido_dev_cancel "fido_dev_t *dev"
34.Ft fido_dev_t *
35.Fn fido_dev_new "void"
36.Ft void
37.Fn fido_dev_free "fido_dev_t **dev_p"
38.Ft void
39.Fn fido_dev_force_fido2 "fido_dev_t *dev"
40.Ft void
41.Fn fido_dev_force_u2f "fido_dev_t *dev"
42.Ft bool
43.Fn fido_dev_is_fido2 "const fido_dev_t *dev"
44.Ft bool
45.Fn fido_dev_supports_cred_prot "const fido_dev_t *dev"
46.Ft bool
47.Fn fido_dev_supports_pin "const fido_dev_t *dev"
48.Ft bool
49.Fn fido_dev_has_pin "const fido_dev_t *dev"
50.Ft uint8_t
51.Fn fido_dev_protocol "const fido_dev_t *dev"
52.Ft uint8_t
53.Fn fido_dev_build "const fido_dev_t *dev"
54.Ft uint8_t
55.Fn fido_dev_flags "const fido_dev_t *dev"
56.Ft uint8_t
57.Fn fido_dev_major "const fido_dev_t *dev"
58.Ft uint8_t
59.Fn fido_dev_minor "const fido_dev_t *dev"
60.Sh DESCRIPTION
61The
62.Fn fido_dev_open
63function opens the device pointed to by
64.Fa path ,
65where
66.Fa dev
67is a freshly allocated or otherwise closed
68.Vt fido_dev_t .
69.Pp
70The
71.Fn fido_dev_close
72function closes the device represented by
73.Fa dev .
74If
75.Fa dev
76is already closed,
77.Fn fido_dev_close
78is a NOP.
79.Pp
80The
81.Fn fido_dev_cancel
82function cancels any pending requests on
83.Fa dev .
84.Pp
85The
86.Fn fido_dev_new
87function returns a pointer to a newly allocated, empty
88.Vt fido_dev_t .
89If memory cannot be allocated, NULL is returned.
90.Pp
91The
92.Fn fido_dev_free
93function releases the memory backing
94.Fa *dev_p ,
95where
96.Fa *dev_p
97must have been previously allocated by
98.Fn fido_dev_new .
99On return,
100.Fa *dev_p
101is set to NULL.
102Either
103.Fa dev_p
104or
105.Fa *dev_p
106may be NULL, in which case
107.Fn fido_dev_free
108is a NOP.
109.Pp
110The
111.Fn fido_dev_force_fido2
112function can be used to force CTAP2 communication with
113.Fa dev .
114.Pp
115The
116.Fn fido_dev_force_u2f
117function can be used to force CTAP1 (U2F) communication with
118.Fa dev .
119.Pp
120The
121.Fn fido_dev_is_fido2
122function returns
123.Dv true
124if
125.Fa dev
126is a FIDO 2 device.
127.Pp
128The
129.Fn fido_dev_supports_cred_prot
130function returns
131.Dv true
132if
133.Fa dev
134supports FIDO 2.1 Credential Protection.
135.Pp
136The
137.Fn fido_dev_supports_pin
138function returns
139.Dv true
140if
141.Fa dev
142supports FIDO 2.0 Client PINs.
143.Pp
144The
145.Fn fido_dev_has_pin
146function returns
147.Dv true
148if
149.Fa dev
150has a FIDO 2.0 Client PIN set.
151.Pp
152The
153.Fn fido_dev_protocol
154function returns the CTAPHID protocol version identifier of
155.Fa dev .
156.Pp
157The
158.Fn fido_dev_build
159function returns the CTAPHID build version number of
160.Fa dev .
161.Pp
162The
163.Fn fido_dev_flags
164function returns the CTAPHID capabilities flags of
165.Fa dev .
166.Pp
167The
168.Fn fido_dev_major
169function returns the CTAPHID major version number of
170.Fa dev .
171.Pp
172The
173.Fn fido_dev_minor
174function returns the CTAPHID minor version number of
175.Fa dev .
176.Pp
177For the format and meaning of the CTAPHID parameters returned by
178functions above, please refer to the FIDO Client to Authenticator
179Protocol (CTAP) specification.
180.Sh RETURN VALUES
181On success,
182.Fn fido_dev_open
183and
184.Fn fido_dev_close
185return
186.Dv FIDO_OK .
187On error, a different error code defined in
188.In fido/err.h
189is returned.
190.Sh SEE ALSO
191.Xr fido_dev_info_manifest 3 ,
192.Xr fido_dev_set_io_functions 3
193