summaryrefslogtreecommitdiff
path: root/sshkey.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2017-05-08 06:11:06 +0000
committerDamien Miller <djm@mindrot.org>2017-05-10 11:40:18 +1000
commit5f02bb1f99f70bb422be8a5c2b77ef853f1db554 (patch)
tree95ed7046139ca277a871a2bfc70cc433da44ce39 /sshkey.c
parentd757a4b633e8874629a1442c7c2e7b1b55d28c19 (diff)
upstream commit
make requesting bad ECDSA bits yield the same error (SSH_ERR_KEY_LENGTH) as the same mistake for RSA/DSA Upstream-ID: bf40d3fee567c271e33f05ef8e4e0fa0b6f0ece6
Diffstat (limited to 'sshkey.c')
-rw-r--r--sshkey.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sshkey.c b/sshkey.c
index 6518c6f0b..f9518bd77 100644
--- a/sshkey.c
+++ b/sshkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey.c,v 1.49 2017/05/07 23:15:59 djm Exp $ */ 1/* $OpenBSD: sshkey.c,v 1.50 2017/05/08 06:11:06 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved. 4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -1504,9 +1504,10 @@ ecdsa_generate_private_key(u_int bits, int *nid, EC_KEY **ecdsap)
1504 EC_KEY *private; 1504 EC_KEY *private;
1505 int ret = SSH_ERR_INTERNAL_ERROR; 1505 int ret = SSH_ERR_INTERNAL_ERROR;
1506 1506
1507 if (nid == NULL || ecdsap == NULL || 1507 if (nid == NULL || ecdsap == NULL)
1508 (*nid = sshkey_ecdsa_bits_to_nid(bits)) == -1)
1509 return SSH_ERR_INVALID_ARGUMENT; 1508 return SSH_ERR_INVALID_ARGUMENT;
1509 if ((*nid = sshkey_ecdsa_bits_to_nid(bits)) == -1)
1510 return SSH_ERR_KEY_LENGTH;
1510 *ecdsap = NULL; 1511 *ecdsap = NULL;
1511 if ((private = EC_KEY_new_by_curve_name(*nid)) == NULL) { 1512 if ((private = EC_KEY_new_by_curve_name(*nid)) == NULL) {
1512 ret = SSH_ERR_ALLOC_FAIL; 1513 ret = SSH_ERR_ALLOC_FAIL;