| 1 |
.\" Copyright (c) 2018 Yubico AB. All rights reserved. |
| 2 |
.\" |
| 3 |
.\" Redistribution and use in source and binary forms, with or without |
| 4 |
.\" modification, are permitted provided that the following conditions are |
| 5 |
.\" met: |
| 6 |
.\" |
| 7 |
.\" 1. Redistributions of source code must retain the above copyright |
| 8 |
.\" notice, this list of conditions and the following disclaimer. |
| 9 |
.\" 2. Redistributions in binary form must reproduce the above copyright |
| 10 |
.\" notice, this list of conditions and the following disclaimer in |
| 11 |
.\" the documentation and/or other materials provided with the |
| 12 |
.\" distribution. |
| 13 |
.\" |
| 14 |
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 15 |
.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 16 |
.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 17 |
.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 18 |
.\" HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 19 |
.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 20 |
.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 21 |
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 22 |
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 |
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 |
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 |
.\" |
| 26 |
.\" SPDX-License-Identifier: BSD-2-Clause |
| 27 |
.\" |
| 28 |
.Dd $Mdocdate: May 25 2018 $ |
| 29 |
.Dt FIDO_DEV_OPEN 3 |
| 30 |
.Os |
| 31 |
.Sh NAME |
| 32 |
.Nm fido_dev_open , |
| 33 |
.Nm fido_dev_open_with_info , |
| 34 |
.Nm fido_dev_close , |
| 35 |
.Nm fido_dev_cancel , |
| 36 |
.Nm fido_dev_new , |
| 37 |
.Nm fido_dev_new_with_info , |
| 38 |
.Nm fido_dev_free , |
| 39 |
.Nm fido_dev_force_fido2 , |
| 40 |
.Nm fido_dev_force_u2f , |
| 41 |
.Nm fido_dev_is_fido2 , |
| 42 |
.Nm fido_dev_is_winhello , |
| 43 |
.Nm fido_dev_supports_credman , |
| 44 |
.Nm fido_dev_supports_cred_prot , |
| 45 |
.Nm fido_dev_supports_permissions , |
| 46 |
.Nm fido_dev_supports_pin , |
| 47 |
.Nm fido_dev_supports_uv , |
| 48 |
.Nm fido_dev_has_pin , |
| 49 |
.Nm fido_dev_has_uv , |
| 50 |
.Nm fido_dev_protocol , |
| 51 |
.Nm fido_dev_build , |
| 52 |
.Nm fido_dev_flags , |
| 53 |
.Nm fido_dev_major , |
| 54 |
.Nm fido_dev_minor |
| 55 |
.Nd FIDO2 device open/close and related functions |
| 56 |
.Sh SYNOPSIS |
| 57 |
.In fido.h |
| 58 |
.Ft int |
| 59 |
.Fn fido_dev_open "fido_dev_t *dev" "const char *path" |
| 60 |
.Ft int |
| 61 |
.Fn fido_dev_open_with_info "fido_dev_t *dev" |
| 62 |
.Ft int |
| 63 |
.Fn fido_dev_close "fido_dev_t *dev" |
| 64 |
.Ft int |
| 65 |
.Fn fido_dev_cancel "fido_dev_t *dev" |
| 66 |
.Ft fido_dev_t * |
| 67 |
.Fn fido_dev_new "void" |
| 68 |
.Ft fido_dev_t * |
| 69 |
.Fn fido_dev_new_with_info "const fido_dev_info_t *" |
| 70 |
.Ft void |
| 71 |
.Fn fido_dev_free "fido_dev_t **dev_p" |
| 72 |
.Ft void |
| 73 |
.Fn fido_dev_force_fido2 "fido_dev_t *dev" |
| 74 |
.Ft void |
| 75 |
.Fn fido_dev_force_u2f "fido_dev_t *dev" |
| 76 |
.Ft bool |
| 77 |
.Fn fido_dev_is_fido2 "const fido_dev_t *dev" |
| 78 |
.Ft bool |
| 79 |
.Fn fido_dev_is_winhello "const fido_dev_t *dev" |
| 80 |
.Ft bool |
| 81 |
.Fn fido_dev_supports_credman "const fido_dev_t *dev" |
| 82 |
.Ft bool |
| 83 |
.Fn fido_dev_supports_cred_prot "const fido_dev_t *dev" |
| 84 |
.Ft bool |
| 85 |
.Fn fido_dev_supports_permissions "const fido_dev_t *dev" |
| 86 |
.Ft bool |
| 87 |
.Fn fido_dev_supports_pin "const fido_dev_t *dev" |
| 88 |
.Ft bool |
| 89 |
.Fn fido_dev_supports_uv "const fido_dev_t *dev" |
| 90 |
.Ft bool |
| 91 |
.Fn fido_dev_has_pin "const fido_dev_t *dev" |
| 92 |
.Ft bool |
| 93 |
.Fn fido_dev_has_uv "const fido_dev_t *dev" |
| 94 |
.Ft uint8_t |
| 95 |
.Fn fido_dev_protocol "const fido_dev_t *dev" |
| 96 |
.Ft uint8_t |
| 97 |
.Fn fido_dev_build "const fido_dev_t *dev" |
| 98 |
.Ft uint8_t |
| 99 |
.Fn fido_dev_flags "const fido_dev_t *dev" |
| 100 |
.Ft uint8_t |
| 101 |
.Fn fido_dev_major "const fido_dev_t *dev" |
| 102 |
.Ft uint8_t |
| 103 |
.Fn fido_dev_minor "const fido_dev_t *dev" |
| 104 |
.Sh DESCRIPTION |
| 105 |
The |
| 106 |
.Fn fido_dev_open |
| 107 |
function opens the device pointed to by |
| 108 |
.Fa path , |
| 109 |
where |
| 110 |
.Fa dev |
| 111 |
is a freshly allocated or otherwise closed |
| 112 |
.Vt fido_dev_t . |
| 113 |
If |
| 114 |
.Fa dev |
| 115 |
claims to be FIDO2, |
| 116 |
.Em libfido2 |
| 117 |
will attempt to speak FIDO2 to |
| 118 |
.Fa dev . |
| 119 |
If that fails, |
| 120 |
.Em libfido2 |
| 121 |
will fallback to U2F unless the |
| 122 |
.Dv FIDO_DISABLE_U2F_FALLBACK |
| 123 |
flag was set in |
| 124 |
.Xr fido_init 3 . |
| 125 |
.Pp |
| 126 |
The |
| 127 |
.Fn fido_dev_open_with_info |
| 128 |
function opens |
| 129 |
.Fa dev |
| 130 |
as previously allocated using |
| 131 |
.Fn fido_dev_new_with_info . |
| 132 |
.Pp |
| 133 |
The |
| 134 |
.Fn fido_dev_close |
| 135 |
function closes the device represented by |
| 136 |
.Fa dev . |
| 137 |
If |
| 138 |
.Fa dev |
| 139 |
is already closed, |
| 140 |
.Fn fido_dev_close |
| 141 |
is a NOP. |
| 142 |
.Pp |
| 143 |
The |
| 144 |
.Fn fido_dev_cancel |
| 145 |
function cancels any pending requests on |
| 146 |
.Fa dev . |
| 147 |
.Pp |
| 148 |
The |
| 149 |
.Fn fido_dev_new |
| 150 |
function returns a pointer to a newly allocated, empty |
| 151 |
.Vt fido_dev_t . |
| 152 |
If memory cannot be allocated, NULL is returned. |
| 153 |
.Pp |
| 154 |
The |
| 155 |
.Fn fido_dev_new_with_info |
| 156 |
function returns a pointer to a newly allocated |
| 157 |
.Vt fido_dev_t |
| 158 |
with |
| 159 |
.Vt fido_dev_info_t |
| 160 |
parameters, for use with |
| 161 |
.Xr fido_dev_info_manifest 3 |
| 162 |
and |
| 163 |
.Fn fido_dev_open_with_info . |
| 164 |
If memory cannot be allocated, NULL is returned. |
| 165 |
.Pp |
| 166 |
The |
| 167 |
.Fn fido_dev_free |
| 168 |
function releases the memory backing |
| 169 |
.Fa *dev_p , |
| 170 |
where |
| 171 |
.Fa *dev_p |
| 172 |
must have been previously allocated by |
| 173 |
.Fn fido_dev_new . |
| 174 |
On return, |
| 175 |
.Fa *dev_p |
| 176 |
is set to NULL. |
| 177 |
Either |
| 178 |
.Fa dev_p |
| 179 |
or |
| 180 |
.Fa *dev_p |
| 181 |
may be NULL, in which case |
| 182 |
.Fn fido_dev_free |
| 183 |
is a NOP. |
| 184 |
.Pp |
| 185 |
The |
| 186 |
.Fn fido_dev_force_fido2 |
| 187 |
function can be used to force CTAP2 communication with |
| 188 |
.Fa dev , |
| 189 |
where |
| 190 |
.Fa dev |
| 191 |
is an open device. |
| 192 |
.Pp |
| 193 |
The |
| 194 |
.Fn fido_dev_force_u2f |
| 195 |
function can be used to force CTAP1 (U2F) communication with |
| 196 |
.Fa dev , |
| 197 |
where |
| 198 |
.Fa dev |
| 199 |
is an open device. |
| 200 |
.Pp |
| 201 |
The |
| 202 |
.Fn fido_dev_is_fido2 |
| 203 |
function returns |
| 204 |
.Dv true |
| 205 |
if |
| 206 |
.Fa dev |
| 207 |
is a FIDO2 device. |
| 208 |
.Pp |
| 209 |
The |
| 210 |
.Fn fido_dev_is_winhello |
| 211 |
function returns |
| 212 |
.Dv true |
| 213 |
if |
| 214 |
.Fa dev |
| 215 |
is a Windows Hello device. |
| 216 |
.Pp |
| 217 |
The |
| 218 |
.Fn fido_dev_supports_credman |
| 219 |
function returns |
| 220 |
.Dv true |
| 221 |
if |
| 222 |
.Fa dev |
| 223 |
supports CTAP 2.1 Credential Management. |
| 224 |
.Pp |
| 225 |
The |
| 226 |
.Fn fido_dev_supports_cred_prot |
| 227 |
function returns |
| 228 |
.Dv true |
| 229 |
if |
| 230 |
.Fa dev |
| 231 |
supports CTAP 2.1 Credential Protection. |
| 232 |
.Pp |
| 233 |
The |
| 234 |
.Fn fido_dev_supports_permissions |
| 235 |
function returns |
| 236 |
.Dv true |
| 237 |
if |
| 238 |
.Fa dev |
| 239 |
supports CTAP 2.1 UV token permissions. |
| 240 |
.Pp |
| 241 |
The |
| 242 |
.Fn fido_dev_supports_pin |
| 243 |
function returns |
| 244 |
.Dv true |
| 245 |
if |
| 246 |
.Fa dev |
| 247 |
supports CTAP 2.0 Client PINs. |
| 248 |
.Pp |
| 249 |
The |
| 250 |
.Fn fido_dev_supports_uv |
| 251 |
function returns |
| 252 |
.Dv true |
| 253 |
if |
| 254 |
.Fa dev |
| 255 |
supports a built-in user verification method. |
| 256 |
.Pp |
| 257 |
The |
| 258 |
.Fn fido_dev_has_pin |
| 259 |
function returns |
| 260 |
.Dv true |
| 261 |
if |
| 262 |
.Fa dev |
| 263 |
has a CTAP 2.0 Client PIN set. |
| 264 |
.Pp |
| 265 |
The |
| 266 |
.Fn fido_dev_has_uv |
| 267 |
function returns |
| 268 |
.Dv true |
| 269 |
if |
| 270 |
.Fa dev |
| 271 |
supports built-in user verification and its user verification |
| 272 |
feature is configured. |
| 273 |
.Pp |
| 274 |
The |
| 275 |
.Fn fido_dev_protocol |
| 276 |
function returns the CTAPHID protocol version identifier of |
| 277 |
.Fa dev . |
| 278 |
.Pp |
| 279 |
The |
| 280 |
.Fn fido_dev_build |
| 281 |
function returns the CTAPHID build version number of |
| 282 |
.Fa dev . |
| 283 |
.Pp |
| 284 |
The |
| 285 |
.Fn fido_dev_flags |
| 286 |
function returns the CTAPHID capabilities flags of |
| 287 |
.Fa dev . |
| 288 |
.Pp |
| 289 |
The |
| 290 |
.Fn fido_dev_major |
| 291 |
function returns the CTAPHID major version number of |
| 292 |
.Fa dev . |
| 293 |
.Pp |
| 294 |
The |
| 295 |
.Fn fido_dev_minor |
| 296 |
function returns the CTAPHID minor version number of |
| 297 |
.Fa dev . |
| 298 |
.Pp |
| 299 |
For the format and meaning of the CTAPHID parameters returned by |
| 300 |
functions above, please refer to the FIDO Client to Authenticator |
| 301 |
Protocol (CTAP) specification. |
| 302 |
.Sh RETURN VALUES |
| 303 |
On success, |
| 304 |
.Fn fido_dev_open , |
| 305 |
.Fn fido_dev_open_with_info , |
| 306 |
and |
| 307 |
.Fn fido_dev_close |
| 308 |
return |
| 309 |
.Dv FIDO_OK . |
| 310 |
On error, a different error code defined in |
| 311 |
.In fido/err.h |
| 312 |
is returned. |
| 313 |
.Sh SEE ALSO |
| 314 |
.Xr fido_dev_info_manifest 3 , |
| 315 |
.Xr fido_dev_set_io_functions 3 , |
| 316 |
.Xr fido_init 3 |