- Aug 04, 2020
-
-
Simon Tatham authored
This is a small wrapper on 'sshfs' which allows it to use Plink as its transport. Mostly useful for when I've already got a PuTTY session open to a given host with connection sharing enabled, and want to tunnel over that rather than painstakingly re-establishing a separate connection.
-
- Jun 14, 2020
-
-
Simon Tatham authored
Python 3 gave me a warning that I should have been using decodebytes instead. (cherry picked from commit 1efded20)
-
Simon Tatham authored
A known_hosts line can have multiple comma-separated hostnames on it, or more usually a hostname and an IP address. In the RSA and DSA key handlers, I was making a list of the integer parameters of the public key by using the 'map' function, and then iterating over it once per hostname on the line. But in Python 3, the 'map' function returns an iterator, not a list, so after you've iterated to its end once, it's empty, and iterating over it a second time stops immediately. As a result, the registry line for the second hostname was coming out empty. (cherry picked from commit 143f8a2d)
-
- Mar 09, 2020
-
-
Simon Tatham authored
Python 3 gave me a warning that I should have been using decodebytes instead.
-
Simon Tatham authored
A known_hosts line can have multiple comma-separated hostnames on it, or more usually a hostname and an IP address. In the RSA and DSA key handlers, I was making a list of the integer parameters of the public key by using the 'map' function, and then iterating over it once per hostname on the line. But in Python 3, the 'map' function returns an iterator, not a list, so after you've iterated to its end once, it's empty, and iterating over it a second time stops immediately. As a result, the registry line for the second hostname was coming out empty.
-
- Mar 04, 2020
-
-
Simon Tatham authored
Most of them are now _mandatory_ P3 scripts, because I'm tired of maintaining everything to be compatible with both versions. The current exceptions are gdb.py (which has to live with whatever gdb gives it), and kh2reg.py (which is actually designed for other people to use, and some of them might still be stuck on P2 for the moment).
-
- Mar 02, 2020
-
-
Simon Tatham authored
This is standardised by RFC 8709 at SHOULD level, and for us it's not too difficult (because we use general-purpose elliptic-curve code). So let's be up to date for a change, and add it. This implementation uses all the formats defined in the RFC. But we also have to choose a wire format for the public+private key blob sent to an agent, and since the OpenSSH agent protocol is the de facto standard but not (yet?) handled by the IETF, OpenSSH themselves get to say what the format for a key should or shouldn't be. So if they don't support a particular key method, what do you do? I checked with them, and they agreed that there's an obviously right format for Ed448 keys, which is to do them exactly like Ed25519 except that you have a 57-byte string everywhere Ed25519 had a 32-byte string. So I've done that.
-
- Sep 08, 2019
-
-
Simon Tatham authored
The number of people has been steadily increasing who read our source code with an editor that thinks tab stops are 4 spaces apart, as opposed to the traditional tty-derived 8 that the PuTTY code expects. So I've been wondering for ages about just fixing it, and switching to a spaces-only policy throughout the code. And I recently found out about 'git blame -w', which should make this change not too disruptive for the purposes of source-control archaeology; so perhaps now is the time. While I'm at it, I've also taken the opportunity to remove all the trailing spaces from source lines (on the basis that git dislikes them, and is the only thing that seems to have a strong opinion one way or the other). Apologies to anyone downstream of this code who has complicated patch sets to rebase past this change. I don't intend it to be needed again.
-
- Apr 21, 2019
-
-
Simon Tatham authored
Obviously we can't do that by inverting the hash function itself, but if the user provides one or more host names on the command line that they're expecting to appear in the file, we can at least compare the stored hashes against those.
-
Simon Tatham authored
Generally useful, I always think.
-
Simon Tatham authored
This change gives us an automatic --help option, which is always useful for a script used very rarely. It also makes it that much easier to add extra options.
-
Simon Tatham authored
Now most of the program consists of function and class definitions, and the code that activates it all is localised in one place at the bottom instead of interleaved between the definitions.
-
Simon Tatham authored
-
Simon Tatham authored
We support it in the ECC code proper these days, as of the bignum rewrite in commit 25b034ee. So we should support it in this auxiliary script too, and fortunately, there's no real difficulty in doing so because I already had some Python code kicking around in test/eccref.py for taking modular square roots.
-
- Jan 25, 2019
-
-
Simon Tatham authored
I've only just found out that it has the effect of treating the argv words not as plain filenames, but as arguments to Perl default 'open', i.e. if they end in | then the text before that is treated as a command. That's not what was intended in any of these contexts! Fortunately, in this project it only comes up in non-critical 'contrib' scripts.
-
- Jan 03, 2019
-
-
Simon Tatham authored
The test suite I'm writing for ecc.c will live in that directory and want to use it to check answers.
-
Simon Tatham authored
I got it right in all the serious code (or else my Curve25519 key exchange wouldn't have worked), but I wrote it down wrongly in the comment in ecc.h, putting the coefficient b on the RHS x term rather than the LHS y^2. Then I repeated the same error in the point decompression function in eccref.py.
-
- Dec 31, 2018
-
-
Simon Tatham authored
The old 'Bignum' data type is gone completely, and so is sshbn.c. In its place is a new thing called 'mp_int', handled by an entirely new library module mpint.c, with API differences both large and small. The main aim of this change is that the new library should be free of timing- and cache-related side channels. I've written the code so that it _should_ - assuming I haven't made any mistakes - do all of its work without either control flow or memory addressing depending on the data words of the input numbers. (Though, being an _arbitrary_ precision library, it does have to at least depend on the sizes of the numbers - but there's a 'formal' size that can vary separately from the actual magnitude of the represented integer, so if you want to keep it secret that your number is actually small, it should work fine to have a very long mp_int and just happen to store 23 in it.) So I've done all my conditionalisation by means of computing both answers and doing bit-masking to swap the right one into place, and all loops over the words of an mp_int go up to the formal size rather than the actual size. I haven't actually tested the constant-time property in any rigorous way yet (I'm still considering the best way to do it). But this code is surely at the very least a big improvement on the old version, even if I later find a few more things to fix. I've also completely rewritten the low-level elliptic curve arithmetic from sshecc.c; the new ecc.c is closer to being an adjunct of mpint.c than it is to the SSH end of the code. The new elliptic curve code keeps all coordinates in Montgomery-multiplication transformed form to speed up all the multiplications mod the same prime, and only converts them back when you ask for the affine coordinates. Also, I adopted extended coordinates for the Edwards curve implementation. sshecc.c has also had a near-total rewrite in the course of switching it over to the new system. While I was there, I've separated ECDSA and EdDSA more completely - they now have separate vtables, instead of a single vtable in which nearly every function had a big if statement in it - and also made the externally exposed types for an ECDSA key and an ECDH context different. A minor new feature: since the new arithmetic code includes a modular square root function, we can now support the compressed point representation for the NIST curves. We seem to have been getting along fine without that so far, but it seemed a shame not to put it in, since it was suddenly easy. In sshrsa.c, one major change is that I've removed the RSA blinding step in rsa_privkey_op, in which we randomise the ciphertext before doing the decryption. The purpose of that was to avoid timing leaks giving away the plaintext - but the new arithmetic code should take that in its stride in the course of also being careful enough to avoid leaking the _private key_, which RSA blinding had no way to do anything about in any case. Apart from those specific points, most of the rest of the changes are more or less mechanical, just changing type names and translating code into the new API.
-
- Nov 16, 2018
-
-
Simon Tatham authored
The gdb version of container_of can do better than the C function, because you don't have to specify the structure field name if it can be inferred from the type of the input expression. And $list234 can be made to automatically list the contents of each tree element, not just a pointer to it - just the thing for looking quickly through sktree or s->channels to find the one you're after.
-
- Nov 03, 2018
-
-
Simon Tatham authored
This commit includes <stdbool.h> from defs.h and deletes my traditional definitions of TRUE and FALSE, but other than that, it's a 100% mechanical search-and-replace transforming all uses of TRUE and FALSE into the C99-standardised lowercase spellings. No actual types are changed in this commit; that will come next. This is just getting the noise out of the way, so that subsequent commits can have a higher proportion of signal.
-
- Oct 06, 2018
-
-
Simon Tatham authored
These are things where no fix was actually necessary in the code, but the FIXME indicated that the comment itself was either in need of a rewrite or removal.
-
Simon Tatham authored
There was a while when I hadn't decided what the name of the program was going to be, and apparently once I did I never got round to substituting it back in everywhere.
-
- Oct 04, 2018
-
-
Simon Tatham authored
All the main backend structures - Ssh, Telnet, Pty, Serial etc - now describe structure types themselves rather than pointers to them. The same goes for the codebase-wide trait types Socket and Plug, and the supporting types SockAddr and Pinger. All those things that were typedefed as pointers are older types; the newer ones have the explicit * at the point of use, because that's what I now seem to be preferring. But whichever one of those is better, inconsistently using a mixture of the two styles is worse, so let's make everything consistent. A few types are still implicitly pointers, such as Bignum and some of the GSSAPI types; generally this is either because they have to be void *, or because they're typedefed differently on different platforms and aren't always pointers at all. Can't be helped. But I've got rid of the main ones, at least.
-
- Jun 09, 2018
-
-
Simon Tatham authored
This makes it easier for me to examine the contents of binary memory buffers, while debugging through code that does crypto or packet marshalling.
-
- Jun 04, 2018
-
-
Simon Tatham authored
I've been playing around with GDB's Python scripting system recently, and this is a thing I've always thought it would be nice to be able to do: if you load this script (which, on Ubuntu 18.04's gdb, is as simple as 'source contrib/gdb.py' at the gdb prompt, or similar), then variables of type Bignum will be printed as (e.g.) 'Bignum(0x12345)', or 'Bignum(NULL)' if they're null pointers, or a fallback representation if they're non-null pointers but gdb can't read anything sensible from them.
-
- May 26, 2018
-
-
Simon Tatham authored
This is a cleanup I started to notice a need for during the BinarySink work. It removes a lot of faffing about casting things to char * or unsigned char * so that some API will accept them, even though lots of such APIs really take a plain 'block of raw binary data' argument and don't care what C thinks the signedness of that data might be - they may well reinterpret it back and forth internally. So I've tried to arrange for all the function call APIs that ought to have a void * (or const void *) to have one, and those that need to do pointer arithmetic on the parameter internally can cast it back at the top of the function. That saves endless ad-hoc casts at the call sites.
-
- Apr 26, 2018
-
-
Simon Tatham authored
-
- Apr 11, 2018
-
-
Simon Tatham authored
Used the wrong kind of brackets when initialising the actual hash (as opposed to hash ref) %disc_reasons. Not sure how I didn't notice the warning in yesterday's testing!
-
- Apr 10, 2018
-
-
Simon Tatham authored
I'm increasingly wishing I'd written this parsing program in Python, and yet another reason why is that using argparse for the command-line handling makes it a lot harder to forget to write the --help text when you add an extra option.
-
- Apr 09, 2018
-
-
Simon Tatham authored
This makes it more feasible to use logparse.pl as an output filter on a PuTTY SSH log file and discard the original file. In particular, ever since commit b4fde270, I've been finding it useful when testing new code to direct my SSH logs to a named pipe and have another terminal window give a real-time dump of them by running 'while cat $named_pipe; do :; done'. Now I can replace the 'cat' in that shell command with 'logparse.pl -ve' and still get the Event Log messages as well as the unpacked contents of all the packets.
-
Simon Tatham authored
This includes picking apart the various asymmetric crypto formats (public keys, signatures, elliptic-curve point encodings) as far as possible, but since the verbose decoder system in logparse.pl currently has to work without benefit of statefulness, it's not always possible - some of the ECC formats depend for their decoding on everyone remembering _which_ ECC protocol was negotiated by the KEXINITs.
-
- Apr 05, 2018
-
-
Simon Tatham authored
The type code for an mpint in the input format string is "m", not "mpint". This hasn't come up yet as far as I can see, but as and when I add verbose dump routines for packet types that involve asymmetric crypto, it will.
-
Simon Tatham authored
This allows me to request a verbose dump of the contents of some particular packet type, or for all packet types. Currently, the only packet type for which I've written a verbose dump function is KEXINIT, but the framework is there to add further verbose dumpers as and when they're needed.
-
Simon Tatham authored
Switched to Getopt::Long in place of the previous ad-hockery, which will make it easier to add more (and more complicated) options.
-
- May 07, 2017
-
-
Simon Tatham authored
-
- Apr 08, 2017
-
-
Simon Tatham authored
Mark Wooding pointed out that my comment in make1305.py was completely wrong, and that the stated strategy for reducing a value mod 2^130-5 would not in fact completely reduce all inputs in the range - for the most obvious reason, namely that the numbers between 2^130-5 and 2^130 would never have anything subtracted at all. Implemented a replacement strategy which my tests suggest will do the right thing for all numbers in the expected range that are anywhere near an integer multiple of the modulus.
-
- Mar 17, 2017
-
-
Owen Dunn authored
The specification at http://support.microsoft.com/kb/310516 says .reg files should have a blank line at the end.
-
- Sep 19, 2016
-
-
Simon Tatham authored
On Debian stretch, it seems we don't get setpgrp() unless we do not merely define it, but define it to 500 or greater.
-
- May 03, 2016
-
-
Simon Tatham authored
It now expects its standard input to be connected to the same PuTTY its standard output is talking to, i.e. expects to be invoked as a proxy command. It conducts the same sample key exchange as it used to, but now reads the SSH greeting and first couple of packets back from PuTTY and minimally checks that they're something like what it was expecting. (In the process, I've also fixed a mistake in the Python message code enumeration, which caused one of those expect() calls to fail.)
-
- Mar 25, 2016
-
-
Simon Tatham authored
-