xref: /freebsd-src/contrib/libfido2/man/fido_dev_open.3 (revision 2ccfa855b2fc331819953e3de1b1c15ce5b95a7e)
10afa8e06SEd Maste.\" Copyright (c) 2018 Yubico AB. All rights reserved.
2*2ccfa855SEd Maste.\"
3*2ccfa855SEd Maste.\" Redistribution and use in source and binary forms, with or without
4*2ccfa855SEd Maste.\" modification, are permitted provided that the following conditions are
5*2ccfa855SEd Maste.\" met:
6*2ccfa855SEd Maste.\"
7*2ccfa855SEd Maste.\"    1. Redistributions of source code must retain the above copyright
8*2ccfa855SEd Maste.\"       notice, this list of conditions and the following disclaimer.
9*2ccfa855SEd Maste.\"    2. Redistributions in binary form must reproduce the above copyright
10*2ccfa855SEd Maste.\"       notice, this list of conditions and the following disclaimer in
11*2ccfa855SEd Maste.\"       the documentation and/or other materials provided with the
12*2ccfa855SEd Maste.\"       distribution.
13*2ccfa855SEd Maste.\"
14*2ccfa855SEd Maste.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15*2ccfa855SEd Maste.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16*2ccfa855SEd Maste.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17*2ccfa855SEd Maste.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18*2ccfa855SEd Maste.\" HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19*2ccfa855SEd Maste.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20*2ccfa855SEd Maste.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21*2ccfa855SEd Maste.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22*2ccfa855SEd Maste.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23*2ccfa855SEd Maste.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24*2ccfa855SEd Maste.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*2ccfa855SEd Maste.\"
26*2ccfa855SEd Maste.\" SPDX-License-Identifier: BSD-2-Clause
270afa8e06SEd Maste.\"
280afa8e06SEd Maste.Dd $Mdocdate: May 25 2018 $
290afa8e06SEd Maste.Dt FIDO_DEV_OPEN 3
300afa8e06SEd Maste.Os
310afa8e06SEd Maste.Sh NAME
320afa8e06SEd Maste.Nm fido_dev_open ,
333e696dfbSEd Maste.Nm fido_dev_open_with_info ,
340afa8e06SEd Maste.Nm fido_dev_close ,
350afa8e06SEd Maste.Nm fido_dev_cancel ,
360afa8e06SEd Maste.Nm fido_dev_new ,
373e696dfbSEd Maste.Nm fido_dev_new_with_info ,
380afa8e06SEd Maste.Nm fido_dev_free ,
390afa8e06SEd Maste.Nm fido_dev_force_fido2 ,
400afa8e06SEd Maste.Nm fido_dev_force_u2f ,
410afa8e06SEd Maste.Nm fido_dev_is_fido2 ,
420afa8e06SEd Maste.Nm fido_dev_is_winhello ,
430afa8e06SEd Maste.Nm fido_dev_supports_credman ,
440afa8e06SEd Maste.Nm fido_dev_supports_cred_prot ,
453e696dfbSEd Maste.Nm fido_dev_supports_permissions ,
460afa8e06SEd Maste.Nm fido_dev_supports_pin ,
470afa8e06SEd Maste.Nm fido_dev_supports_uv ,
483e696dfbSEd Maste.Nm fido_dev_has_pin ,
490afa8e06SEd Maste.Nm fido_dev_has_uv ,
500afa8e06SEd Maste.Nm fido_dev_protocol ,
510afa8e06SEd Maste.Nm fido_dev_build ,
520afa8e06SEd Maste.Nm fido_dev_flags ,
530afa8e06SEd Maste.Nm fido_dev_major ,
540afa8e06SEd Maste.Nm fido_dev_minor
550afa8e06SEd Maste.Nd FIDO2 device open/close and related functions
560afa8e06SEd Maste.Sh SYNOPSIS
570afa8e06SEd Maste.In fido.h
580afa8e06SEd Maste.Ft int
590afa8e06SEd Maste.Fn fido_dev_open "fido_dev_t *dev" "const char *path"
600afa8e06SEd Maste.Ft int
613e696dfbSEd Maste.Fn fido_dev_open_with_info "fido_dev_t *dev"
623e696dfbSEd Maste.Ft int
630afa8e06SEd Maste.Fn fido_dev_close "fido_dev_t *dev"
640afa8e06SEd Maste.Ft int
650afa8e06SEd Maste.Fn fido_dev_cancel "fido_dev_t *dev"
660afa8e06SEd Maste.Ft fido_dev_t *
670afa8e06SEd Maste.Fn fido_dev_new "void"
683e696dfbSEd Maste.Ft fido_dev_t *
693e696dfbSEd Maste.Fn fido_dev_new_with_info "const fido_dev_info_t *"
700afa8e06SEd Maste.Ft void
710afa8e06SEd Maste.Fn fido_dev_free "fido_dev_t **dev_p"
720afa8e06SEd Maste.Ft void
730afa8e06SEd Maste.Fn fido_dev_force_fido2 "fido_dev_t *dev"
740afa8e06SEd Maste.Ft void
750afa8e06SEd Maste.Fn fido_dev_force_u2f "fido_dev_t *dev"
760afa8e06SEd Maste.Ft bool
770afa8e06SEd Maste.Fn fido_dev_is_fido2 "const fido_dev_t *dev"
780afa8e06SEd Maste.Ft bool
790afa8e06SEd Maste.Fn fido_dev_is_winhello "const fido_dev_t *dev"
800afa8e06SEd Maste.Ft bool
810afa8e06SEd Maste.Fn fido_dev_supports_credman "const fido_dev_t *dev"
820afa8e06SEd Maste.Ft bool
830afa8e06SEd Maste.Fn fido_dev_supports_cred_prot "const fido_dev_t *dev"
840afa8e06SEd Maste.Ft bool
853e696dfbSEd Maste.Fn fido_dev_supports_permissions "const fido_dev_t *dev"
863e696dfbSEd Maste.Ft bool
870afa8e06SEd Maste.Fn fido_dev_supports_pin "const fido_dev_t *dev"
880afa8e06SEd Maste.Ft bool
890afa8e06SEd Maste.Fn fido_dev_supports_uv "const fido_dev_t *dev"
900afa8e06SEd Maste.Ft bool
913e696dfbSEd Maste.Fn fido_dev_has_pin "const fido_dev_t *dev"
923e696dfbSEd Maste.Ft bool
930afa8e06SEd Maste.Fn fido_dev_has_uv "const fido_dev_t *dev"
940afa8e06SEd Maste.Ft uint8_t
950afa8e06SEd Maste.Fn fido_dev_protocol "const fido_dev_t *dev"
960afa8e06SEd Maste.Ft uint8_t
970afa8e06SEd Maste.Fn fido_dev_build "const fido_dev_t *dev"
980afa8e06SEd Maste.Ft uint8_t
990afa8e06SEd Maste.Fn fido_dev_flags "const fido_dev_t *dev"
1000afa8e06SEd Maste.Ft uint8_t
1010afa8e06SEd Maste.Fn fido_dev_major "const fido_dev_t *dev"
1020afa8e06SEd Maste.Ft uint8_t
1030afa8e06SEd Maste.Fn fido_dev_minor "const fido_dev_t *dev"
1040afa8e06SEd Maste.Sh DESCRIPTION
1050afa8e06SEd MasteThe
1060afa8e06SEd Maste.Fn fido_dev_open
1070afa8e06SEd Mastefunction opens the device pointed to by
1080afa8e06SEd Maste.Fa path ,
1090afa8e06SEd Mastewhere
1100afa8e06SEd Maste.Fa dev
1110afa8e06SEd Masteis a freshly allocated or otherwise closed
1120afa8e06SEd Maste.Vt fido_dev_t .
1130afa8e06SEd MasteIf
1140afa8e06SEd Maste.Fa dev
1150afa8e06SEd Masteclaims to be FIDO2,
1160afa8e06SEd Maste.Em libfido2
1170afa8e06SEd Mastewill attempt to speak FIDO2 to
1180afa8e06SEd Maste.Fa dev .
1190afa8e06SEd MasteIf that fails,
1200afa8e06SEd Maste.Em libfido2
1210afa8e06SEd Mastewill fallback to U2F unless the
1220afa8e06SEd Maste.Dv FIDO_DISABLE_U2F_FALLBACK
1230afa8e06SEd Masteflag was set in
1240afa8e06SEd Maste.Xr fido_init 3 .
1250afa8e06SEd Maste.Pp
1260afa8e06SEd MasteThe
1273e696dfbSEd Maste.Fn fido_dev_open_with_info
1283e696dfbSEd Mastefunction opens
1293e696dfbSEd Maste.Fa dev
1303e696dfbSEd Masteas previously allocated using
1313e696dfbSEd Maste.Fn fido_dev_new_with_info .
1323e696dfbSEd Maste.Pp
1333e696dfbSEd MasteThe
1340afa8e06SEd Maste.Fn fido_dev_close
1350afa8e06SEd Mastefunction closes the device represented by
1360afa8e06SEd Maste.Fa dev .
1370afa8e06SEd MasteIf
1380afa8e06SEd Maste.Fa dev
1390afa8e06SEd Masteis already closed,
1400afa8e06SEd Maste.Fn fido_dev_close
1410afa8e06SEd Masteis a NOP.
1420afa8e06SEd Maste.Pp
1430afa8e06SEd MasteThe
1440afa8e06SEd Maste.Fn fido_dev_cancel
1450afa8e06SEd Mastefunction cancels any pending requests on
1460afa8e06SEd Maste.Fa dev .
1470afa8e06SEd Maste.Pp
1480afa8e06SEd MasteThe
1490afa8e06SEd Maste.Fn fido_dev_new
1500afa8e06SEd Mastefunction returns a pointer to a newly allocated, empty
1510afa8e06SEd Maste.Vt fido_dev_t .
1520afa8e06SEd MasteIf memory cannot be allocated, NULL is returned.
1530afa8e06SEd Maste.Pp
1540afa8e06SEd MasteThe
1553e696dfbSEd Maste.Fn fido_dev_new_with_info
1563e696dfbSEd Mastefunction returns a pointer to a newly allocated
1573e696dfbSEd Maste.Vt fido_dev_t
1583e696dfbSEd Mastewith
1593e696dfbSEd Maste.Vt fido_dev_info_t
1603e696dfbSEd Masteparameters, for use with
1613e696dfbSEd Maste.Xr fido_dev_info_manifest 3
1623e696dfbSEd Masteand
1633e696dfbSEd Maste.Fn fido_dev_open_with_info .
1643e696dfbSEd MasteIf memory cannot be allocated, NULL is returned.
1653e696dfbSEd Maste.Pp
1663e696dfbSEd MasteThe
1670afa8e06SEd Maste.Fn fido_dev_free
1680afa8e06SEd Mastefunction releases the memory backing
1690afa8e06SEd Maste.Fa *dev_p ,
1700afa8e06SEd Mastewhere
1710afa8e06SEd Maste.Fa *dev_p
1720afa8e06SEd Mastemust have been previously allocated by
1730afa8e06SEd Maste.Fn fido_dev_new .
1740afa8e06SEd MasteOn return,
1750afa8e06SEd Maste.Fa *dev_p
1760afa8e06SEd Masteis set to NULL.
1770afa8e06SEd MasteEither
1780afa8e06SEd Maste.Fa dev_p
1790afa8e06SEd Masteor
1800afa8e06SEd Maste.Fa *dev_p
1810afa8e06SEd Mastemay be NULL, in which case
1820afa8e06SEd Maste.Fn fido_dev_free
1830afa8e06SEd Masteis a NOP.
1840afa8e06SEd Maste.Pp
1850afa8e06SEd MasteThe
1860afa8e06SEd Maste.Fn fido_dev_force_fido2
1870afa8e06SEd Mastefunction can be used to force CTAP2 communication with
1883e696dfbSEd Maste.Fa dev ,
1893e696dfbSEd Mastewhere
1903e696dfbSEd Maste.Fa dev
1913e696dfbSEd Masteis an open device.
1920afa8e06SEd Maste.Pp
1930afa8e06SEd MasteThe
1940afa8e06SEd Maste.Fn fido_dev_force_u2f
1950afa8e06SEd Mastefunction can be used to force CTAP1 (U2F) communication with
1963e696dfbSEd Maste.Fa dev ,
1973e696dfbSEd Mastewhere
1983e696dfbSEd Maste.Fa dev
1993e696dfbSEd Masteis an open device.
2000afa8e06SEd Maste.Pp
2010afa8e06SEd MasteThe
2020afa8e06SEd Maste.Fn fido_dev_is_fido2
2030afa8e06SEd Mastefunction returns
2040afa8e06SEd Maste.Dv true
2050afa8e06SEd Masteif
2060afa8e06SEd Maste.Fa dev
2070afa8e06SEd Masteis a FIDO2 device.
2080afa8e06SEd Maste.Pp
2090afa8e06SEd MasteThe
2100afa8e06SEd Maste.Fn fido_dev_is_winhello
2110afa8e06SEd Mastefunction returns
2120afa8e06SEd Maste.Dv true
2130afa8e06SEd Masteif
2140afa8e06SEd Maste.Fa dev
2150afa8e06SEd Masteis a Windows Hello device.
2160afa8e06SEd Maste.Pp
2170afa8e06SEd MasteThe
2180afa8e06SEd Maste.Fn fido_dev_supports_credman
2190afa8e06SEd Mastefunction returns
2200afa8e06SEd Maste.Dv true
2210afa8e06SEd Masteif
2220afa8e06SEd Maste.Fa dev
2233e696dfbSEd Mastesupports CTAP 2.1 Credential Management.
2240afa8e06SEd Maste.Pp
2250afa8e06SEd MasteThe
2260afa8e06SEd Maste.Fn fido_dev_supports_cred_prot
2270afa8e06SEd Mastefunction returns
2280afa8e06SEd Maste.Dv true
2290afa8e06SEd Masteif
2300afa8e06SEd Maste.Fa dev
2313e696dfbSEd Mastesupports CTAP 2.1 Credential Protection.
2323e696dfbSEd Maste.Pp
2333e696dfbSEd MasteThe
2343e696dfbSEd Maste.Fn fido_dev_supports_permissions
2353e696dfbSEd Mastefunction returns
2363e696dfbSEd Maste.Dv true
2373e696dfbSEd Masteif
2383e696dfbSEd Maste.Fa dev
2393e696dfbSEd Mastesupports CTAP 2.1 UV token permissions.
2400afa8e06SEd Maste.Pp
2410afa8e06SEd MasteThe
2420afa8e06SEd Maste.Fn fido_dev_supports_pin
2430afa8e06SEd Mastefunction returns
2440afa8e06SEd Maste.Dv true
2450afa8e06SEd Masteif
2460afa8e06SEd Maste.Fa dev
2473e696dfbSEd Mastesupports CTAP 2.0 Client PINs.
2480afa8e06SEd Maste.Pp
2490afa8e06SEd MasteThe
2500afa8e06SEd Maste.Fn fido_dev_supports_uv
2510afa8e06SEd Mastefunction returns
2520afa8e06SEd Maste.Dv true
2530afa8e06SEd Masteif
2540afa8e06SEd Maste.Fa dev
2550afa8e06SEd Mastesupports a built-in user verification method.
2560afa8e06SEd Maste.Pp
2570afa8e06SEd MasteThe
2583e696dfbSEd Maste.Fn fido_dev_has_pin
2593e696dfbSEd Mastefunction returns
2603e696dfbSEd Maste.Dv true
2613e696dfbSEd Masteif
2623e696dfbSEd Maste.Fa dev
2633e696dfbSEd Mastehas a CTAP 2.0 Client PIN set.
2643e696dfbSEd Maste.Pp
2653e696dfbSEd MasteThe
2660afa8e06SEd Maste.Fn fido_dev_has_uv
2670afa8e06SEd Mastefunction returns
2680afa8e06SEd Maste.Dv true
2690afa8e06SEd Masteif
2700afa8e06SEd Maste.Fa dev
2710afa8e06SEd Mastesupports built-in user verification and its user verification
2720afa8e06SEd Mastefeature is configured.
2730afa8e06SEd Maste.Pp
2740afa8e06SEd MasteThe
2750afa8e06SEd Maste.Fn fido_dev_protocol
2760afa8e06SEd Mastefunction returns the CTAPHID protocol version identifier of
2770afa8e06SEd Maste.Fa dev .
2780afa8e06SEd Maste.Pp
2790afa8e06SEd MasteThe
2800afa8e06SEd Maste.Fn fido_dev_build
2810afa8e06SEd Mastefunction returns the CTAPHID build version number of
2820afa8e06SEd Maste.Fa dev .
2830afa8e06SEd Maste.Pp
2840afa8e06SEd MasteThe
2850afa8e06SEd Maste.Fn fido_dev_flags
2860afa8e06SEd Mastefunction returns the CTAPHID capabilities flags of
2870afa8e06SEd Maste.Fa dev .
2880afa8e06SEd Maste.Pp
2890afa8e06SEd MasteThe
2900afa8e06SEd Maste.Fn fido_dev_major
2910afa8e06SEd Mastefunction returns the CTAPHID major version number of
2920afa8e06SEd Maste.Fa dev .
2930afa8e06SEd Maste.Pp
2940afa8e06SEd MasteThe
2950afa8e06SEd Maste.Fn fido_dev_minor
2960afa8e06SEd Mastefunction returns the CTAPHID minor version number of
2970afa8e06SEd Maste.Fa dev .
2980afa8e06SEd Maste.Pp
2990afa8e06SEd MasteFor the format and meaning of the CTAPHID parameters returned by
3000afa8e06SEd Mastefunctions above, please refer to the FIDO Client to Authenticator
3010afa8e06SEd MasteProtocol (CTAP) specification.
3020afa8e06SEd Maste.Sh RETURN VALUES
3030afa8e06SEd MasteOn success,
3043e696dfbSEd Maste.Fn fido_dev_open ,
3053e696dfbSEd Maste.Fn fido_dev_open_with_info ,
3060afa8e06SEd Masteand
3070afa8e06SEd Maste.Fn fido_dev_close
3080afa8e06SEd Mastereturn
3090afa8e06SEd Maste.Dv FIDO_OK .
3100afa8e06SEd MasteOn error, a different error code defined in
3110afa8e06SEd Maste.In fido/err.h
3120afa8e06SEd Masteis returned.
3130afa8e06SEd Maste.Sh SEE ALSO
3140afa8e06SEd Maste.Xr fido_dev_info_manifest 3 ,
3150afa8e06SEd Maste.Xr fido_dev_set_io_functions 3 ,
3160afa8e06SEd Maste.Xr fido_init 3
317