summaryrefslogtreecommitdiff
path: root/ssh-sk.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2020-04-28 04:02:29 +0000
committerDamien Miller <djm@mindrot.org>2020-05-01 13:13:29 +1000
commit59d2de956ed29aa5565ed5e5947a7abdb27ac013 (patch)
tree983def72c15590c50a0319c8048b9a7d56961edf /ssh-sk.c
parentc9d10dbc0ccfb1c7568bbb784f7aeb7a0b5ded12 (diff)
downloadopenssh-git-59d2de956ed29aa5565ed5e5947a7abdb27ac013.tar.gz
upstream: when signing a challenge using a FIDO toke, perform the
hashing in the middleware layer rather than in ssh code. This allows middlewares that call APIs that perform the hashing implicitly (including Microsoft's AFAIK). ok markus@ OpenBSD-Commit-ID: c9fc8630aba26c75d5016884932f08a5a237f37d
Diffstat (limited to 'ssh-sk.c')
-rw-r--r--ssh-sk.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/ssh-sk.c b/ssh-sk.c
index 9aff7639..1afb205f 100644
--- a/ssh-sk.c
+++ b/ssh-sk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-sk.c,v 1.29 2020/03/06 18:25:48 markus Exp $ */
+/* $OpenBSD: ssh-sk.c,v 1.30 2020/04/28 04:02:29 djm Exp $ */
/*
* Copyright (c) 2019 Google LLC
*
@@ -615,7 +615,6 @@ sshsk_sign(const char *provider_path, struct sshkey *key,
int type, alg;
struct sk_sign_response *resp = NULL;
struct sshbuf *inner_sig = NULL, *sig = NULL;
- uint8_t message[32];
struct sk_option **opts = NULL;
debug("%s: provider \"%s\", key %s, flags 0x%02x%s", __func__,
@@ -650,15 +649,7 @@ sshsk_sign(const char *provider_path, struct sshkey *key,
goto out;
}
- /* hash data to be signed before it goes to the security key */
- if ((r = ssh_digest_memory(SSH_DIGEST_SHA256, data, datalen,
- message, sizeof(message))) != 0) {
- error("%s: hash application failed: %s", __func__, ssh_err(r));
- r = SSH_ERR_INTERNAL_ERROR;
- goto out;
- }
- if ((r = skp->sk_sign(alg, message, sizeof(message),
- key->sk_application,
+ if ((r = skp->sk_sign(alg, data, datalen, key->sk_application,
sshbuf_ptr(key->sk_key_handle), sshbuf_len(key->sk_key_handle),
key->sk_flags, pin, opts, &resp)) != 0) {
debug("%s: sk_sign failed with code %d", __func__, r);
@@ -707,7 +698,6 @@ sshsk_sign(const char *provider_path, struct sshkey *key,
r = 0;
out:
sshsk_free_options(opts);
- explicit_bzero(message, sizeof(message));
sshsk_free(skp);
sshsk_free_sign_response(resp);
sshbuf_free(sig);