summaryrefslogtreecommitdiff
path: root/sk-usbhid.c
diff options
context:
space:
mode:
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}