]> asedeno.scripts.mit.edu Git - PuTTY.git/log
PuTTY.git
9 years agoAdd a reference to a spec for Curve25519.
Simon Tatham [Tue, 19 May 2015 08:56:56 +0000 (09:56 +0100)]
Add a reference to a spec for Curve25519.

It doesn't seem to be all that good a spec, in that it seems to be
specified in terms of functions in libssh and hence based on the
assumption that you already know exactly what those functions do. But
it's something, at least.

9 years agoFix construction of the output bignum in Curve25519 kex.
Simon Tatham [Tue, 19 May 2015 08:54:17 +0000 (09:54 +0100)]
Fix construction of the output bignum in Curve25519 kex.

We were doing an endianness flip on the output elliptic-curve point.
Endianness flips of bignums, of course, have to specify how many bytes
they're imagining the value to have (that's how you decide whether to
convert 0xA1A2 into 0xA2A1 or 0xA2A10000 or 0xA2A1000000000000 etc),
and we had chosen our byte count based on the highest set bit in the
_output value_ - but in fact we should have chosen it based on the
size of the curve's modulus, leading to a failure about 1/256 of the
time when the MSB happened to come out zero so the two byte counts
differed.

(Also added a missing smemclr, while I was there.)

9 years agoLog which elliptic curve we're using for ECDH kex.
Simon Tatham [Tue, 19 May 2015 07:42:23 +0000 (08:42 +0100)]
Log which elliptic curve we're using for ECDH kex.

It seems like quite an important thing to mention in the event log!
Suppose there's a bug affecting only one curve, for example? Fixed-
group Diffie-Hellman has always logged the group, but the ECDH log
message just told you the hash and not also the curve.

To implement this, I've added a 'textname' field to all elliptic
curves, whether they're used for kex or signing or both, suitable for
use in this log message and any others we might find a need for in
future.

9 years agoFix a compile warning with -DDEBUG.
Simon Tatham [Mon, 18 May 2015 20:17:21 +0000 (21:17 +0100)]
Fix a compile warning with -DDEBUG.

An unguarded write() in the dputs function caused gcc -Werror to fail
to compile. I'm confused that this hasn't bitten me before, though -
obviously normal builds of PuTTY condition out the faulty code, but
_surely_ this can't be the first time I've enabled the developer
diagnostics since gcc started complaining about unchecked syscall
returns!

9 years agoAdd missing consts in elliptic curve setup code.
Simon Tatham [Mon, 18 May 2015 20:04:46 +0000 (21:04 +0100)]
Add missing consts in elliptic curve setup code.

All those static arrays giving the curves' constants ought to be
'static const' and go in the data segment, of course.

9 years agoLog the client process ID for Windows named pipes too.
Simon Tatham [Mon, 18 May 2015 15:00:13 +0000 (16:00 +0100)]
Log the client process ID for Windows named pipes too.

Turns out it didn't take much googling to find the right API function.

9 years agoLog identifying information for the other end of connections.
Simon Tatham [Mon, 18 May 2015 12:57:45 +0000 (13:57 +0100)]
Log identifying information for the other end of connections.

When anyone connects to a PuTTY tool's listening socket - whether it's
a user of a local->remote port forwarding, a connection-sharing
downstream or a client of Pageant - we'd like to log as much
information as we can find out about where the connection came from.

To that end, I've implemented a function sk_peer_info() in the socket
abstraction, which returns a freeform text string as best it can (or
NULL, if it can't get anything at all) describing the thing at the
other end of the connection. For TCP connections, this is done using
getpeername() to get an IP address and port in the obvious way; for
Unix-domain sockets, we attempt SO_PEERCRED (conditionalised on some
moderately hairy autoconfery) to get the pid and owner of the peer. I
haven't implemented anything for Windows named pipes, but I will if I
hear of anything useful.

9 years agoGratuitous simplification of commasep_string functions.
Ben Harris [Sun, 17 May 2015 22:14:57 +0000 (23:14 +0100)]
Gratuitous simplification of commasep_string functions.

in_commasep_string() is now implemented in terms of
first_in_commasep_string(), memchr(), and tail recursion.

9 years agoaskpass: don't treat releases of Ret or Esc as presses.
Simon Tatham [Sun, 17 May 2015 15:40:36 +0000 (16:40 +0100)]
askpass: don't treat releases of Ret or Esc as presses.

Caused an embarrassing failure just now trying to run the test program
from a command prompt - I had Return still held down by the time it
started up, and my release of it immediately terminated input :-)

9 years agoRestructure KEXINIT generation and parsing.
Ben Harris [Sun, 17 May 2015 09:53:27 +0000 (10:53 +0100)]
Restructure KEXINIT generation and parsing.

The new code remembers the contents and meaning of the outgoing KEXINIT
and uses this to drive the algorithm negotiation, rather than trying to
reconstruct what the outgoing KEXINIT probably said.  This removes the
need to maintain the KEXINIT generation and parsing code precisely in
parallel.

It also fixes a bug whereby PuTTY would have selected the wrong host key
type in cases where the server gained a host key type between rekeys.

9 years agoFix mpint signedness bug in importing PEM ECDSA keys.
Simon Tatham [Fri, 15 May 2015 13:01:35 +0000 (14:01 +0100)]
Fix mpint signedness bug in importing PEM ECDSA keys.

The OpenSSH PEM format contains a big integer with the top bit
potentially set, which we handle by copying the data into a faked up
instance of our own private key format, and passing that to
ecdsa_createkey(). But our own private key format expects an SSH-2
standard mpint, i.e. with the top bit reliably clear, so this might
fail for no good reason.

Fixed by prefixing a zero byte unconditionally when constructing the
fake private blob.

9 years agoRemove pointless NULL checks in the ECC code.
Simon Tatham [Fri, 15 May 2015 12:27:15 +0000 (13:27 +0100)]
Remove pointless NULL checks in the ECC code.

snew(), and most of the bignum functions, are deliberately written to
fail an assertion and terminate the program rather than return NULL,
so there's no point carefully checking their every return value for
NULL. This removes a huge amount of pointless error-checking code, and
makes the elliptic curve arithmetic almost legible in places :-)

I've kept error checks after modinv(), because that can return NULL if
asked to invert zero. bigsub() can also fail in principle, because our
bignums are non-negative only, but in the couple of cases where it's
used there's a preceding compare that should prevent it, so I've just
added assertions.

9 years agoWindows PuTTYgen: fix mis-setting of radio buttons.
Simon Tatham [Fri, 15 May 2015 12:01:33 +0000 (13:01 +0100)]
Windows PuTTYgen: fix mis-setting of radio buttons.

