summaryrefslogtreecommitdiff
path: root/sk-usbhid.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2020-05-13 09:57:17 +0000
committerDamien Miller <djm@mindrot.org>2020-05-27 10:09:19 +1000
commit1e70dc3285fc9b4f6454975acb81e8702c23dd89 (patch)
tree1cfd98661b0fb0df23ac1d323cfb59da0976ee9d /sk-usbhid.c
parentf2d84f1b3fa68d77c99238d4c645d0266fae2a74 (diff)
upstream: always call fido_init(); previous behaviour only called
fido_init() when SK_DEBUG was defined. Harmless with current libfido2, but this isn't guaranteed in the future. OpenBSD-Commit-ID: c7ea20ff2bcd98dd12015d748d3672d4f01f0864
Diffstat (limited to 'sk-usbhid.c')
-rw-r--r--sk-usbhid.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sk-usbhid.c b/sk-usbhid.c
index 25250824d..8097cc7f4 100644
--- a/sk-usbhid.c
+++ b/sk-usbhid.c
@@ -57,6 +57,12 @@
57 57
58/* #define SK_DEBUG 1 */ 58/* #define SK_DEBUG 1 */
59 59
60#ifdef SK_DEBUG
61#define SSH_FIDO_INIT_ARG FIDO_DEBUG
62#else
63#define SSH_FIDO_INIT_ARG 0
64#endif
65
60#define MAX_FIDO_DEVICES 256 66#define MAX_FIDO_DEVICES 256
61 67
62/* Compatibility with OpenSSH 1.0.x */ 68/* Compatibility with OpenSSH 1.0.x */
@@ -459,9 +465,8 @@ sk_enroll(uint32_t alg, const uint8_t *challenge, size_t challenge_len,
459 int r; 465 int r;
460 char *device = NULL; 466 char *device = NULL;
461 467
462#ifdef SK_DEBUG 468 fido_init(SSH_FIDO_INIT_ARG);
463 fido_init(FIDO_DEBUG); 469
464#endif
465 if (enroll_response == NULL) { 470 if (enroll_response == NULL) {
466 skdebug(__func__, "enroll_response == NULL"); 471 skdebug(__func__, "enroll_response == NULL");
467 goto out; 472 goto out;
@@ -749,9 +754,7 @@ sk_sign(uint32_t alg, const uint8_t *data, size_t datalen,
749 int ret = SSH_SK_ERR_GENERAL; 754 int ret = SSH_SK_ERR_GENERAL;
750 int r; 755 int r;
751 756
752#ifdef SK_DEBUG 757 fido_init(SSH_FIDO_INIT_ARG);
753 fido_init(FIDO_DEBUG);
754#endif
755 758
756 if (sign_response == NULL) { 759 if (sign_response == NULL) {
757 skdebug(__func__, "sign_response == NULL"); 760 skdebug(__func__, "sign_response == NULL");
@@ -995,6 +998,8 @@ sk_load_resident_keys(const char *pin, struct sk_option **options,
995 *rksp = NULL; 998 *rksp = NULL;
996 *nrksp = 0; 999 *nrksp = 0;
997 1000
1001 fido_init(SSH_FIDO_INIT_ARG);
1002
998 if (check_sign_load_resident_options(options, &device) != 0) 1003 if (check_sign_load_resident_options(options, &device) != 0)
999 goto out; /* error already logged */ 1004 goto out; /* error already logged */
1000 if (device != NULL) { 1005 if (device != NULL) {