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: May 24 2018 $
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_transports_ptr ,
16.Nm fido_cbor_info_versions_ptr ,
17.Nm fido_cbor_info_options_name_ptr ,
18.Nm fido_cbor_info_options_value_ptr ,
19.Nm fido_cbor_info_algorithm_type ,
20.Nm fido_cbor_info_algorithm_cose ,
21.Nm fido_cbor_info_algorithm_count ,
22.Nm fido_cbor_info_aaguid_len ,
23.Nm fido_cbor_info_extensions_len ,
24.Nm fido_cbor_info_protocols_len ,
25.Nm fido_cbor_info_transports_len ,
26.Nm fido_cbor_info_versions_len ,
27.Nm fido_cbor_info_options_len ,
28.Nm fido_cbor_info_maxmsgsiz ,
29.Nm fido_cbor_info_maxcredcntlst ,
30.Nm fido_cbor_info_maxcredidlen ,
31.Nm fido_cbor_info_fwversion
32.Nd FIDO 2 CBOR Info API
33.Sh SYNOPSIS
34.In fido.h
35.Ft fido_cbor_info_t *
36.Fn fido_cbor_info_new "void"
37.Ft void
38.Fn fido_cbor_info_free "fido_cbor_info_t **ci_p"
39.Ft int
40.Fn fido_dev_get_cbor_info "fido_dev_t *dev" "fido_cbor_info_t *ci"
41.Ft const unsigned char *
42.Fn fido_cbor_info_aaguid_ptr "const fido_cbor_info_t *ci"
43.Ft char **
44.Fn fido_cbor_info_extensions_ptr "const fido_cbor_info_t *ci"
45.Ft const uint8_t *
46.Fn fido_cbor_info_protocols_ptr "const fido_cbor_info_t *ci"
47.Ft char **
48.Fn fido_cbor_info_transports_ptr "const fido_cbor_info_t *ci"
49.Ft char **
50.Fn fido_cbor_info_versions_ptr "const fido_cbor_info_t *ci"
51.Ft char **
52.Fn fido_cbor_info_options_name_ptr "const fido_cbor_info_t *ci"
53.Ft const bool *
54.Fn fido_cbor_info_options_value_ptr "const fido_cbor_info_t *ci"
55.Ft const char *
56.Fn fido_cbor_info_algorithm_type "const fido_cbor_info_t *ci" "size_t idx"
57.Ft int
58.Fn fido_cbor_info_algorithm_cose "const fido_cbor_info_t *ci" "size_t idx"
59.Ft size_t
60.Fn fido_cbor_info_algorithm_count "const fido_cbor_info_t *ci"
61.Ft size_t
62.Fn fido_cbor_info_aaguid_len "const fido_cbor_info_t *ci"
63.Ft size_t
64.Fn fido_cbor_info_extensions_len "const fido_cbor_info_t *ci"
65.Ft size_t
66.Fn fido_cbor_info_protocols_len "const fido_cbor_info_t *ci"
67.Ft size_t
68.Fn fido_cbor_info_transports_len "const fido_cbor_info_t *ci"
69.Ft size_t
70.Fn fido_cbor_info_versions_len "const fido_cbor_info_t *ci"
71.Ft size_t
72.Fn fido_cbor_info_options_len "const fido_cbor_info_t *ci"
73.Ft uint64_t
74.Fn fido_cbor_info_maxmsgsiz "const fido_cbor_info_t *ci"
75.Ft uint64_t
76.Fn fido_cbor_info_maxcredbloblen "const fido_cbor_info_t *ci"
77.Ft uint64_t
78.Fn fido_cbor_info_maxcredcntlst "const fido_cbor_info_t *ci"
79.Ft uint64_t
80.Fn fido_cbor_info_maxcredidlen "const fido_cbor_info_t *ci"
81.Ft uint64_t
82.Fn fido_cbor_info_fwversion "const fido_cbor_info_t *ci"
83.Sh DESCRIPTION
84The
85.Fn fido_cbor_info_new
86function returns a pointer to a newly allocated, empty
87.Vt fido_cbor_info_t
88type.
89If memory cannot be allocated, NULL is returned.
90.Pp
91The
92.Fn fido_cbor_info_free
93function releases the memory backing
94.Fa *ci_p ,
95where
96.Fa *ci_p
97must have been previously allocated by
98.Fn fido_cbor_info_new .
99On return,
100.Fa *ci_p
101is set to NULL.
102Either
103.Fa ci_p
104or
105.Fa *ci_p
106may be NULL, in which case
107.Fn fido_cbor_info_free
108is a NOP.
109.Pp
110The
111.Fn fido_dev_get_cbor_info
112function transmits a
113.Dv CTAP_CBOR_GETINFO
114command to
115.Fa dev
116and fills
117.Fa ci
118with attributes retrieved from the command's response.
119The
120.Fn fido_dev_get_cbor_info
121function may block.
122.Pp
123The
124.Fn fido_cbor_info_aaguid_ptr ,
125.Fn fido_cbor_info_extensions_ptr ,
126.Fn fido_cbor_info_protocols_ptr ,
127.Fn fido_cbor_info_transports_ptr ,
128and
129.Fn fido_cbor_info_versions_ptr
130functions return pointers to the authenticator attestation GUID,
131supported extensions, PIN protocol, transports, and CTAP version
132strings of
133.Fa ci .
134The corresponding length of a given attribute can be
135obtained by
136.Fn fido_cbor_info_aaguid_len ,
137.Fn fido_cbor_info_extensions_len ,
138.Fn fido_cbor_info_protocols_len ,
139.Fn fido_cbor_info_transports_len ,
140or
141.Fn fido_cbor_info_versions_len .
142.Pp
143The
144.Fn fido_cbor_info_options_name_ptr
145and
146.Fn fido_cbor_info_options_value_ptr
147functions return pointers to the array of option names and their
148respective values
149in
150.Fa ci .
151The length of the options array is returned by
152.Fn fido_cbor_info_options_len .
153.Pp
154The
155.Fn fido_cbor_info_algorithm_count
156function returns the number of supported algorithms in
157.Fa ci .
158The
159.Fn fido_cbor_info_algorithm_cose
160function returns the COSE identifier of algorithm
161.Fa idx
162in
163.Fa ci ,
164or 0 if the COSE identifier is unknown or unset.
165The
166.Fn fido_cbor_info_algorithm_type
167function returns the type of algorithm
168.Fa idx
169in
170.Fa ci ,
171or NULL if the type is unset.
172Please note that the first algorithm in
173.Fa ci
174has an
175.Fa idx
176(index) value of 0.
177.Pp
178The
179.Fn fido_cbor_info_maxmsgsiz
180function returns the maximum message size attribute of
181.Fa ci .
182.Pp
183The
184.Fn fido_cbor_info_maxcredbloblen
185function returns the maximum
186.Dq credBlob
187length in bytes supported by the authenticator as reported in
188.Fa ci .
189.Pp
190The
191.Fn fido_cbor_info_maxcredcntlst
192function returns the maximum supported number of credentials in
193a single credential ID list as reported in
194.Fa ci .
195.Pp
196The
197.Fn fido_cbor_info_maxcredidlen
198function returns the maximum supported length of a credential ID
199as reported in
200.Fa ci .
201.Pp
202The
203.Fn fido_cbor_info_fwversion
204function returns the firmware version attribute of
205.Fa ci .
206.Pp
207A complete example of how to use these functions can be found in the
208.Pa example/info.c
209file shipped with
210.Em libfido2 .
211.Sh RETURN VALUES
212The
213.Fn fido_cbor_info_aaguid_ptr ,
214.Fn fido_cbor_info_extensions_ptr ,
215.Fn fido_cbor_info_protocols_ptr ,
216.Fn fido_cbor_info_transports_ptr ,
217.Fn fido_cbor_info_versions_ptr ,
218.Fn fido_cbor_info_options_name_ptr ,
219and
220.Fn fido_cbor_info_options_value_ptr
221functions return NULL if the respective field in
222.Fa ci
223is absent.
224If not NULL, returned pointers are guaranteed to exist until any
225API function that takes
226.Fa ci
227without the
228.Em const
229qualifier is invoked.
230.Sh SEE ALSO
231.Xr fido_dev_open 3
232