summaryrefslogtreecommitdiffstats
path: root/sk-usbhid.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2022-07-20 05:31:42 +0200
committerDamien Miller <djm@mindrot.org>2022-07-20 05:38:47 +0200
commit8638a2ce7e90c8a51d9af3143404282126c524f8 (patch)
tree5b0be8e89944dd4fc1b38d50da4e6b48c8c2847c /sk-usbhid.c
parentupstream: when enrolling a resident key on a security token, check (diff)
downloadopenssh-8638a2ce7e90c8a51d9af3143404282126c524f8.tar.xz
openssh-8638a2ce7e90c8a51d9af3143404282126c524f8.zip
upstream: sk-usbhid: preserve error code returned by key_lookup()
it conveys useful information, such as the supplied pin being wrong. Part of GHPR329 from Pedro Martelletto OpenBSD-Commit-ID: c0647eb9290f793add363d81378439b273756c1b
Diffstat (limited to 'sk-usbhid.c')
-rw-r--r--sk-usbhid.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sk-usbhid.c b/sk-usbhid.c
index d168cd031..616fc5565 100644
--- a/sk-usbhid.c
+++ b/sk-usbhid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sk-usbhid.c,v 1.40 2022/07/20 03:29:14 djm Exp $ */
+/* $OpenBSD: sk-usbhid.c,v 1.41 2022/07/20 03:31:42 djm Exp $ */
/*
* Copyright (c) 2019 Markus Friedl
* Copyright (c) 2020 Pedro Martelletto
@@ -876,7 +876,7 @@ sk_enroll(uint32_t alg, const uint8_t *challenge, size_t challenge_len,
(r = key_lookup(sk->dev, application, user_id, sizeof(user_id),
pin)) != FIDO_ERR_NO_CREDENTIALS) {
if (r != FIDO_OK) {
- ret = SSH_SK_ERR_GENERAL;
+ ret = fidoerr_to_skerr(r);
skdebug(__func__, "key_lookup failed");
} else {
ret = SSH_SK_ERR_CREDENTIAL_EXISTS;