diff options
author | djm@openbsd.org <djm@openbsd.org> | 2022-09-02 04:20:02 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2022-09-02 14:21:06 +1000 |
commit | 5f45c2395c60865e59fa44152ff1d003a128c5bc (patch) | |
tree | 088c764831293cfe10dd117606e1f1ef4890de44 /sk-usbhid.c | |
parent | 03277a4aa49b80af541a3e691f264c0c0d8f9cec (diff) |
upstream: sk-usbhid: fix key_lookup() on tokens with built-in UV
explicitly test whether the token performs built-in UV (e.g. biometric
tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388
OpenBSD-Commit-ID: 007eb7e387d27cf3029ab06b88224e03eca62ccd
Diffstat (limited to 'sk-usbhid.c')
-rw-r--r-- | sk-usbhid.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sk-usbhid.c b/sk-usbhid.c index 7bc11ccf..3ba2cf26 100644 --- a/sk-usbhid.c +++ b/sk-usbhid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sk-usbhid.c,v 1.43 2022/08/19 05:53:28 djm Exp $ */ +/* $OpenBSD: sk-usbhid.c,v 1.44 2022/09/02 04:20:02 djm Exp $ */ /* * Copyright (c) 2019 Markus Friedl * Copyright (c) 2020 Pedro Martelletto @@ -783,6 +783,7 @@ key_lookup(fido_dev_t *dev, const char *application, const uint8_t *user_id, fido_assert_t *assert = NULL; uint8_t message[32]; int r = FIDO_ERR_INTERNAL; + int sk_supports_uv, uv; size_t i; memset(message, '\0', sizeof(message)); @@ -802,7 +803,15 @@ key_lookup(fido_dev_t *dev, const char *application, const uint8_t *user_id, goto out; } if ((r = fido_assert_set_up(assert, FIDO_OPT_FALSE)) != FIDO_OK) { - skdebug(__func__, "fido_assert_up: %s", fido_strerr(r)); + skdebug(__func__, "fido_assert_set_up: %s", fido_strerr(r)); + goto out; + } + uv = FIDO_OPT_OMIT; + if (pin == NULL && check_sk_options(dev, "uv", &sk_supports_uv) == 0 && + sk_supports_uv != -1) + uv = FIDO_OPT_TRUE; + if ((r = fido_assert_set_uv(assert, uv)) != FIDO_OK) { + skdebug(__func__, "fido_assert_set_uv: %s", fido_strerr(r)); goto out; } if ((r = fido_dev_get_assert(dev, assert, pin)) != FIDO_OK) { |