simon-git: putty (master): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Sat Jun 9 14:45:39 BST 2018
TL;DR:
be6fed1 Further void * / const fixes.
734ada9 gdb.py: add a 'memdump' command.
72c2b70 Make logblank_t a typedef.
8b98fea New BinarySink function 'put_padding'.
ba75712 Move some ssh.c declarations into header files.
9e3522a Use a bufchain for outgoing SSH wire data.
679fa90 Move binary packet protocols and censoring out of ssh.c.
93afcf0 Remove the SSH-1 variadic send_packet() system.
Repository: https://git.tartarus.org/simon/putty.git
On the web: https://git.tartarus.org/?p=simon/putty.git
Branch updated: master
Committer: Simon Tatham <anakin at pobox.com>
Date: 2018-06-09 14:45:39
commit be6fed13fa53601aab04338f45770318efd35940
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=be6fed13fa53601aab04338f45770318efd35940;hp=0df6303bb5f2aea6bec6bcc1454bd0971c0358e4
Author: Simon Tatham <anakin at pobox.com>
Date: Fri Jun 8 19:07:47 2018 +0100
Further void * / const fixes.
Yet more of these that commits 7babe66a8 and 8d882756b didn't spot. I
bet these still aren't the last, either.
misc.c | 2 +-
misc.h | 2 +-
ssh.h | 6 +++---
sshccp.c | 12 ++++++++----
sshmd5.c | 8 +++++---
sshsh256.c | 13 ++++++++-----
sshsha.c | 20 ++++++++++++--------
7 files changed, 38 insertions(+), 25 deletions(-)
commit 734ada9b573393022888bb4338f8772af198515e
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=734ada9b573393022888bb4338f8772af198515e;hp=be6fed13fa53601aab04338f45770318efd35940
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Jun 9 07:52:28 2018 +0100
gdb.py: add a 'memdump' command.
This makes it easier for me to examine the contents of binary memory
buffers, while debugging through code that does crypto or packet
marshalling.
contrib/gdb.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
commit 72c2b70736de1df2affd5ded566d38939d6564a6
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=72c2b70736de1df2affd5ded566d38939d6564a6;hp=734ada9b573393022888bb4338f8772af198515e
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Jun 9 09:00:11 2018 +0100
Make logblank_t a typedef.
It seems especially silly for a structure whose name ends in
_t to have to have the 'struct' prefix!
defs.h | 2 ++
1 file changed, 2 insertions(+)
commit 8b98fea4ae2996df7185bed9128dcebc18929a1d
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=8b98fea4ae2996df7185bed9128dcebc18929a1d;hp=72c2b70736de1df2affd5ded566d38939d6564a6
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Jun 9 09:01:07 2018 +0100
New BinarySink function 'put_padding'.
It is to put_data what memset is to memcpy. Several places
in the code wanted it already, but not _quite_ enough for me to
have written it with the rest of the BinarySink infrastructure
originally.
import.c | 3 +--
marshal.c | 11 +++++++++++
marshal.h | 5 +++++
ssh.c | 3 +--
sshpubk.c | 3 +--
5 files changed, 19 insertions(+), 6 deletions(-)
commit ba7571291ab4552a1d587f39e295f8886fa9685b
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=ba7571291ab4552a1d587f39e295f8886fa9685b;hp=8b98fea4ae2996df7185bed9128dcebc18929a1d
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Jun 9 09:07:18 2018 +0100
Move some ssh.c declarations into header files.
ssh.c has been an unmanageably huge monolith of a source file for too
long, and it's finally time I started breaking it up into smaller
pieces. The first step is to move some declarations - basic types like
packets and packet queues, standard constants, enums, and the
coroutine system - into headers where other files can see them.
ssh.c | 180 +++++-----------------------------------------------------------
ssh.h | 115 +++++++++++++++++++++++++++++++++++++++++
sshcr.h | 54 +++++++++++++++++++
3 files changed, 183 insertions(+), 166 deletions(-)
commit 9e3522a97130ec4aec35a024482d694b3e935a05
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=9e3522a97130ec4aec35a024482d694b3e935a05;hp=ba7571291ab4552a1d587f39e295f8886fa9685b
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Jun 9 09:09:10 2018 +0100
Use a bufchain for outgoing SSH wire data.
This mirrors the use of one for incoming wire data: now when we send
raw data (be it the initial greeting, or the output of binary packet
construction), we put it on ssh->outgoing_data, and schedule a
callback to transfer that into the socket.
Partly this is in preparation for delegating the task of appending to
that bufchain to a separate self-contained module that won't have
direct access to the connection's Socket. But also, it has the very
nice feature that I get to throw away the ssh_pkt_defer system
completely! That was there so that we could construct more than one
packet in rapid succession, concatenate them into a single blob, and
pass that blob to the socket in one go so that the TCP headers
couldn't contain any trace of where the boundary between them was. But
now we don't need a separate function to do that: calling the ordinary
packet-send routine twice in the same function before returning to the
main event loop will have that effect _anyway_.
ssh.c | 257 +++++++++++++++++++-----------------------------------------------
1 file changed, 72 insertions(+), 185 deletions(-)
commit 679fa90dfef62153f95816d703a48495546410c7
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=679fa90dfef62153f95816d703a48495546410c7;hp=9e3522a97130ec4aec35a024482d694b3e935a05
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Jun 9 09:09:10 2018 +0100
Move binary packet protocols and censoring out of ssh.c.
sshbpp.h now defines a classoid that encapsulates both directions of
an SSH binary packet protocol - that is, a system for reading a
bufchain of incoming data and turning it into a stream of PktIn, and
another system for taking a PktOut and turning it into data on an
outgoing bufchain.
The state structure in each of those files contains everything that
used to be in the 'rdpkt2_state' structure and its friends, and also
quite a lot of bits and pieces like cipher and MAC states that used to
live in the main Ssh structure.
One minor effect of this layer separation is that I've had to extend
the packet dispatch table by one, because the BPP layer can no longer
directly trigger sending of SSH_MSG_UNIMPLEMENTED for a message too
short to have a type byte. Instead, I extend the PktIn type field to
use an out-of-range value to encode that, and the easiest way to make
that trigger an UNIMPLEMENTED message is to have the dispatch table
contain an entry for it.
(That's a system that may come in useful again - I was also wondering
about inventing a fake type code to indicate network EOF, so that that
could be propagated through the layers and be handled by whichever one
currently knew best how to respond.)
I've also moved the packet-censoring code into its own pair of files,
partly because I was going to want to do that anyway sooner or later,
and mostly because it's called from the BPP code, and the SSH-2
version in particular has to be called from both the main SSH-2 BPP
and the bare unencrypted protocol used for connection sharing. While I
was at it, I took the opportunity to merge the outgoing and incoming
censor functions, so that the parts that were common between them
(e.g. CHANNEL_DATA messages look the same in both directions) didn't
need to be repeated.
Recipe | 3 +-
ssh.c | 1721 ++++++++++++--------------------------------------------
ssh.h | 24 +-
ssh1bpp.c | 280 +++++++++
ssh1censor.c | 76 +++
ssh2bpp-bare.c | 160 ++++++
ssh2bpp.c | 613 ++++++++++++++++++++
ssh2censor.c | 107 ++++
sshbpp.h | 54 ++
9 files changed, 1659 insertions(+), 1379 deletions(-)
commit 93afcf02af7a68d736b487d9665aca741a3d5e0b
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=93afcf02af7a68d736b487d9665aca741a3d5e0b;hp=679fa90dfef62153f95816d703a48495546410c7
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Jun 9 09:59:58 2018 +0100
Remove the SSH-1 variadic send_packet() system.
Now we have the new marshalling system, I think it's outlived its
usefulness, because the new system allows us to directly express
various things (e.g. uint16 and non-zero-terminated strings) that were
actually _more_ awkward to do via the variadic interface. So here's a
rewrite that removes send_packet(), and replaces all its call sites
with something that matches our SSH-2 packet construction idioms.
This diff actually _reduces_ the number of lines of code in ssh.c.
Since the variadic system was trying to save code by centralising
things, that seems like the best possible evidence that it wasn't
pulling its weight!
ssh.c | 340 ++++++++++++++++++++++++++++++------------------------------------
1 file changed, 153 insertions(+), 187 deletions(-)
More information about the tartarus-commits
mailing list