diff options
author | markus@openbsd.org <markus@openbsd.org> | 2019-11-12 19:34:00 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-11-13 08:54:09 +1100 |
commit | 3fcf69ace19e75cf9dcd7206f396adfcb29611a8 (patch) | |
tree | 5b845b13e4ee83140c4da39de0364814821809fc | |
parent | 2c55744a56de0ffc81fe445a1e7fc5cd308712b3 (diff) |
upstream: check sig_r and sig_s for ssh-sk keys; ok djm
OpenBSD-Commit-ID: 1a1e6a85b5f465d447a3800f739e35c5b74e0abc
-rw-r--r-- | ssh-sk.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-sk.c,v 1.7 2019/11/12 19:32:30 markus Exp $ */ | 1 | /* $OpenBSD: ssh-sk.c,v 1.8 2019/11/12 19:34:00 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2019 Google LLC | 3 | * Copyright (c) 2019 Google LLC |
4 | * | 4 | * |
@@ -365,6 +365,12 @@ sshsk_ecdsa_inner_sig(struct sk_sign_response *resp, struct sshbuf **retp) | |||
365 | int r = SSH_ERR_INTERNAL_ERROR; | 365 | int r = SSH_ERR_INTERNAL_ERROR; |
366 | 366 | ||
367 | *retp = NULL; | 367 | *retp = NULL; |
368 | /* Check response validity */ | ||
369 | if (resp->sig_r == NULL || resp->sig_r == NULL) { | ||
370 | error("%s: sk_sign response invalid", __func__); | ||
371 | r = SSH_ERR_INVALID_FORMAT; | ||
372 | goto out; | ||
373 | } | ||
368 | if ((inner_sig = sshbuf_new()) == NULL) { | 374 | if ((inner_sig = sshbuf_new()) == NULL) { |
369 | r = SSH_ERR_ALLOC_FAIL; | 375 | r = SSH_ERR_ALLOC_FAIL; |
370 | goto out; | 376 | goto out; |
@@ -400,6 +406,12 @@ sshsk_ed25519_inner_sig(struct sk_sign_response *resp, struct sshbuf **retp) | |||
400 | int r = SSH_ERR_INTERNAL_ERROR; | 406 | int r = SSH_ERR_INTERNAL_ERROR; |
401 | 407 | ||
402 | *retp = NULL; | 408 | *retp = NULL; |
409 | /* Check response validity */ | ||
410 | if (resp->sig_r == NULL) { | ||
411 | error("%s: sk_sign response invalid", __func__); | ||
412 | r = SSH_ERR_INVALID_FORMAT; | ||
413 | goto out; | ||
414 | } | ||
403 | if ((inner_sig = sshbuf_new()) == NULL) { | 415 | if ((inner_sig = sshbuf_new()) == NULL) { |
404 | r = SSH_ERR_ALLOC_FAIL; | 416 | r = SSH_ERR_ALLOC_FAIL; |
405 | goto out; | 417 | goto out; |