version 1.105, 2018/07/10 09:36:58 |
version 1.106, 2018/07/11 18:53:29 |
|
|
#include "dh.h" |
#include "dh.h" |
#endif |
#endif |
#include "sshbuf.h" |
#include "sshbuf.h" |
#include "key.h" |
#include "sshkey.h" |
#include "cipher.h" |
#include "cipher.h" |
#include "kex.h" |
#include "kex.h" |
#include "hostfile.h" |
#include "hostfile.h" |
|
|
#endif |
#endif |
|
|
int |
int |
mm_key_sign(struct sshkey *key, u_char **sigp, u_int *lenp, |
mm_sshkey_sign(struct sshkey *key, u_char **sigp, size_t *lenp, |
const u_char *data, u_int datalen, const char *hostkey_alg) |
const u_char *data, size_t datalen, const char *hostkey_alg, u_int compat) |
{ |
{ |
struct kex *kex = *pmonitor->m_pkex; |
struct kex *kex = *pmonitor->m_pkex; |
struct sshbuf *m; |
struct sshbuf *m; |
size_t xxxlen; |
|
u_int ndx = kex->host_key_index(key, 0, active_state); |
u_int ndx = kex->host_key_index(key, 0, active_state); |
int r; |
int r; |
|
|
|
|
fatal("%s: sshbuf_new failed", __func__); |
fatal("%s: sshbuf_new failed", __func__); |
if ((r = sshbuf_put_u32(m, ndx)) != 0 || |
if ((r = sshbuf_put_u32(m, ndx)) != 0 || |
(r = sshbuf_put_string(m, data, datalen)) != 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)); |
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
|
|
mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SIGN, m); |
mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SIGN, m); |
|
|
debug3("%s: waiting for MONITOR_ANS_SIGN", __func__); |
debug3("%s: waiting for MONITOR_ANS_SIGN", __func__); |
mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SIGN, m); |
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)); |
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); |
sshbuf_free(m); |
|
|
return (0); |
return (0); |