From 5467fbcb09528ecdcb914f4f2452216c24796790 Mon Sep 17 00:00:00 2001 From: "markus@openbsd.org" Date: Wed, 11 Jul 2018 18:53:29 +0000 Subject: upstream: remove legacy key emulation layer; ok djm@ OpenBSD-Commit-ID: 2b1f9619259e222bbd4fe9a8d3a0973eafb9dd8d --- monitor_wrap.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'monitor_wrap.c') diff --git a/monitor_wrap.c b/monitor_wrap.c index ad4e8dce..55b892b9 100644 --- a/monitor_wrap.c +++ b/monitor_wrap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor_wrap.c,v 1.105 2018/07/10 09:36:58 sf Exp $ */ +/* $OpenBSD: monitor_wrap.c,v 1.106 2018/07/11 18:53:29 markus Exp $ */ /* * Copyright 2002 Niels Provos * Copyright 2002 Markus Friedl @@ -51,7 +51,7 @@ #include "dh.h" #endif #include "sshbuf.h" -#include "key.h" +#include "sshkey.h" #include "cipher.h" #include "kex.h" #include "hostfile.h" @@ -225,12 +225,11 @@ mm_choose_dh(int min, int nbits, int max) #endif int -mm_key_sign(struct sshkey *key, u_char **sigp, u_int *lenp, - const u_char *data, u_int datalen, const char *hostkey_alg) +mm_sshkey_sign(struct sshkey *key, u_char **sigp, size_t *lenp, + const u_char *data, size_t datalen, const char *hostkey_alg, u_int compat) { struct kex *kex = *pmonitor->m_pkex; struct sshbuf *m; - size_t xxxlen; u_int ndx = kex->host_key_index(key, 0, active_state); int r; @@ -240,18 +239,16 @@ mm_key_sign(struct sshkey *key, u_char **sigp, u_int *lenp, fatal("%s: sshbuf_new failed", __func__); if ((r = sshbuf_put_u32(m, ndx)) != 0 || (r = sshbuf_put_string(m, data, datalen)) != 0 || - (r = sshbuf_put_cstring(m, hostkey_alg)) != 0) + (r = sshbuf_put_cstring(m, hostkey_alg)) != 0 || + (r = sshbuf_put_u32(m, compat)) != 0) fatal("%s: buffer error: %s", __func__, ssh_err(r)); mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SIGN, m); debug3("%s: waiting for MONITOR_ANS_SIGN", __func__); mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SIGN, m); - if ((r = sshbuf_get_string(m, sigp, &xxxlen)) != 0) + if ((r = sshbuf_get_string(m, sigp, lenp)) != 0) fatal("%s: buffer error: %s", __func__, ssh_err(r)); - if (xxxlen > 0xffffffff) - fatal("%s: bad length %zu", __func__, xxxlen); - *lenp = xxxlen; /* XXX fix API: size_t vs u_int */ sshbuf_free(m); return (0); -- cgit v1.2.1