diff options
author | djm@openbsd.org <djm@openbsd.org> | 2019-01-21 09:54:11 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-01-21 21:47:28 +1100 |
commit | 7be8572b32a15d5c3dba897f252e2e04e991c307 (patch) | |
tree | 449782dce059d2eb8d28aaa3baeaedd876b915a2 /monitor_wrap.c | |
parent | 803178bd5da7e72be94ba5b4c4c196d4b542da4d (diff) |
upstream: Make sshpkt_get_bignum2() allocate the bignum it is
parsing rather than make the caller do it. Saves a lot of boilerplate code.
from markus@ ok djm@
OpenBSD-Commit-ID: 576bf784f9a240f5a1401f7005364e59aed3bce9
Diffstat (limited to 'monitor_wrap.c')
-rw-r--r-- | monitor_wrap.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/monitor_wrap.c b/monitor_wrap.c index 9e3c7cd17..186e8f022 100644 --- a/monitor_wrap.c +++ b/monitor_wrap.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: monitor_wrap.c,v 1.111 2019/01/19 21:43:56 djm Exp $ */ | 1 | /* $OpenBSD: monitor_wrap.c,v 1.112 2019/01/21 09:54:11 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> | 3 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> |
4 | * Copyright 2002 Markus Friedl <markus@openbsd.org> | 4 | * Copyright 2002 Markus Friedl <markus@openbsd.org> |
@@ -202,12 +202,8 @@ mm_choose_dh(int min, int nbits, int max) | |||
202 | if (success == 0) | 202 | if (success == 0) |
203 | fatal("%s: MONITOR_ANS_MODULI failed", __func__); | 203 | fatal("%s: MONITOR_ANS_MODULI failed", __func__); |
204 | 204 | ||
205 | if ((p = BN_new()) == NULL) | 205 | if ((r = sshbuf_get_bignum2(m, &p)) != 0 || |
206 | fatal("%s: BN_new failed", __func__); | 206 | (r = sshbuf_get_bignum2(m, &g)) != 0) |
207 | if ((g = BN_new()) == NULL) | ||
208 | fatal("%s: BN_new failed", __func__); | ||
209 | if ((r = sshbuf_get_bignum2(m, p)) != 0 || | ||
210 | (r = sshbuf_get_bignum2(m, g)) != 0) | ||
211 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); | 207 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
212 | 208 | ||
213 | debug3("%s: remaining %zu", __func__, sshbuf_len(m)); | 209 | debug3("%s: remaining %zu", __func__, sshbuf_len(m)); |