The menu options and radio buttons for key type were not consistently
setting each other when selected: in particular, selecting from the
menu did not cause the ED25519 radio button to be either set or unset
when that would have been appropriate.

Looks as if I failed to catch in code review the fact that we should
have _one_ call to each of CheckRadioButton and CheckMenuRadioItem,
and they should both have the right 'first' and 'last' parameters

9 years agoGiant const-correctness patch of doom!
Simon Tatham [Fri, 15 May 2015 10:15:42 +0000 (11:15 +0100)]
Giant const-correctness patch of doom!

Having found a lot of unfixed constness issues in recent development,
I thought perhaps it was time to get proactive, so I compiled the
whole codebase with -Wwrite-strings. That turned up a huge load of
const problems, which I've fixed in this commit: the Unix build now
goes cleanly through with -Wwrite-strings, and the Windows build is as
close as I could get it (there are some lingering issues due to
occasional Windows API functions like AcquireCredentialsHandle not
having the right constness).

Notable fallout beyond the purely mechanical changing of types:
 - the stuff saved by cmdline_save_param() is now explicitly
   dupstr()ed, and freed in cmdline_run_saved.
 - I couldn't make both string arguments to cmdline_process_param()
   const, because it intentionally writes to one of them in the case
   where it's the argument to -pw (in the vain hope of being at least
   slightly friendly to 'ps'), so elsewhere I had to temporarily
   dupstr() something for the sake of passing it to that function
 - I had to invent a silly parallel version of const_cmp() so I could
   pass const string literals in to lookup functions.
 - stripslashes() in pscp.c and psftp.c has the annoying strchr nature

9 years agoRemove an entire unused function in Windows PuTTYgen.
Simon Tatham [Fri, 15 May 2015 11:27:15 +0000 (12:27 +0100)]
Remove an entire unused function in Windows PuTTYgen.

When I did the public-key output revamp, I completely failed to notice
I'd orphaned this function :-) Clean it up.

9 years agoUnix Pageant: fix further double-frees.
Simon Tatham [Fri, 15 May 2015 10:02:33 +0000 (11:02 +0100)]
Unix Pageant: fix further double-frees.

No need to sfree(err) before going to the cleanup code, because the
whole point of shared cleanup code is that that will do it for us.

9 years agoClean up hash selection in ECDSA.
Simon Tatham [Fri, 15 May 2015 09:13:06 +0000 (10:13 +0100)]
Clean up hash selection in ECDSA.

Removed another set of ad-hoc tests of the key size to decide which
hash to use for the signature system, and replaced them with a
straightforward pointer to an ssh_hash structure in the 'extra' area.

9 years agoClean up elliptic curve selection and naming.
Simon Tatham [Fri, 15 May 2015 09:13:05 +0000 (10:13 +0100)]
Clean up elliptic curve selection and naming.

The ec_name_to_curve and ec_curve_to_name functions shouldn't really
have had to exist at all: whenever any part of the PuTTY codebase
starts using sshecc.c, it's starting from an ssh_signkey or ssh_kex
pointer already found by some other means. So if we make sure not to
lose that pointer, we should never need to do any string-based lookups
to find the curve we want, and conversely, when we need to know the
name of our curve or our algorithm, we should be able to look it up as
a straightforward const char * starting from the algorithm pointer.

