From 8d882756b80cec8a2e3e7ef7c764e53d5de2170c Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 2 Jun 2018 07:52:26 +0100 Subject: [PATCH] Fix some missing void * and const in existing APIs. Several changes here that should have been in commit 7babe66a8 but I missed them. --- portfwd.c | 2 +- ssh.c | 4 ++-- ssh.h | 6 +++--- sshecc.c | 6 ++++-- x11fwd.c | 4 +++- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/portfwd.c b/portfwd.c index d27abb41..1e4d2d1f 100644 --- a/portfwd.c +++ b/portfwd.c @@ -605,7 +605,7 @@ void pfd_override_throttle(struct PortForwarding *pf, int enable) /* * Called to send data down the raw connection. */ -int pfd_send(struct PortForwarding *pf, char *data, int len) +int pfd_send(struct PortForwarding *pf, const void *data, int len) { if (pf == NULL) return 0; diff --git a/ssh.c b/ssh.c index edf813da..4e87dc0a 100644 --- a/ssh.c +++ b/ssh.c @@ -5890,7 +5890,7 @@ static void ssh1_msg_channel_close(Ssh ssh, struct Packet *pktin) /* * Handle incoming data on an SSH-1 or SSH-2 agent-forwarding channel. */ -static int ssh_agent_channel_data(struct ssh_channel *c, char *data, +static int ssh_agent_channel_data(struct ssh_channel *c, const void *data, int length) { bufchain_add(&c->u.a.inbuffer, data, length); @@ -5908,7 +5908,7 @@ static int ssh_agent_channel_data(struct ssh_channel *c, char *data, } static int ssh_channel_data(struct ssh_channel *c, int is_stderr, - char *data, int length) + const void *data, int length) { switch (c->type) { case CHAN_MAINSESSION: diff --git a/ssh.h b/ssh.h index 398f8352..de31df4a 100644 --- a/ssh.h +++ b/ssh.h @@ -226,7 +226,7 @@ struct ec_key *ssh_ecdhkex_newkey(const struct ssh_kex *kex); void ssh_ecdhkex_freekey(struct ec_key *key); void ssh_ecdhkex_getpublic(struct ec_key *key, BinarySink *bs); Bignum ssh_ecdhkex_getkey(struct ec_key *key, - char *remoteKey, int remoteKeyLen); + const void *remoteKey, int remoteKeyLen); /* * Helper function for k generation in DSA, reused in ECDSA @@ -542,7 +542,7 @@ void ssh_send_port_open(void *channel, const char *hostname, int port, extern char *pfd_connect(struct PortForwarding **pf, char *hostname, int port, void *c, Conf *conf, int addressfamily); extern void pfd_close(struct PortForwarding *); -extern int pfd_send(struct PortForwarding *, char *data, int len); +extern int pfd_send(struct PortForwarding *, const void *data, int len); extern void pfd_send_eof(struct PortForwarding *); extern void pfd_confirm(struct PortForwarding *); extern void pfd_unthrottle(struct PortForwarding *); @@ -622,7 +622,7 @@ void x11_free_fake_auth(struct X11FakeAuth *auth); struct X11Connection; /* opaque outside x11fwd.c */ struct X11Connection *x11_init(tree234 *authtree, void *, const char *, int); extern void x11_close(struct X11Connection *); -extern int x11_send(struct X11Connection *, char *, int); +extern int x11_send(struct X11Connection *, const void *, int); extern void x11_send_eof(struct X11Connection *s); extern void x11_unthrottle(struct X11Connection *s); extern void x11_override_throttle(struct X11Connection *s, int enable); diff --git a/sshecc.c b/sshecc.c index 9ce2784b..57bd3595 100644 --- a/sshecc.c +++ b/sshecc.c @@ -2689,7 +2689,8 @@ void ssh_ecdhkex_getpublic(struct ec_key *ec, BinarySink *bs) } } -Bignum ssh_ecdhkex_getkey(struct ec_key *ec, char *remoteKey, int remoteKeyLen) +Bignum ssh_ecdhkex_getkey(struct ec_key *ec, + const void *remoteKey, int remoteKeyLen) { struct ec_point remote; Bignum ret; @@ -2708,7 +2709,8 @@ Bignum ssh_ecdhkex_getkey(struct ec_key *ec, char *remoteKey, int remoteKeyLen) remote.curve = ec->publicKey.curve; remote.infinity = 0; - remote.x = bignum_from_bytes_le((unsigned char*)remoteKey, remoteKeyLen); + remote.x = bignum_from_bytes_le((const unsigned char *)remoteKey, + remoteKeyLen); remote.y = NULL; remote.z = NULL; } diff --git a/x11fwd.c b/x11fwd.c index 493eca67..eee73095 100644 --- a/x11fwd.c +++ b/x11fwd.c @@ -800,8 +800,10 @@ static int x11_parse_ip(const char *addr_string, unsigned long *ip) /* * Called to send data down the raw connection. */ -int x11_send(struct X11Connection *xconn, char *data, int len) +int x11_send(struct X11Connection *xconn, const void *vdata, int len) { + const char *data = (const char *)vdata; + if (!xconn) return 0;