diff options
Diffstat (limited to 'monitor_wrap.c')
-rw-r--r-- | monitor_wrap.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/monitor_wrap.c b/monitor_wrap.c index ad4e8dce7..55b892b90 100644 --- a/monitor_wrap.c +++ b/monitor_wrap.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: monitor_wrap.c,v 1.105 2018/07/10 09:36:58 sf Exp $ */ | 1 | /* $OpenBSD: monitor_wrap.c,v 1.106 2018/07/11 18:53:29 markus 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> |
@@ -51,7 +51,7 @@ | |||
51 | #include "dh.h" | 51 | #include "dh.h" |
52 | #endif | 52 | #endif |
53 | #include "sshbuf.h" | 53 | #include "sshbuf.h" |
54 | #include "key.h" | 54 | #include "sshkey.h" |
55 | #include "cipher.h" | 55 | #include "cipher.h" |
56 | #include "kex.h" | 56 | #include "kex.h" |
57 | #include "hostfile.h" | 57 | #include "hostfile.h" |
@@ -225,12 +225,11 @@ mm_choose_dh(int min, int nbits, int max) | |||
225 | #endif | 225 | #endif |
226 | 226 | ||
227 | int | 227 | int |
228 | mm_key_sign(struct sshkey *key, u_char **sigp, u_int *lenp, | 228 | mm_sshkey_sign(struct sshkey *key, u_char **sigp, size_t *lenp, |
229 | const u_char *data, u_int datalen, const char *hostkey_alg) | 229 | const u_char *data, size_t datalen, const char *hostkey_alg, u_int compat) |
230 | { | 230 | { |
231 | struct kex *kex = *pmonitor->m_pkex; | 231 | struct kex *kex = *pmonitor->m_pkex; |
232 | struct sshbuf *m; | 232 | struct sshbuf *m; |
233 | size_t xxxlen; | ||
234 | u_int ndx = kex->host_key_index(key, 0, active_state); | 233 | u_int ndx = kex->host_key_index(key, 0, active_state); |
235 | int r; | 234 | int r; |
236 | 235 | ||
@@ -240,18 +239,16 @@ mm_key_sign(struct sshkey *key, u_char **sigp, u_int *lenp, | |||
240 | fatal("%s: sshbuf_new failed", __func__); | 239 | fatal("%s: sshbuf_new failed", __func__); |
241 | if ((r = sshbuf_put_u32(m, ndx)) != 0 || | 240 | if ((r = sshbuf_put_u32(m, ndx)) != 0 || |
242 | (r = sshbuf_put_string(m, data, datalen)) != 0 || | 241 | (r = sshbuf_put_string(m, data, datalen)) != 0 || |
243 | (r = sshbuf_put_cstring(m, hostkey_alg)) != 0) | 242 | (r = sshbuf_put_cstring(m, hostkey_alg)) != 0 || |
243 | (r = sshbuf_put_u32(m, compat)) != 0) | ||
244 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); | 244 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
245 | 245 | ||
246 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SIGN, m); | 246 | mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SIGN, m); |
247 | 247 | ||
248 | debug3("%s: waiting for MONITOR_ANS_SIGN", __func__); | 248 | debug3("%s: waiting for MONITOR_ANS_SIGN", __func__); |
249 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SIGN, m); | 249 | mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SIGN, m); |
250 | if ((r = sshbuf_get_string(m, sigp, &xxxlen)) != 0) | 250 | if ((r = sshbuf_get_string(m, sigp, lenp)) != 0) |
251 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); | 251 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
252 | if (xxxlen > 0xffffffff) | ||
253 | fatal("%s: bad length %zu", __func__, xxxlen); | ||
254 | *lenp = xxxlen; /* XXX fix API: size_t vs u_int */ | ||
255 | sshbuf_free(m); | 252 | sshbuf_free(m); |
256 | 253 | ||
257 | return (0); | 254 | return (0); |