summaryrefslogtreecommitdiff
path: root/sk-usbhid.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2020-08-27 09:43:28 +0000
committerDamien Miller <djm@mindrot.org>2020-08-27 19:47:35 +1000
commitb969072cc3d62d05cb41bc6d6f3c22c764ed932f (patch)
tree22337c68ccecdca53b8228b11c9352a72ffd97fd /sk-usbhid.c
parent744df42a129d7d7db26947b7561be32edac89f88 (diff)
upstream: skip a bit more FIDO token selection logic when only a
single token is attached. with Pedro Martelletto OpenBSD-Commit-ID: e4a324bd9814227ec1faa8cb619580e661cca9ac
Diffstat (limited to 'sk-usbhid.c')
-rw-r--r--sk-usbhid.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sk-usbhid.c b/sk-usbhid.c
index 0b11e40aa..98e8ccf10 100644
--- a/sk-usbhid.c
+++ b/sk-usbhid.c
@@ -367,8 +367,13 @@ sk_select_by_cred(const fido_dev_info_t *devlist, size_t ndevs,
367 skdebug(__func__, "sk_openv failed"); 367 skdebug(__func__, "sk_openv failed");
368 return NULL; 368 return NULL;
369 } 369 }
370 if (skvcnt == 1) {
371 sk = skv[0];
372 skv[0] = NULL;
373 goto out;
374 }
370 sk = NULL; 375 sk = NULL;
371 for (i = 0; i < skvcnt; i++) 376 for (i = 0; i < skvcnt; i++) {
372 if (sk_try(skv[i], application, key_handle, 377 if (sk_try(skv[i], application, key_handle,
373 key_handle_len) == 0) { 378 key_handle_len) == 0) {
374 sk = skv[i]; 379 sk = skv[i];
@@ -376,6 +381,8 @@ sk_select_by_cred(const fido_dev_info_t *devlist, size_t ndevs,
376 skdebug(__func__, "found key in %s", sk->path); 381 skdebug(__func__, "found key in %s", sk->path);
377 break; 382 break;
378 } 383 }
384 }
385 out:
379 sk_closev(skv, skvcnt); 386 sk_closev(skv, skvcnt);
380 return sk; 387 return sk;
381} 388}