summaryrefslogtreecommitdiffstats
path: root/ssh-sk.c
diff options
context:
space:
mode:
authormarkus@openbsd.org <markus@openbsd.org>2019-11-12 20:34:00 +0100
committerDamien Miller <djm@mindrot.org>2019-11-12 22:54:09 +0100
commit3fcf69ace19e75cf9dcd7206f396adfcb29611a8 (patch)
tree5b845b13e4ee83140c4da39de0364814821809fc /ssh-sk.c
parentupstream: enable ed25519 support; ok djm (diff)
downloadopenssh-3fcf69ace19e75cf9dcd7206f396adfcb29611a8.tar.xz
openssh-3fcf69ace19e75cf9dcd7206f396adfcb29611a8.zip
upstream: check sig_r and sig_s for ssh-sk keys; ok djm
OpenBSD-Commit-ID: 1a1e6a85b5f465d447a3800f739e35c5b74e0abc
Diffstat (limited to 'ssh-sk.c')
-rw-r--r--ssh-sk.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/ssh-sk.c b/ssh-sk.c
index a9da765eb..7a4bf8c6b 100644
--- a/ssh-sk.c
+++ b/ssh-sk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-sk.c,v 1.7 2019/11/12 19:32:30 markus Exp $ */
+/* $OpenBSD: ssh-sk.c,v 1.8 2019/11/12 19:34:00 markus Exp $ */
/*
* Copyright (c) 2019 Google LLC
*
@@ -365,6 +365,12 @@ sshsk_ecdsa_inner_sig(struct sk_sign_response *resp, struct sshbuf **retp)
int r = SSH_ERR_INTERNAL_ERROR;
*retp = NULL;
+ /* Check response validity */
+ if (resp->sig_r == NULL || resp->sig_r == NULL) {
+ error("%s: sk_sign response invalid", __func__);
+ r = SSH_ERR_INVALID_FORMAT;
+ goto out;
+ }
if ((inner_sig = sshbuf_new()) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;
@@ -400,6 +406,12 @@ sshsk_ed25519_inner_sig(struct sk_sign_response *resp, struct sshbuf **retp)
int r = SSH_ERR_INTERNAL_ERROR;
*retp = NULL;
+ /* Check response validity */
+ if (resp->sig_r == NULL) {
+ error("%s: sk_sign response invalid", __func__);
+ r = SSH_ERR_INVALID_FORMAT;
+ goto out;
+ }
if ((inner_sig = sshbuf_new()) == NULL) {
r = SSH_ERR_ALLOC_FAIL;
goto out;