diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2017-05-08 06:11:07 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2017-05-08 06:11:07 +0000 |
commit | f277093b2f66dd42e133add202e0149960f8d7a0 (patch) | |
tree | 1bf7e68936fc4784652538619325c0bad0800ca1 /usr.bin/ssh | |
parent | 2ea56846e1ee67fc8c1069c6a4f79a85deea099a (diff) |
make requesting bad ECDSA bits yield the same error (SSH_ERR_KEY_LENGTH)
as the same mistake for RSA/DSA
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/sshkey.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/ssh/sshkey.c b/usr.bin/ssh/sshkey.c index 7249229a0a1..db73b30f846 100644 --- a/usr.bin/ssh/sshkey.c +++ b/usr.bin/ssh/sshkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshkey.c,v 1.49 2017/05/07 23:15:59 djm Exp $ */ +/* $OpenBSD: sshkey.c,v 1.50 2017/05/08 06:11:06 djm Exp $ */ /* * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * Copyright (c) 2008 Alexander von Gernler. All rights reserved. @@ -1473,9 +1473,10 @@ ecdsa_generate_private_key(u_int bits, int *nid, EC_KEY **ecdsap) EC_KEY *private; int ret = SSH_ERR_INTERNAL_ERROR; - if (nid == NULL || ecdsap == NULL || - (*nid = sshkey_ecdsa_bits_to_nid(bits)) == -1) + if (nid == NULL || ecdsap == NULL) return SSH_ERR_INVALID_ARGUMENT; + if ((*nid = sshkey_ecdsa_bits_to_nid(bits)) == -1) + return SSH_ERR_KEY_LENGTH; *ecdsap = NULL; if ((private = EC_KEY_new_by_curve_name(*nid)) == NULL) { ret = SSH_ERR_ALLOC_FAIL; |