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