summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2020-08-27 01:08:20 +0000
committerDamien Miller <djm@cvs.openbsd.org>2020-08-27 01:08:20 +0000
commit202d1e78abcd5beb689423ad9a285cb758d3576e (patch)
tree39a241fb9b495f3f0d5020787e4dfc13be15bea3 /usr.bin/ssh
parent8e8462bb1ff95883d75fa1e2b3a5e4452671a554 (diff)
preserve verify-required for resident FIDO keys
When downloading a resident, verify-required key from a FIDO token, preserve the verify-required in the private key that is written to disk. Previously we weren't doing that because of lack of support in the middleware API. from Pedro Martelletto; ok markus@ and myself
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/sk-api.h5
-rw-r--r--usr.bin/ssh/sk-usbhid.c6
-rw-r--r--usr.bin/ssh/ssh-sk.c5
3 files changed, 10 insertions, 6 deletions
diff --git a/usr.bin/ssh/sk-api.h b/usr.bin/ssh/sk-api.h
index 012771601c2..6bf7c092875 100644
--- a/usr.bin/ssh/sk-api.h
+++ b/usr.bin/ssh/sk-api.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sk-api.h,v 1.9 2020/04/28 04:02:29 djm Exp $ */
+/* $OpenBSD: sk-api.h,v 1.10 2020/08/27 01:08:19 djm Exp $ */
/*
* Copyright (c) 2019 Google LLC
*
@@ -61,6 +61,7 @@ struct sk_resident_key {
size_t slot;
char *application;
struct sk_enroll_response key;
+ uint8_t flags;
};
struct sk_option {
@@ -69,7 +70,7 @@ struct sk_option {
uint8_t required;
};
-#define SSH_SK_VERSION_MAJOR 0x00050000 /* current API version */
+#define SSH_SK_VERSION_MAJOR 0x00060000 /* current API version */
#define SSH_SK_VERSION_MAJOR_MASK 0xffff0000
/* Return the version of the middleware API */
diff --git a/usr.bin/ssh/sk-usbhid.c b/usr.bin/ssh/sk-usbhid.c
index 09973b6bb7a..96e8a884475 100644
--- a/usr.bin/ssh/sk-usbhid.c
+++ b/usr.bin/ssh/sk-usbhid.c
@@ -1098,8 +1098,7 @@ read_rks(struct sk_usbhid *sk, const char *pin,
}
srk->key.key_handle_len = fido_cred_id_len(cred);
- memcpy(srk->key.key_handle,
- fido_cred_id_ptr(cred),
+ memcpy(srk->key.key_handle, fido_cred_id_ptr(cred),
srk->key.key_handle_len);
switch (fido_cred_type(cred)) {
@@ -1115,6 +1114,9 @@ read_rks(struct sk_usbhid *sk, const char *pin,
goto out; /* XXX free rk and continue */
}
+ if (fido_cred_prot(cred) == FIDO_CRED_PROT_UV_REQUIRED)
+ srk->flags |= SSH_SK_USER_VERIFICATION_REQD;
+
if ((r = pack_public_key(srk->alg, cred,
&srk->key)) != 0) {
skdebug(__func__, "pack public key failed");
diff --git a/usr.bin/ssh/ssh-sk.c b/usr.bin/ssh/ssh-sk.c
index 0a4a2957512..6a2422f2bba 100644
--- a/usr.bin/ssh/ssh-sk.c
+++ b/usr.bin/ssh/ssh-sk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-sk.c,v 1.30 2020/04/28 04:02:29 djm Exp $ */
+/* $OpenBSD: ssh-sk.c,v 1.31 2020/08/27 01:08:19 djm Exp $ */
/*
* Copyright (c) 2019 Google LLC
*
@@ -759,8 +759,9 @@ sshsk_load_resident(const char *provider_path, const char *device,
default:
continue;
}
- /* XXX where to get flags? */
flags = SSH_SK_USER_PRESENCE_REQD|SSH_SK_RESIDENT_KEY;
+ if ((rks[i]->flags & SSH_SK_USER_VERIFICATION_REQD))
+ flags |= SSH_SK_USER_VERIFICATION_REQD;
if ((r = sshsk_key_from_response(rks[i]->alg,
rks[i]->application, flags, &rks[i]->key, &key)) != 0)
goto out;