/* * Copyright (c) 2026 Yubico AB. All rights reserved. * Use of this source code is governed by a BSD-style * license that can be found in the LICENSE file. * SPDX-License-Identifier: BSD-2-Clause */ #include "../openbsd-compat/openbsd-compat.h" #include /* openssl sha256 -binary %zu", n_assert); if (n_assert == 0) goto exit; } warnx("Extract large blob"); if ((r = fido_dev_largeblob_get(dev, fido_assert_largeblob_key_ptr(assert, 0), fido_assert_largeblob_key_len(assert, 0), &blob_ptr, &blob_len)) != FIDO_OK) { warnx("fido_dev_largeblob_get: %s", fido_strerr(r)); goto exit; } warnx("Remove large blob (%zu bytes)", blob_len); if ((r = fido_dev_largeblob_remove(dev, fido_assert_largeblob_key_ptr(assert, 0), fido_assert_largeblob_key_len(assert, 0), NULL)) != FIDO_OK) warnx("fido_dev_largeblob_remove: %s", fido_strerr(r)); r = 0; exit: free(blob_ptr); fido_assert_free(&assert); return r; } static void usage(void) { fprintf(stderr, "usage: largeblob [-P pin] \n"); exit(1); } int main(int argc, char **argv) { fido_dev_t *dev = NULL; int r, ch; const char *path, *pin = NULL; while ((ch = getopt(argc, argv, "P:")) != -1) { switch (ch) { case 'P': pin = optarg; break; default: usage(); } } if (argc - optind < 1) usage(); path = argv[optind]; fido_init(0); if ((dev = fido_dev_new()) == NULL) errx(1, "fido_dev_new"); if ((r = fido_dev_open(dev, path)) != FIDO_OK) { warnx("could not open %s: %s", path, fido_strerr(r)); goto quit; } warnx("Make credential + large blob"); if ((r = run_make_cred(dev, pin)) != FIDO_OK) goto quit; warnx("Get assertion + large blob"); r = run_get_assertion(dev, pin); quit: fido_dev_close(dev); fido_dev_free(&dev); return r ? 1 : 0; }