summaryrefslogtreecommitdiff
path: root/ssh-sk.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-sk.c')
-rw-r--r--ssh-sk.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/ssh-sk.c b/ssh-sk.c
index 3e88aafff..5ff938193 100644
--- a/ssh-sk.c
+++ b/ssh-sk.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-sk.c,v 1.26 2020/01/28 08:01:34 djm Exp $ */ 1/* $OpenBSD: ssh-sk.c,v 1.27 2020/02/06 22:30:54 naddy Exp $ */
2/* 2/*
3 * Copyright (c) 2019 Google LLC 3 * Copyright (c) 2019 Google LLC
4 * 4 *
@@ -120,39 +120,38 @@ sshsk_open(const char *path)
120 return ret; 120 return ret;
121 } 121 }
122 if ((ret->dlhandle = dlopen(path, RTLD_NOW)) == NULL) { 122 if ((ret->dlhandle = dlopen(path, RTLD_NOW)) == NULL) {
123 error("Security key provider \"%s\" dlopen failed: %s", 123 error("Provider \"%s\" dlopen failed: %s", path, dlerror());
124 path, dlerror());
125 goto fail; 124 goto fail;
126 } 125 }
127 if ((ret->sk_api_version = dlsym(ret->dlhandle, 126 if ((ret->sk_api_version = dlsym(ret->dlhandle,
128 "sk_api_version")) == NULL) { 127 "sk_api_version")) == NULL) {
129 error("Security key provider \"%s\" dlsym(sk_api_version) " 128 error("Provider \"%s\" dlsym(sk_api_version) failed: %s",
130 "failed: %s", path, dlerror()); 129 path, dlerror());
131 goto fail; 130 goto fail;
132 } 131 }
133 version = ret->sk_api_version(); 132 version = ret->sk_api_version();
134 debug("%s: provider %s implements version 0x%08lx", __func__, 133 debug("%s: provider %s implements version 0x%08lx", __func__,
135 ret->path, (u_long)version); 134 ret->path, (u_long)version);
136 if ((version & SSH_SK_VERSION_MAJOR_MASK) != SSH_SK_VERSION_MAJOR) { 135 if ((version & SSH_SK_VERSION_MAJOR_MASK) != SSH_SK_VERSION_MAJOR) {
137 error("Security key provider \"%s\" implements unsupported " 136 error("Provider \"%s\" implements unsupported "
138 "version 0x%08lx (supported: 0x%08lx)", 137 "version 0x%08lx (supported: 0x%08lx)",
139 path, (u_long)version, (u_long)SSH_SK_VERSION_MAJOR); 138 path, (u_long)version, (u_long)SSH_SK_VERSION_MAJOR);
140 goto fail; 139 goto fail;
141 } 140 }
142 if ((ret->sk_enroll = dlsym(ret->dlhandle, "sk_enroll")) == NULL) { 141 if ((ret->sk_enroll = dlsym(ret->dlhandle, "sk_enroll")) == NULL) {
143 error("Security key provider %s dlsym(sk_enroll) " 142 error("Provider %s dlsym(sk_enroll) failed: %s",
144 "failed: %s", path, dlerror()); 143 path, dlerror());
145 goto fail; 144 goto fail;
146 } 145 }
147 if ((ret->sk_sign = dlsym(ret->dlhandle, "sk_sign")) == NULL) { 146 if ((ret->sk_sign = dlsym(ret->dlhandle, "sk_sign")) == NULL) {
148 error("Security key provider \"%s\" dlsym(sk_sign) failed: %s", 147 error("Provider \"%s\" dlsym(sk_sign) failed: %s",
149 path, dlerror()); 148 path, dlerror());
150 goto fail; 149 goto fail;
151 } 150 }
152 if ((ret->sk_load_resident_keys = dlsym(ret->dlhandle, 151 if ((ret->sk_load_resident_keys = dlsym(ret->dlhandle,
153 "sk_load_resident_keys")) == NULL) { 152 "sk_load_resident_keys")) == NULL) {
154 error("Security key provider \"%s\" " 153 error("Provider \"%s\" dlsym(sk_load_resident_keys) "
155 "dlsym(sk_load_resident_keys) failed: %s", path, dlerror()); 154 "failed: %s", path, dlerror());
156 goto fail; 155 goto fail;
157 } 156 }
158 /* success */ 157 /* success */
@@ -219,7 +218,7 @@ sshsk_ecdsa_assemble(struct sk_enroll_response *resp, struct sshkey **keyp)
219 goto out; 218 goto out;
220 } 219 }
221 if (sshkey_ec_validate_public(EC_KEY_get0_group(key->ecdsa), q) != 0) { 220 if (sshkey_ec_validate_public(EC_KEY_get0_group(key->ecdsa), q) != 0) {
222 error("Security key returned invalid ECDSA key"); 221 error("Authenticator returned invalid ECDSA key");
223 r = SSH_ERR_KEY_INVALID_EC_VALUE; 222 r = SSH_ERR_KEY_INVALID_EC_VALUE;
224 goto out; 223 goto out;
225 } 224 }
@@ -758,8 +757,7 @@ sshsk_load_resident(const char *provider_path, const char *device,
758 goto out; 757 goto out;
759 } 758 }
760 if ((r = skp->sk_load_resident_keys(pin, opts, &rks, &nrks)) != 0) { 759 if ((r = skp->sk_load_resident_keys(pin, opts, &rks, &nrks)) != 0) {
761 error("Security key provider \"%s\" returned failure %d", 760 error("Provider \"%s\" returned failure %d", provider_path, r);
762 provider_path, r);
763 r = skerr_to_ssherr(r); 761 r = skerr_to_ssherr(r);
764 goto out; 762 goto out;
765 } 763 }