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 11 2020 $
6.Dt FIDO_CBOR_INFO_NEW 3
7.Os
8.Sh NAME
9.Nm fido_cbor_info_new ,
10.Nm fido_cbor_info_free ,
11.Nm fido_dev_get_cbor_info ,
12.Nm fido_cbor_info_aaguid_ptr ,
13.Nm fido_cbor_info_extensions_ptr ,
14.Nm fido_cbor_info_protocols_ptr ,
15.Nm fido_cbor_info_versions_ptr ,
16.Nm fido_cbor_info_options_name_ptr ,
17.Nm fido_cbor_info_options_value_ptr ,
18.Nm fido_cbor_info_aaguid_len ,
19.Nm fido_cbor_info_extensions_len ,
20.Nm fido_cbor_info_protocols_len ,
21.Nm fido_cbor_info_versions_len ,
22.Nm fido_cbor_info_options_len ,
23.Nm fido_cbor_info_maxmsgsiz ,
24.Nm fido_cbor_info_maxcredcntlst ,
25.Nm fido_cbor_info_maxcredidlen ,
26.Nm fido_cbor_info_fwversion
27.Nd FIDO 2 CBOR Info API
28.Sh SYNOPSIS
29.In fido.h
30.Ft fido_cbor_info_t *
31.Fn fido_cbor_info_new "void"
32.Ft void
33.Fn fido_cbor_info_free "fido_cbor_info_t **ci_p"
34.Ft int
35.Fn fido_dev_get_cbor_info "fido_dev_t *dev" "fido_cbor_info_t *ci"
36.Ft const unsigned char *
37.Fn fido_cbor_info_aaguid_ptr "const fido_cbor_info_t *ci"
38.Ft char **
39.Fn fido_cbor_info_extensions_ptr "const fido_cbor_info_t *ci"
40.Ft const uint8_t *
41.Fn fido_cbor_info_protocols_ptr "const fido_cbor_info_t *ci"
42.Ft char **
43.Fn fido_cbor_info_versions_ptr "const fido_cbor_info_t *ci"
44.Ft char **
45.Fn fido_cbor_info_options_name_ptr "const fido_cbor_info_t *ci"
46.Ft const bool *
47.Fn fido_cbor_info_options_value_ptr "const fido_cbor_info_t *ci"
48.Ft size_t
49.Fn fido_cbor_info_aaguid_len "const fido_cbor_info_t *ci"
50.Ft size_t
51.Fn fido_cbor_info_extensions_len "const fido_cbor_info_t *ci"
52.Ft size_t
53.Fn fido_cbor_info_protocols_len "const fido_cbor_info_t *ci"
54.Ft size_t
55.Fn fido_cbor_info_versions_len "const fido_cbor_info_t *ci"
56.Ft size_t
57.Fn fido_cbor_info_options_len "const fido_cbor_info_t *ci"
58.Ft uint64_t
59.Fn fido_cbor_info_maxmsgsiz "const fido_cbor_info_t *ci"
60.Ft uint64_t
61.Fn fido_cbor_info_maxcredcntlst "const fido_cbor_info_t *ci"
62.Ft uint64_t
63.Fn fido_cbor_info_maxcredidlen "const fido_cbor_info_t *ci"
64.Ft uint64_t
65.Fn fido_cbor_info_fwversion "const fido_cbor_info_t *ci"
66.Sh DESCRIPTION
67The
68.Fn fido_cbor_info_new
69function returns a pointer to a newly allocated, empty
70.Vt fido_cbor_info_t
71type.
72If memory cannot be allocated, NULL is returned.
73.Pp
74The
75.Fn fido_cbor_info_free
76function releases the memory backing
77.Fa *ci_p ,
78where
79.Fa *ci_p
80must have been previously allocated by
81.Fn fido_cbor_info_new .
82On return,
83.Fa *ci_p
84is set to NULL.
85Either
86.Fa ci_p
87or
88.Fa *ci_p
89may be NULL, in which case
90.Fn fido_cbor_info_free
91is a NOP.
92.Pp
93The
94.Fn fido_dev_get_cbor_info
95function transmits a
96.Dv CTAP_CBOR_GETINFO
97command to
98.Fa dev
99and fills
100.Fa ci
101with attributes retrieved from the command's response.
102The
103.Fn fido_dev_get_cbor_info
104function may block.
105.Pp
106The
107.Fn fido_cbor_info_aaguid_ptr ,
108.Fn fido_cbor_info_extensions_ptr ,
109.Fn fido_cbor_info_protocols_ptr ,
110and
111.Fn fido_cbor_info_versions_ptr
112functions return pointers to the authenticator attestation GUID,
113supported extensions, PIN protocol and CTAP version strings of
114.Fa ci .
115The corresponding length of a given attribute can be
116obtained by
117.Fn fido_cbor_info_aaguid_len ,
118.Fn fido_cbor_info_extensions_len ,
119.Fn fido_cbor_info_protocols_len ,
120or
121.Fn fido_cbor_info_versions_len .
122.Pp
123The
124.Fn fido_cbor_info_options_name_ptr
125and
126.Fn fido_cbor_info_options_value_ptr
127functions return pointers to the array of option names and their
128respective values
129in
130.Fa ci .
131The length of the options array is returned by
132.Fn fido_cbor_info_options_len .
133.Pp
134The
135.Fn fido_cbor_info_maxmsgsiz
136function returns the maximum message size attribute of
137.Fa ci .
138.Pp
139The
140.Fn fido_cbor_info_maxcredcntlst
141function returns the maximum supported number of credentials in
142a single credential ID list as reported in
143.Fa ci .
144.Pp
145The
146.Fn fido_cbor_info_maxcredidlen
147function returns the maximum supported length of a credential ID
148as reported in
149.Fa ci .
150.Pp
151The
152.Fn fido_cbor_info_fwversion
153function returns the firmware version attribute of
154.Fa ci .
155.Pp
156A complete example of how to use these functions can be found in the
157.Pa example/info.c
158file shipped with
159.Em libfido2 .
160.Sh RETURN VALUES
161The
162.Fn fido_cbor_info_aaguid_ptr ,
163.Fn fido_cbor_info_extensions_ptr ,
164.Fn fido_cbor_info_protocols_ptr ,
165.Fn fido_cbor_info_versions_ptr ,
166.Fn fido_cbor_info_options_name_ptr ,
167and
168.Fn fido_cbor_info_options_value_ptr
169functions return NULL if the respective field in
170.Fa ci
171is absent.
172If not NULL, returned pointers are guaranteed to exist until any
173API function that takes
174.Fa ci
175without the
176.Em const
177qualifier is invoked.
178.Sh SEE ALSO
179.Xr fido_dev_open 3
180