This commit cleans things up so that that is indeed what happens. The
ssh_signkey and ssh_kex structures defined in sshecc.c now have
'extra' fields containing pointers to all the necessary stuff;
ec_name_to_curve and ec_curve_to_name have been completely removed;
struct ec_curve has a string field giving the curve's name (but only
for those curves which _have_ a name exposed in the wire protocol,
i.e. the three NIST ones); struct ec_key keeps a pointer to the
ssh_signkey it started from, and uses that to remember the algorithm
name rather than reconstructing it from the curve. And I think I've
got rid of all the ad-hockery scattered around the code that switches
on curve->fieldBits or manually constructs curve names using stuff
like sprintf("nistp%d"); the only remaining switch on fieldBits
(necessary because that's the UI for choosing a curve in PuTTYgen) is
at least centralised into one place in sshecc.c.

One user-visible result is that the format of ed25519 host keys in the
registry has changed: there's now no curve name prefix on them,
because I think it's not really right to make up a name to use. So any
early adopters who've been using snapshot PuTTY in the last week will
be inconvenienced; sorry about that.

9 years agoProvide an 'extra' pointer in ssh_signkey and ssh_kex.
Simon Tatham [Fri, 15 May 2015 09:12:08 +0000 (10:12 +0100)]
Provide an 'extra' pointer in ssh_signkey and ssh_kex.

This gives families of public key and kex functions (by which I mean
those sharing a set of methods) a place to store parameters that allow
the methods to vary depending on which exact algorithm is in use.

The ssh_kex structure already had a set of parameters specific to
Diffie-Hellman key exchange; I've moved those into sshdh.c and made
them part of the 'extra' structure for that family only, so that
unrelated kex methods don't have to faff about saying NULL,NULL,0,0.
(This required me to write an extra accessor function for ssh.c to ask
whether a DH method was group-exchange style or fixed-group style, but
that doesn't seem too silly.)

9 years agoPass the ssh_signkey structure itself to public key methods.
Simon Tatham [Fri, 15 May 2015 09:12:07 +0000 (10:12 +0100)]
Pass the ssh_signkey structure itself to public key methods.

Not all of them, but the ones that don't get a 'void *key' parameter.
This means I can share methods between multiple ssh_signkey
structures, and still give those methods an easy way to find out which
public key method they're dealing with, by loading parameters from a
larger structure in which the ssh_signkey is the first element.

(In OO terms, I'm arranging that all static methods of my public key
classes get a pointer to the class vtable, to make up for not having a
pointer to the class instance.)

I haven't actually done anything with the new facility in this commit,
but it will shortly allow me to clean up the constant lookups by curve
name in the ECDSA code.

9 years agoConst-correctness of name fields in struct ssh_*.
Simon Tatham [Fri, 15 May 2015 09:12:06 +0000 (10:12 +0100)]
Const-correctness of name fields in struct ssh_*.

All the name strings in ssh_cipher, ssh_mac, ssh_hash, ssh_signkey
point to compile-time string literals, hence should obviously be const
char *.

Most of these const-correctness patches are just a mechanical job of
adding a 'const' in the one place you need it right now, and then
chasing the implications through the code adding further consts until
it compiles. But this one has actually shown up a bug: the 'algorithm'
output parameter in ssh2_userkey_loadpub was sometimes returning a
pointer to a string literal, and sometimes a pointer to dynamically
allocated memory, so callers were forced to either sometimes leak
memory or sometimes free a bad thing. Now it's consistently
dynamically allocated, and should be freed everywhere too.

9 years agoConst-correctness in struct ssh_hash.
Simon Tatham [Fri, 15 May 2015 09:12:05 +0000 (10:12 +0100)]
Const-correctness in struct ssh_hash.

The 'bytes' function should take a const void * as input, not a void *.

9 years agoFix layout overflow in Windows PuTTYgen due to ED25519.
Simon Tatham [Thu, 14 May 2015 12:19:15 +0000 (13:19 +0100)]
Fix layout overflow in Windows PuTTYgen due to ED25519.

Adding an extra radio button to the key-type selector caused it to
wrap on to another line and push the bottom of the containing control
box down off the bottom of the window.

In the long term, should more public key formats continue to appear,
we'll probably have to replace the radio buttons with something more
extensible like a drop-down list. For the moment, though, I've fixed
it by just reducing the space per radio button to bring all five
controls back on to the same line.

To fit the text into the smaller space, I also removed the 'SSH-2'
prefix on each key type, which ought to be unnecessary these days
since SSH-2 is a well established default. Only the SSH-1 RSA key type
is still labelled with an SSH version. (And I've moved it to the far
end rather than the start of the line, while I'm here.)

9 years agoAdd a check for NULL in pageant_forget_passphrases().
Simon Tatham [Thu, 14 May 2015 08:16:26 +0000 (09:16 +0100)]
Add a check for NULL in pageant_forget_passphrases().

I've no reason to believe it will _currently_ be called with the
'passphrases' tree not even set up yet, but I managed to get that to
happen while playing about with experimental code just now, and it
seemed like a good safety check to keep in general.

9 years agoUnix Pageant: implement GUI passphrase prompting.
Simon Tatham [Wed, 13 May 2015 12:55:08 +0000 (13:55 +0100)]
Unix Pageant: implement GUI passphrase prompting.

I've written my own analogue of OpenSSH's ssh-askpass. At the moment,
it's contained inside Pageant proper, though it could easily be
compiled into a standalone binary as well or instead.

Unlike OpenSSH's version, I don't use a GTK edit box; instead I just
process key events myself and append them to a buffer. The big
advantage of doing this is that I can arrange for ^W and ^U to
function as they do in terminal line editing, i.e. delete a word or
delete the whole line.

^W in particular is really valuable when typing a multiple-word
passphrase unseen. If you feel yourself making the kind of typo in
which you're not sure if you pressed six keys or just five, you can
hit ^W and restart just that word, without either having to go right
back to the beginning or carry on and see if you feel lucky.

A delete-word function would of course be an information leak in even
an obscured edit box (displaying a blob per character), so instead I
give a visual acknowledgment of keypresses by a more ad-hoc means: I
display three lights in the box, and every meaningful keypress turns
off the currently active one and instead turns on a randomly selected
one of the others. (So the lit light doesn't even indicate _mod 3_ how
many keys have been pressed.)

9 years agoUnix Pageant: factor out have_controlling_tty().
Simon Tatham [Wed, 13 May 2015 12:54:15 +0000 (13:54 +0100)]
Unix Pageant: factor out have_controlling_tty().

I'm going to want to reuse it when deciding on a passphrase-prompting
strategy.

9 years agoUnix Pageant: fix a double-free when adding keys.
Simon Tatham [Wed, 13 May 2015 12:22:44 +0000 (13:22 +0100)]
Unix Pageant: fix a double-free when adding keys.

I had freed the comment string coming back from pageant_add_keyfile,
but not NULLed out the pointer, so that the cleanup code at the end of
the function would have freed it again.

9 years agoUnix Pageant: support -D, to delete all keys.
Simon Tatham [Tue, 12 May 2015 13:55:44 +0000 (14:55 +0100)]
Unix Pageant: support -D, to delete all keys.

9 years agoUnix Pageant: provide public-key extraction options.
Simon Tatham [Tue, 12 May 2015 13:48:32 +0000 (14:48 +0100)]
Unix Pageant: provide public-key extraction options.

I've decided against implementing an option exactly analogous to
'ssh-add -L' (printing the full public key of everything in the
agent). Instead, you can identify a specific key to display in full,
by any of the same means -d lets you use, and then print it in either
of the public key formats we support.

9 years agoCentralise SSH-2 key fingerprinting into sshpubk.c.
Simon Tatham [Tue, 12 May 2015 13:35:44 +0000 (14:35 +0100)]
Centralise SSH-2 key fingerprinting into sshpubk.c.

There were ad-hoc functions for fingerprinting a bare key blob in both
cmdgen.c and pageant.c, not quite doing the same thing. Also, every
SSH-2 public key algorithm in the code base included a dedicated
fingerprint() method, which is completely pointless since SSH-2 key
fingerprints are computed in an algorithm-independent way (just hash
the standard-format public key blob), so each of those methods was
just duplicating the work of the public_blob() method with a less
general output mechanism.

Now sshpubk.c centrally provides an ssh2_fingerprint_blob() function
that does all the real work, plus an ssh2_fingerprint() function that
wraps it and deals with calling public_blob() to get something to
fingerprint. And the fingerprint() method has been completely removed
from ssh_signkey and all its implementations, and good riddance.

9 years agoCentralise public-key output code into sshpubk.c.
Simon Tatham [Tue, 12 May 2015 12:42:26 +0000 (13:42 +0100)]
Centralise public-key output code into sshpubk.c.

There was a fair amount of duplication between Windows and Unix
PuTTYgen, and some confusion over writing things to FILE * and
formatting them internally into strings. I think all the public-key
output code now lives in sshpubk.c, and there's only one copy of the
code to generate each format.

9 years agoConst-correctness in the base64 functions.
Simon Tatham [Tue, 12 May 2015 13:00:04 +0000 (14:00 +0100)]
Const-correctness in the base64 functions.

9 years agoUnix Pageant: support -d, to delete a key from the agent.
Simon Tatham [Tue, 12 May 2015 12:27:33 +0000 (13:27 +0100)]
Unix Pageant: support -d, to delete a key from the agent.

Unlike ssh-add, we can identify the key by its comment or by a prefix
of its fingerprint as well as using a public key file on disk. The
string given as an argument to -d is interpreted as whichever of those
things matches; disambiguating prefixes are available if needed.

9 years agoSupport using public-only key files in PuTTY proper.
Simon Tatham [Tue, 12 May 2015 11:30:25 +0000 (12:30 +0100)]
Support using public-only key files in PuTTY proper.

Obviously PuTTY can't actually do public-key authentication itself, if
you give it a public rather than private key file. But it can still
match the supplied public key file against the list of keys in the
agent, and narrow down to that. So if for some reason you're
forwarding an agent to a machine you don't want to trust with your
_private_ key file (even encrypted), you can still use the '-i' option
to select which key from the agent to use, by uploading just the
public key file to that machine.

9 years agoSupport loading public-key-only files in Unix PuTTYgen.
Simon Tatham [Tue, 12 May 2015 11:19:57 +0000 (12:19 +0100)]
Support loading public-key-only files in Unix PuTTYgen.

The rsakey_pubblob() and ssh2_userkey_loadpub() functions, which
expected to be given a private key file and load only the unencrypted
public half, now also cope with any of the public-only formats I know
about (SSH-1 only has one, whereas SSH-2 has the RFC 4716 format and
OpenSSH's one-line format) and return an appropriate public key blob
from each of those too.

cmdgen now supports this functionality, by permitting public key files
to be loaded and used by any operation that doesn't need the private
key: so you can convert back and forth between the SSH-2 public
formats, or list the file's fingerprint.

9 years agoUtility function: bignum_from_decimal.
Simon Tatham [Tue, 12 May 2015 11:10:42 +0000 (12:10 +0100)]
Utility function: bignum_from_decimal.

9 years agoUtility function: 'chomp'.
Simon Tatham [Tue, 12 May 2015 09:47:33 +0000 (10:47 +0100)]
Utility function: 'chomp'.

Basically like Perl's, only we forgive \r\n line endings.

9 years agoExpand comment on BUG_SSH2_OLDGEX to make it clear why it's necessary.
Ben Harris [Mon, 11 May 2015 21:44:57 +0000 (22:44 +0100)]
Expand comment on BUG_SSH2_OLDGEX to make it clear why it's necessary.

I had wondered why we couldn't just catch SSH_MSG_UNIMPLEMENTED, and
now I know: OpenSSH disconnects if the client sends
SSH_MSG_KEX_DH_GEX_REQUEST.

9 years agoSimplify ssh_pkt_addstring_str().
Ben Harris [Sun, 10 May 2015 20:12:37 +0000 (21:12 +0100)]
Simplify ssh_pkt_addstring_str().

It's just ssh_pkt_addstring_data but using strlen to get the length of
string to add, so make that explicit by having it call
ssh_pkt_addstring_data.  Good compilers should be unaffected by this
change.

9 years agoUnix Pageant: first draft of -l key list option.
Simon Tatham [Mon, 11 May 2015 17:34:45 +0000 (18:34 +0100)]
Unix Pageant: first draft of -l key list option.

It doesn't look very pretty at the moment, but it lists the keys and
gets the fingerprints right.

9 years agoUnix Pageant: support loading keys.
Simon Tatham [Mon, 11 May 2015 16:58:55 +0000 (17:58 +0100)]
Unix Pageant: support loading keys.

You can now load keys at Pageant init time, by putting the key file
names as bare arguments on the command line, e.g. 'pageant -T key.ppk'
or 'pageant key.ppk --exec some command'; also, 'pageant -a key.ppk'
behaves more or less like ssh-add, contacting an existing agent to add
the key.

The askpass() function currently supports terminal-based prompting
only. X11 askpass is yet to be implemented.

9 years agoUnix Pageant: link in uxagentc.c and uxcons.c.
Simon Tatham [Mon, 11 May 2015 16:56:51 +0000 (17:56 +0100)]
Unix Pageant: link in uxagentc.c and uxcons.c.

This brings in the code we'll need to request passphrases from the
terminal, and to talk to an existing SSH agent as a client.

Adding uxcons.c required adjusting the set of stub functions in
uxpgnt.c: uxcons.c removed the need for several, but added one of its
own (log_eventlog). A net win, though.

9 years agoUnix Pageant: prepare to add client-side modes.
Simon Tatham [Mon, 11 May 2015 16:56:37 +0000 (17:56 +0100)]
Unix Pageant: prepare to add client-side modes.

I've moved the setup and running of the actual agent server into
run_agent(), so that main() is now only command-line parsing and
validation. We recognise a collection of new command-line options for
talking to an existing agent as a client (analogous to ssh-add), which
go to a new run_client() function, but I haven't filled in that
function itself yet.

9 years agoFix faulty length fields in pageant_get_keylist*().
Simon Tatham [Mon, 11 May 2015 16:52:45 +0000 (17:52 +0100)]
Fix faulty length fields in pageant_get_keylist*().

Those must have been wrong _forever_, but because Windows Pageant
doesn't mind if the message length is longer than it should be, I've
never noticed before. How embarrassing.

9 years agoSupport synchronous agent requests on Unix.
Simon Tatham [Mon, 11 May 2015 16:12:40 +0000 (17:12 +0100)]
Support synchronous agent requests on Unix.

This is only intended for use in Unix Pageant; for any application
that's actually trying to get something else useful done at the same
time as the agent request is pending, it's much more sensible to use
the more rigorous existing approach of requesting a callback once the
agent request is answered.

Adding this mode is the easiest way to allow Unix Pageant's
command-line key loading to work, but it doesn't solve the underlying
problem that the supposedly cross-platform pageant_add_keyfile will
not work on a platform where we really _are_ constrained to do agent
requests asynchronously (perhaps because we're a GUI app in some
system that doesn't let us control our own top-level event loop).

If and when that situation arises, I'll have no choice but to turn
pageant_add_keyfile and friends (specifically, any function in
pageant.c that calls agent_query) into coroutine-structured functions,
and have clients call them repeatedly until they return 'finished'.

But for now, this is a lot easier!

9 years agoUnix Pageant: move handling of --exec arguments.
Simon Tatham [Mon, 11 May 2015 12:11:17 +0000 (13:11 +0100)]
Unix Pageant: move handling of --exec arguments.

Now --exec instantly terminates option processing, by treating
everything after it as the command. This means it doesn't matter if
the --exec command word looks like another option, and it also means
we can simplify the handling of real non-option argument words, when I
get round to adding some for loading keys.

9 years agoPageant: factor out cross-platform parts of add_keyfile().
Simon Tatham [Mon, 11 May 2015 14:06:25 +0000 (15:06 +0100)]
Pageant: factor out cross-platform parts of add_keyfile().

I've now centralised into pageant.c all the logic about trying to load
keys of any type, with no passphrase or with the passphrases used in
previous key-loading actions or with a new user-supplied passphrase,
whether we're the main Pageant process ourself or are talking to
another one as a client. The only part of that code remaining in
winpgnt.c is the user interaction via dialog boxes, which of course is
the part that will need to be done differently on other platforms.

9 years agoConst-correctness in key-loading functions.
Simon Tatham [Mon, 11 May 2015 14:23:48 +0000 (15:23 +0100)]
Const-correctness in key-loading functions.

The passphrase parameter should be a const char *.

9 years agoUnix Pageant: -T option, tying lifetime to controlling tty.
Simon Tatham [Fri, 8 May 2015 18:50:48 +0000 (19:50 +0100)]
Unix Pageant: -T option, tying lifetime to controlling tty.

This is intended to be a useful mode when you want to run an ssh agent
in a terminal session with no X11 available. You just execute a
command along the lines of eval $(pageant -T), and then Pageant will
run in the background for the rest of that terminal session - and when
the terminal session ends, so that Pageant loses its controlling tty,
it will take that as the signal to shut down. So, no need to manually
kill it, and unlike 'pageant --exec $SHELL', you can also do this half
way through a session if you don't realise until later that you need
an SSH agent, without losing any shell command history or other shell
context that you've accumulated so far in the session.

Unfortunately, I haven't been able to find any reliable way to
actually implement this -T mode, short of having Pageant wake up at
regular intervals and try to open /dev/tty to see if it's still there.
I had hoped that I could arrange to reliably get SIGHUP, or select on
/dev/tty for exceptional conditions, or some such, but nothing I've
tried along those lines seems to work.

9 years agoClear an extra low bit in EdDSA exponent calculation.
Simon Tatham [Sun, 10 May 2015 13:04:16 +0000 (14:04 +0100)]
Clear an extra low bit in EdDSA exponent calculation.

The source paper, and OpenSSH, agree that the lowest bit index used
from the hash of the private key is bit 3, i.e. bits 0,1,2 at the
bottom are all zero. We were only clearing bits 0 and 1, which would
have worked for about half of keys. I must have got lucky during
testing!

9 years agoSort out the mess with OpenSSH key file formats.
Simon Tatham [Sun, 10 May 2015 06:42:48 +0000 (07:42 +0100)]
Sort out the mess with OpenSSH key file formats.

When I implemented reading and writing of the new format a couple of
weeks ago, I kept them strictly separate in the UI, so you have to ask
for the format you want when exporting. But in fact this is silly,
because not every key type can be saved in both formats, and OpenSSH
itself has the policy of using the old format for key types it can
handle, unless specifically asked to use the new one.

So I've now arranged that the key file format enum has three values
for OpenSSH: PEM, NEW and AUTO. Files being loaded are identified as
either PEM or NEW, which describe the two physical file formats. But
exporting UIs present either AUTO or NEW, where AUTO is the virtual
format meaning 'save in the old format if possible, otherwise the new
one'.

9 years agoSupport public keys using the "ssh-ed25519" method.
Chris Staite [Sat, 9 May 2015 14:02:54 +0000 (15:02 +0100)]
Support public keys using the "ssh-ed25519" method.

This introduces a third system of elliptic curve representation and
arithmetic, namely Edwards form.

9 years agoSupport ECDH key exchange using the 'curve25519' curve.
Chris Staite [Sat, 9 May 2015 14:02:52 +0000 (15:02 +0100)]
Support ECDH key exchange using the 'curve25519' curve.

This is the kex protocol id "curve25519-sha256@libssh.org", so called
because it's over the prime field of order 2^255 - 19.

Arithmetic in this curve is done using the Montgomery representation,
rather than the Weierstrass representation. So 'struct ec_curve' has
grown a discriminant field and a union of subtypes.

9 years agoProvide a little-endian version of bignum_from_bytes().
Chris Staite [Sat, 9 May 2015 14:02:50 +0000 (15:02 +0100)]
Provide a little-endian version of bignum_from_bytes().

9 years agoVary cmdgen's default key size based on key type.
Simon Tatham [Sat, 9 May 2015 14:02:47 +0000 (15:02 +0100)]
Vary cmdgen's default key size based on key type.

It's a bit silly to have 'puttygen -t ecdsa' immediately crash out
because the default key size is 2048 and we don't know a 2048-bit
elliptic curve.

9 years agoConst-correctness in the debug functions!
Simon Tatham [Sat, 9 May 2015 14:02:45 +0000 (15:02 +0100)]
Const-correctness in the debug functions!

I'm finding missing constifications all over the place this week.
Turns out that dmemdump() has been taking a non-const memory pointer
ever since the beginning, and it's never come up until now. How silly.

9 years agoCompletely remove the privdata mechanism in dialog.h.
Simon Tatham [Fri, 8 May 2015 18:04:16 +0000 (19:04 +0100)]
Completely remove the privdata mechanism in dialog.h.

The last use of it, to store the contents of the saved session name
edit box, was removed nearly two years ago in svn r9923 and replaced
by ctrl_alloc_with_free. The mechanism has been unused ever since
then, and I suspect any further uses of it would be a bad idea for the
same reasons, so let's get rid of it.

9 years agoFix two small memory leaks in config mechanism.
Simon Tatham [Fri, 8 May 2015 17:57:18 +0000 (18:57 +0100)]
Fix two small memory leaks in config mechanism.

The memory dangling off ssd->sesslist should be freed when ssd itself
goes away, and the font settings ctrlset we delete in gtkcfg.c should
be freed as well once it's been removed from its containing array.

Thanks to Ranjini Aravind for pointing these out.

9 years agoRemove the list of key algorithms in pageant.c.
Simon Tatham [Thu, 7 May 2015 18:57:46 +0000 (19:57 +0100)]
Remove the list of key algorithms in pageant.c.

The only reason those couldn't be replaced with a call to the
centralised find_pubkey_alg is because that function takes a zero-
terminated string and instead we had a (length,pointer) string. Easily
fixed; there's now a find_pubkey_alg_len(), and we call that.

This also fixes a string-matching bug in which the sense of memcmp was
reversed by mistake for ECDSA keys!

9 years agoClean up Unix Pageant's setup and teardown.
Simon Tatham [Thu, 7 May 2015 18:04:25 +0000 (19:04 +0100)]
Clean up Unix Pageant's setup and teardown.

I've moved the listening socket setup back to before the lifetime
preparations, so in particular we find out that we couldn't bind to
the socket _before_ we fork. The only part that really needed to come
after lifetime setup was the logging setup, so that's now a separate
function called later.

Also, the random exit(0)s in silly places like x11_closing have turned
into setting a time_to_die flag, so that all clean exits funnel back
to the end of main() which at least tries to tidy up a bit afterwards.

(Finally, fixed a small bug in testing the return value of waitpid(),
which only showed up once we didn't exit(0) after the first wait.
Ahem.)

9 years agoFix the inverted return values in pageant_add_ssh*_key().
Simon Tatham [Thu, 7 May 2015 17:41:06 +0000 (18:41 +0100)]
Fix the inverted return values in pageant_add_ssh*_key().

This would have caused intermittent use-after-free crashes in Windows
Pageant, but only with keys added via the primary Pageant's own UI or
command line - not keys submitted from another process, because those
don't go through the same function.

9 years agoFix SSH-1 RSA key handling in Pageant.
Simon Tatham [Wed, 6 May 2015 19:49:07 +0000 (20:49 +0100)]
Fix SSH-1 RSA key handling in Pageant.

The auxiliary values (the two primes and the inverse of one mod the
other) were being read into the key structure wrongly, causing
crt_modpow() in sshrsa.c to give the wrong answers where straight
modpow would not have.

This must have been broken ever since I implemented the RSA CRT
optimisation in 2011. And nobody has noticed, which is a good sign for
the phasing out of SSH-1 :-) I only spotted it myself because I was
testing all the Pageant message types in the course of implementing
the new logging.

9 years agoPut proper logging into Pageant.
Simon Tatham [Wed, 6 May 2015 18:32:26 +0000 (19:32 +0100)]
Put proper logging into Pageant.

Now it actually logs all its requests and responses, the fingerprints
of keys mentioned in all messages, and so on.

I've also added the -v option, which causes Pageant in any mode to
direct that logging information to standard error. In --debug mode,
however, the logging output goes to standard output instead (because
when debugging, that information changes from a side effect to the
thing you actually wanted in the first place :-).

An internal tweak: the logging functions now take a va_list rather
than an actual variadic argument list, so that I can pass it through
several functions.

9 years agoRemove some FIXMEs left in from initial work.
Simon Tatham [Wed, 6 May 2015 17:08:05 +0000 (18:08 +0100)]
Remove some FIXMEs left in from initial work.

LIFE_EXEC is already dealt with, and I forgot to take out the comment
reminding me to do it, ahem.

The LIFE_PARENT mentioned in the same comment was an idea I had but
couldn't think of a way to make it work: if you have a terminal-only
shell session in which you want to eval $(ssh-agent), then it's
annoying and fragile to have to remember to kill the agent when you
log out, so you'd like it to automatically tie its lifetime to that of
the shell from which you invoked it. Unfortunately, I don't know of
any way to do that without race conditions. (E.g. if only pageant
didn't fork, then it could poll its own ppid until it became 1 - but
the child process would find it was 1 already.)

9 years agoProvide a Unix port of Pageant.
Simon Tatham [Tue, 5 May 2015 19:16:23 +0000 (20:16 +0100)]
Provide a Unix port of Pageant.

This is much more like ssh-agent than the Windows version is - it sets
SSH_AUTH_SOCK and SSH_AGENT_PID as its means of being found by other
processes, rather than Windows Pageant's approach of establishing
itself in a well-known location. But the actual agent code is the same
as Windows Pageant.

For the moment, this is an experimental utility and I don't expect it
to be useful to many people; its immediate use to me is that it
provides a way to test and debug the agent code on Unix, and also to
use the agent interface as a convenient way to exercise public key
functions I want to debug. And of course it means I can be constantly
using and testing my own code, on whatever platform I happen to be
using. In the further future, I have a list of possible features I
might add to it, but I don't know which ones I'll decide are
worthwhile.

One feature I've already put in is a wider range of lifetime
management options than ssh-agent: the -X mode causes Pageant to make
a connection to your X display, and automatically terminate when that
connection closes, so that it has the same lifetime as your X session
without having to do the cumbersome trick of exec()ing the subsequent
session-management process.

9 years agoMove make_dir_and_check_ours() out into uxmisc.c.
Simon Tatham [Tue, 5 May 2015 19:16:22 +0000 (20:16 +0100)]
Move make_dir_and_check_ours() out into uxmisc.c.

I'm going to want to use it for a second purpose in a minute.

9 years agoCross-platform support for speaking SSH agent protocol on a Socket.
Simon Tatham [Tue, 5 May 2015 19:16:20 +0000 (20:16 +0100)]
Cross-platform support for speaking SSH agent protocol on a Socket.

The exact nature of the Socket is left up to the front end to decide,
so that we can use a Unix-domain socket on Unix and a Windows named
pipe on Windows. But the logic of how we receive data and what we send
in response is all cross-platform.

9 years agoMove half of Pageant out into a cross-platform source file.
Simon Tatham [Tue, 5 May 2015 19:16:19 +0000 (20:16 +0100)]
Move half of Pageant out into a cross-platform source file.

I'm aiming for windows/winpgnt.c to only contain the parts of Windows
Pageant that are actually to do with handling the Windows API, and for
all the actual agent logic to be cross-platform.

This commit is a start: I've moved every function and internal
variable that was easy to move. But it doesn't get all the way there -
there's still a lot of logic in add_keyfile() and get_keylist*() that
would be good to move out to cross-platform code, but it's harder
because that code is currently quite intertwined with details of
Windows OS interfacing such as printing message boxes and passphrase
prompts and calling back out to agent_query if the Pageant doing that
job isn't the primary one.

9 years agoConst-correctness in x11_setup_display.
Simon Tatham [Tue, 5 May 2015 19:16:18 +0000 (20:16 +0100)]
Const-correctness in x11_setup_display.

The 'display' parameter should have been a const char *. No call sites
affected.

9 years agoConst-correctness in public-key functions.
Simon Tatham [Tue, 5 May 2015 19:16:17 +0000 (20:16 +0100)]
Const-correctness in public-key functions.

Several of the functions in ssh2_signkey, and one or two SSH-1 key
functions too, were still taking assorted non-const buffer parameters
that had never been properly constified. Sort them all out.

9 years agoUse find_pubkey_alg in openssh_read_new().
Simon Tatham [Sat, 2 May 2015 14:11:41 +0000 (15:11 +0100)]
Use find_pubkey_alg in openssh_read_new().

This is better than listing all the algorithm names in yet another
place that will then need updating when a new key format is added.
However, that also means I need to find a new place to put the
'npieces' value I was previously setting up differently per key type;
since that's a fundamental property of the key format, I've moved it
to a constant field in the ssh_signkey structure, and filled that
field in for all the existing key types with the values from the
replaced code in openssh_read_new().

9 years agoWrite an exporter for the new OpenSSH format.
Simon Tatham [Tue, 28 Apr 2015 18:51:52 +0000 (19:51 +0100)]
Write an exporter for the new OpenSSH format.

This was a lot less work than the importer, partly because the bcrypt
primitive is already working now, and mostly because we don't have to
handle the possible cross product of ciphers and kdfs in full and
completely hypothetical generality - we can emit a fixed choice of
either nothing or our chosen pair.

9 years agoCompletely separate old and new OpenSSH key handling code.
Simon Tatham [Tue, 28 Apr 2015 18:49:55 +0000 (19:49 +0100)]
Completely separate old and new OpenSSH key handling code.

I thought it would be a good idea to share the loading code on the
basis that the outer header line + base64 format isn't too different,
but in fact I ended up faffing endlessly with mode bits and unions and
constantly re-testing in every subfunction which kind of key it was,
so that small saving wasn't worth it.

9 years agoSeparate key-type enum values for old and new OpenSSH keys.
Simon Tatham [Tue, 28 Apr 2015 18:46:58 +0000 (19:46 +0100)]
Separate key-type enum values for old and new OpenSSH keys.

It's all very well for these two different formats to share a type
code as long as we're only loading them and not saving, but as soon as
we need to save one or the other, we'll need different type codes
after all.

This commit introduces the openssh_new_write() function, but for the
moment, it always returns failure.

9 years agoFix enum-conflation in cmdgen.c.
Simon Tatham [Tue, 28 Apr 2015 18:46:08 +0000 (19:46 +0100)]
Fix enum-conflation in cmdgen.c.

I'd somehow managed to declare an enum in cmdgen.c with key types
OPENSSH and SSHCOM, and use it interchangeably with the one in ssh.h
with SSH_KEYTYPE_OPENSSH and SSH_KEYTYPE_SSHCOM.

It so happened that the relevant two enum values matched up! So this
hasn't caused a bug yet, but it's an accident waiting to happen. Fix
it before it does.

9 years agoTeach PuTTYgen to import from OpenSSH's new key format.
Simon Tatham [Mon, 27 Apr 2015 19:48:29 +0000 (20:48 +0100)]
Teach PuTTYgen to import from OpenSSH's new key format.

This is import only, for the moment: I haven't written an exporter
yet. Also, we currently don't support the format's full generality - a
new-style OpenSSH key file can contain multiple keys, but this code
currently only handles files with one key in them. That should be easy
to change, though, given only a little UI.

9 years agoSome miscellaneous marshalling helpers.
Simon Tatham [Mon, 27 Apr 2015 19:48:29 +0000 (20:48 +0100)]
Some miscellaneous marshalling helpers.

I'm about to use these in a new piece of code, but they may come in
helpful elsewhere as well. match_ssh_id in particular wraps an idiom
that's quite common in the rest of the codebase.

9 years agoProvide a script to regenerate the Blowfish init tables.
Simon Tatham [Mon, 27 Apr 2015 19:48:29 +0000 (20:48 +0100)]
Provide a script to regenerate the Blowfish init tables.

Since I've recently published a program that can easily generate the
required digits of pi, and since I was messing around in sshblowf.c
already, it seemed like a good idea to provide a derivation of all
that hex data.

9 years agoImplementation of OpenSSH's bcrypt.
Simon Tatham [Mon, 27 Apr 2015 19:48:29 +0000 (20:48 +0100)]
Implementation of OpenSSH's bcrypt.

This isn't the same as the standard bcrypt; it's OpenSSH's
modification that they use for their new-style key format.

In order to implement this, I've broken up blowfish_setkey() into two
subfunctions, and provided one of them with an extra optional salt
parameter, which is NULL in ordinary Blowfish but used by bcrypt.
Also, I've exposed some of sshblowf.c's internal machinery for the new
sshbcrypt.c to use.

9 years agoPaste error in comment.
Simon Tatham [Mon, 27 Apr 2015 05:54:21 +0000 (06:54 +0100)]
Paste error in comment.

SSH2_MSG_KEX_DH_GEX_REQUEST_OLD and SSH2_MSG_KEX_DH_GEX_REQUEST were
correctly _defined_ as different numbers, but the comments to the
right containing the hex representations of their values were
accidentally the same.

9 years agoAdd smemclrs of all hash states we destroy.
Simon Tatham [Sun, 26 Apr 2015 22:55:33 +0000 (23:55 +0100)]
Add smemclrs of all hash states we destroy.

9 years agoUse a timing-safe memory compare to verify MACs.
Simon Tatham [Sun, 26 Apr 2015 22:31:11 +0000 (23:31 +0100)]
Use a timing-safe memory compare to verify MACs.

Now that we have modes in which the MAC verification happens before
any other crypto operation and hence will be the only thing seen by an
attacker, it seems like about time we got round to doing it in a
cautious way that tries to prevent the attacker from using our memcmp
as a timing oracle.

So, here's an smemeq() function which has the semantics of !memcmp but
attempts to run in time dependent only on the length parameter. All
the MAC implementations now use this in place of !memcmp to verify the
MAC on input data.

9 years agoSupport OpenSSH encrypt-then-MAC protocol extension.
Simon Tatham [Sun, 26 Apr 2015 22:30:32 +0000 (23:30 +0100)]
Support OpenSSH encrypt-then-MAC protocol extension.

This causes the initial length field of the SSH-2 binary packet to be
unencrypted (with the knock-on effect that now the packet length not
including MAC must be congruent to 4 rather than 0 mod the cipher
block size), and then the MAC is applied over the unencrypted length
field and encrypted ciphertext (prefixed by the sequence number as
usual). At the cost of exposing some information about the packet
lengths to an attacker (but rarely anything they couldn't have
inferred from the TCP headers anyway), this closes down any
possibility of a MITM using the client as a decryption oracle, unless
they can _first_ fake a correct MAC.

ETM mode is enabled by means of selecting a different MAC identifier,
all the current ones of which are constructed by appending
"-etm@openssh.com" to the name of a MAC that already existed.

We currently prefer the original SSH-2 binary packet protocol (i.e. we
list all the ETM-mode MACs last in our KEXINIT), on the grounds that
it's better tested and more analysed, so at the moment the new mode is
only activated if a server refuses to speak anything else.

9 years agoFix a few memory leaks.
Simon Tatham [Sun, 26 Apr 2015 09:49:24 +0000 (10:49 +0100)]
Fix a few memory leaks.

Patch due to Chris Staite.

9 years agoDivide the Bugs panel in half.
Simon Tatham [Sat, 25 Apr 2015 09:46:56 +0000 (10:46 +0100)]
Divide the Bugs panel in half.

It overflowed as a result of the previous commit.

9 years agoSupport RFC 4419.
Simon Tatham [Sat, 25 Apr 2015 09:46:53 +0000 (10:46 +0100)]
Support RFC 4419.

PuTTY now uses the updated version of Diffie-Hellman group exchange,
except for a few old OpenSSH versions which Darren Tucker reports only
support the old version.

FIXME: this needs further work because the Bugs config panel has now
overflowed.

9 years agoOld Dropbear servers have the ssh-close-vs-request bug.
Jacob Nevins [Thu, 23 Apr 2015 22:42:45 +0000 (23:42 +0100)]
Old Dropbear servers have the ssh-close-vs-request bug.

Add automatic bug detection. (Versions verified by Matt Johnston.)

9 years agoFix a dangerous cross-thread memory access.
Simon Tatham [Tue, 7 Apr 2015 21:17:08 +0000 (22:17 +0100)]
Fix a dangerous cross-thread memory access.

When a winhandl.c input thread returns EOF to the main thread, the
latter might immediately delete the input thread's context. I
carefully wrote in a comment that in that case we had to not touch ctx
ever again after signalling to the main thread - but the test for
whether that was true, which also touched ctx, itself came _after_ the
SetEvent which sent that signal. Ahem.

Spotted by Minefield, which it looks as if I haven't run for a while.

9 years agoClean up a stale foreign handle in winnps.c.
Simon Tatham [Tue, 7 Apr 2015 20:54:41 +0000 (21:54 +0100)]
Clean up a stale foreign handle in winnps.c.

I had set up an event object for signalling incoming connections to
the named pipe, and then called handle_add_foreign_event to get that
event object watched for connections - but when I closed down the
listening pipe, I deleted the event object without also cancelling
that foreign-event handle, so that winhandl.c would potentially call
the callback for a destroyed object.

9 years agoDon't output negative numbers in the ESC[13t report.
Simon Tatham [Sat, 7 Mar 2015 20:57:26 +0000 (20:57 +0000)]
Don't output negative numbers in the ESC[13t report.

A minus sign is illegal at that position in a control sequence, so if
ESC[13t should report something like ESC[3;-123;234t then we won't
accept it as input. Switch to printing the numbers as unsigned, so
that negative window coordinates are output as their 32-bit two's
complement; experimentation suggests that PuTTY does accept that on
input.

9 years agoStop Windows PuTTY becoming unresponsive if server floods us.
Simon Tatham [Sat, 7 Mar 2015 17:10:36 +0000 (17:10 +0000)]
Stop Windows PuTTY becoming unresponsive if server floods us.

This was an old bug, fixed around 0.59, which apparently regressed
when I rewrote the main event loop using the toplevel_callback
mechanism.

Investigation just now suggests that it has to do with my faulty
assumption that Windows PeekMessage would deliver messages in its
message queue in FIFO order (i.e. that the thing calling itself a
message queue is actually a _queue_). In fact my WM_NETEVENT seems to
like to jump the queue, so that once a steady stream of them starts
arriving, we never do anything else in the main event loop (except
deal with handles).

Worked around in a simple and slightly bodgy way, namely, we don't
stop looping on PeekMessage and run our toplevel callbacks until we've
either run out of messages completely or else seen at least one that
_isn't_ a WM_NETEVENT. That way we should reliably interleave NETEVENT
processing with processing of other stuff.

9 years agoMove kh2reg.py link from svn to git.
Jacob Nevins [Sun, 1 Mar 2015 12:27:27 +0000 (12:27 +0000)]
Move kh2reg.py link from svn to git.

9 years agoMinimal documentation for ECDSA/ECDH support.
Jacob Nevins [Sat, 28 Feb 2015 19:08:15 +0000 (19:08 +0000)]
Minimal documentation for ECDSA/ECDH support.

9 years agoAdd a new checklist item.
Simon Tatham [Sat, 28 Feb 2015 15:47:45 +0000 (15:47 +0000)]
Add a new checklist item.

I managed to build from completely the wrong commit this morning, so
make sure to double-check next time!

9 years agoTypo.
Simon Tatham [Sat, 28 Feb 2015 13:10:55 +0000 (13:10 +0000)]
Typo.

9 years agoReorganise the release checklist.
Simon Tatham [Sat, 28 Feb 2015 12:04:54 +0000 (12:04 +0000)]
Reorganise the release checklist.

Mostly I'm rearranging things because of the new workflows that git
makes available - it's now possible (and indeed sensible) to prepare a
lot of stuff in a fairly relaxed manner in local checkouts, and then
the process of going live with the release has a lot less manual
writing of stuff and a lot more mechanical 'git push' and running of
update scripts.

However, there's one new item that was actually missed off the
previous checklist: turning off nightly pre-release builds after
making the release they were a pre-release of. Ahem.

9 years agoNew 'contrib' tool: a script for faking initial KEX.
Simon Tatham [Sat, 28 Feb 2015 07:58:29 +0000 (07:58 +0000)]
New 'contrib' tool: a script for faking initial KEX.

encodelib.py is a Python library which implements some handy SSH-2
encoding primitives; samplekex.py uses that to fabricate the start of
an SSH connection, up to the point where key exchange totally fails
its crypto.

The idea is that you adapt samplekex.py to construct initial-kex
sequences with particular properties, in order to test robustness and
security fixes that affect the initial-kex sequence. For example, I
used an adaptation of this to test the Diffie-Hellman range check
that's just gone into 0.64.

9 years agoMerge branch 'pre-0.64'
Simon Tatham [Sat, 28 Feb 2015 07:57:58 +0000 (07:57 +0000)]
Merge branch 'pre-0.64'

9 years agoBump version number for 0.64 release. 0.64
Simon Tatham [Fri, 27 Feb 2015 22:42:03 +0000 (22:42 +0000)]
Bump version number for 0.64 release.

9 years agoAdd some missing smemclrs and sfrees.
Simon Tatham [Thu, 19 Feb 2015 20:08:18 +0000 (20:08 +0000)]
Add some missing smemclrs and sfrees.

The absence of these could have prevented sensitive private key
information from being properly cleared out of memory that PuTTY tools
had finished with.

Thanks to Patrick Coleman for spotting this and sending a patch.