summaryrefslogtreecommitdiff
path: root/examples/manifest.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/manifest.c')
-rw-r--r--examples/manifest.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/examples/manifest.c b/examples/manifest.c
new file mode 100644
index 0000000..895447a
--- /dev/null
+++ b/examples/manifest.c
@@ -0,0 +1,45 @@
1/*
2 * Copyright (c) 2018 Yubico AB. All rights reserved.
3 * Use of this source code is governed by a BSD-style
4 * license that can be found in the LICENSE file.
5 */
6
7#include <openssl/ec.h>
8
9#include <stdbool.h>
10#include <stdio.h>
11#include <stdlib.h>
12
13#include "../openbsd-compat/openbsd-compat.h"
14
15#include "fido.h"
16
17int
18main(void)
19{
20 fido_dev_info_t *devlist;
21 size_t ndevs;
22 int r;
23
24 fido_init(0);
25
26 if ((devlist = fido_dev_info_new(64)) == NULL)
27 errx(1, "fido_dev_info_new");
28
29 if ((r = fido_dev_info_manifest(devlist, 64, &ndevs)) != FIDO_OK)
30 errx(1, "fido_dev_info_manifest: %s (0x%x)", fido_strerr(r), r);
31
32 for (size_t i = 0; i < ndevs; i++) {
33 const fido_dev_info_t *di = fido_dev_info_ptr(devlist, i);
34 printf("%s: vendor=0x%04x, product=0x%04x (%s %s)\n",
35 fido_dev_info_path(di),
36 (uint16_t)fido_dev_info_vendor(di),
37 (uint16_t)fido_dev_info_product(di),
38 fido_dev_info_manufacturer_string(di),
39 fido_dev_info_product_string(di));
40 }
41
42 fido_dev_info_free(&devlist, ndevs);
43
44 exit(0);
45}