diff options
Diffstat (limited to 'kexgexs.c')
-rw-r--r-- | kexgexs.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kexgexs.c,v 1.27 2016/05/31 23:46:14 dtucker Exp $ */ | 1 | /* $OpenBSD: kexgexs.c,v 1.28 2016/06/01 04:19:49 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Niels Provos. All rights reserved. | 3 | * Copyright (c) 2000 Niels Provos. All rights reserved. |
4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
@@ -83,21 +83,21 @@ input_kex_dh_gex_request(int type, u_int32_t seq, void *ctxt) | |||
83 | kex->nbits = nbits; | 83 | kex->nbits = nbits; |
84 | kex->min = min; | 84 | kex->min = min; |
85 | kex->max = max; | 85 | kex->max = max; |
86 | min = MAX(DH_GRP_MIN, min); | ||
87 | max = MIN(DH_GRP_MAX, max); | ||
88 | nbits = MAX(DH_GRP_MIN, nbits); | ||
89 | nbits = MIN(DH_GRP_MAX, nbits); | ||
90 | |||
91 | if (kex->max < kex->min || kex->nbits < kex->min || | 86 | if (kex->max < kex->min || kex->nbits < kex->min || |
92 | kex->max < kex->nbits || kex->max < DH_GRP_MIN) { | 87 | kex->max < kex->nbits || kex->max < DH_GRP_MIN || |
88 | kex->min > DH_GRP_MAX) { | ||
93 | r = SSH_ERR_DH_GEX_OUT_OF_RANGE; | 89 | r = SSH_ERR_DH_GEX_OUT_OF_RANGE; |
94 | goto out; | 90 | goto out; |
95 | } | 91 | } |
92 | kex->min = MAX(DH_GRP_MIN, kex->min); | ||
93 | kex->max = MIN(DH_GRP_MAX, kex->max); | ||
94 | kex->nbits = MAX(DH_GRP_MIN, kex->nbits); | ||
95 | kex->nbits = MIN(DH_GRP_MAX, kex->nbits); | ||
96 | 96 | ||
97 | /* Contact privileged parent */ | 97 | /* Contact privileged parent */ |
98 | kex->dh = PRIVSEP(choose_dh(min, nbits, max)); | 98 | kex->dh = PRIVSEP(choose_dh(kex->min, kex->nbits, kex->max)); |
99 | if (kex->dh == NULL) { | 99 | if (kex->dh == NULL) { |
100 | sshpkt_disconnect(ssh, "no matching DH grp found"); | 100 | sshpkt_disconnect(ssh, "no matching DH group found"); |
101 | r = SSH_ERR_ALLOC_FAIL; | 101 | r = SSH_ERR_ALLOC_FAIL; |
102 | goto out; | 102 | goto out; |
103 | } | 103 | } |