From 93c6accc72ad7ad2853d4e348b454068b454eb37 Mon Sep 17 00:00:00 2001 From: djm Date: Wed, 20 Jul 2022 03:31:42 +0000 Subject: [PATCH] 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 --- usr.bin/ssh/sk-usbhid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/ssh/sk-usbhid.c b/usr.bin/ssh/sk-usbhid.c index cbf7d8b5f5f..e4d38c0de67 100644 --- a/usr.bin/ssh/sk-usbhid.c +++ b/usr.bin/ssh/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 @@ -763,7 +763,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; -- 2.20.1