]> asedeno.scripts.mit.edu Git - PuTTY.git/log
PuTTY.git
8 years agoImplement "curve448-sha512" kex, from draft-ietf-curdle-ssh-curves-00. experimental-curve448
Simon Tatham [Tue, 3 May 2016 14:26:36 +0000 (15:26 +0100)]
Implement "curve448-sha512" kex, from draft-ietf-curdle-ssh-curves-00.

I've demonstrated by diagnostic printfs that this passes the single
Curve448 test vector given in section 6.2 of RFC 7748, but it is
otherwise NOT INTEROPERABILITY-TESTED AT ALL.

Also, its protocol identifier is not domain-suffixed despite not being
in a published RFC (yet). So this implementation is strictly
preliminary, and intended only for other SSH implementors to
interop-test against.

8 years agoSwap endianness of the Curve25519 ECDH private key.
Simon Tatham [Tue, 3 May 2016 13:44:00 +0000 (14:44 +0100)]
Swap endianness of the Curve25519 ECDH private key.

DJB's spec at http://cr.yp.to/ecdh/curve25519-20060209.pdf is clear
that we should be clearing the low 3 bits of the _LSB_ of the private
key bit string, and setting bit 6 and clearing bit 7 of the _MSB_. We
were doing the opposite, due to feeding the resulting bit string to
bignum_from_bytes() rather than bignum_from_bytes_le().

This didn't cause an interoperability issue, because the two DH
exponentiations still commute, but it goes against the Curve25519
spec, in particular the care taken to fix the position of the leading
exponent bit.

The code is now consistent with the test vectors in RFC 7748 section
6.1: if you modify the EC_MONTGOMERY branch of ssh_ecdhkex_newkey() to
replace the loop on random_byte() with a memcpy that fills bytes[]
with 77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a
and then print out the resulting publicKey->x, you find that it's
(byte-reversed) the expected output value given in that RFC section,
8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a.

8 years agoSend the IUTF8 terminal mode in SSH "pty-req"s.
Simon Tatham [Tue, 3 May 2016 07:43:50 +0000 (08:43 +0100)]
Send the IUTF8 terminal mode in SSH "pty-req"s.

An opcode for this was recently published in
https://tools.ietf.org/html/draft-sgtatham-secsh-iutf8-00 .

The default setting is conditional on frontend_is_utf8(), which is
consistent with the pty back end's policy for setting the same flag
locally. Of course, users can override the setting either way in the
GUI configurer, the same as all other tty modes.

8 years agoSupport frontend_is_utf8() in all front ends.
Simon Tatham [Tue, 3 May 2016 07:43:09 +0000 (08:43 +0100)]
Support frontend_is_utf8() in all front ends.

Previously only Unix front ends bothered to include it, on the basis
that only the pty backend needed it (to set IUTF8 in the pty). We're
about to need it everywhere else too.

8 years agoLoop over all _supported_, not just configured, SSH tty modes.
Simon Tatham [Mon, 2 May 2016 12:51:28 +0000 (13:51 +0100)]
Loop over all _supported_, not just configured, SSH tty modes.

Previously, the code that marshalled tty settings into the "pty-req"
request was iterating through the subkeys stored in ssh->conf, meaning
that if a session had been saved before we gained support for a
particular tty mode, the iteration wouldn't visit that mode at all and
hence wouldn't send even the default setting for it.

Now we iterate over the array of known mode identifiers in
ssh_ttymodes[] and look each one up in ssh->conf, rather than vice
versa. This means that when we add support for a new tty mode with a
nontrivial policy for choosing its default state, we should start
using the default handler immediately, rather than bizarrely waiting
for users to save a session after the change.

8 years agossh_pkt_defersend: don't call do_ssh2_transport when using SSH-1.
Ben Harris [Sun, 1 May 2016 17:16:22 +0000 (19:16 +0200)]
ssh_pkt_defersend: don't call do_ssh2_transport when using SSH-1.

Also add an assertion to do_ssh2_transport to catch this.

This bug would be highly unlikely to manifest accidentally, but I
think you could trigger it by setting the data-based rekey threshold
very low.

8 years agoMay as well set FD_CLOEXEC on the signal pipe as well.
Ben Harris [Sun, 1 May 2016 15:55:07 +0000 (17:55 +0200)]
May as well set FD_CLOEXEC on the signal pipe as well.

8 years agoUnix Plink: Set O_NONBLOCK on the SIGWINCH pipe.
Ben Harris [Sun, 1 May 2016 15:46:40 +0000 (17:46 +0200)]
Unix Plink: Set O_NONBLOCK on the SIGWINCH pipe.

This should avoid the possibility of the SIGWINCH handler's blocking
when trying to write to the pipe.  This could only happen if we'd
somehow received PIPE_BUF SIGWINCHes without reading the pipe, which
would be difficult to achieve.

While we're at it, also set O_NONBLOCK on the reading side of the pipe,
just in case.

8 years agouxcons: Don't try to include <sys/select.h> on systems that don't have it.
Ben Harris [Sun, 1 May 2016 16:11:50 +0000 (18:11 +0200)]
uxcons: Don't try to include <sys/select.h> on systems that don't have it.

Also include <sys/time.h> for ancient systems that define select()
there.

8 years agouxcons: Fix on musl libc
Kylie McClain [Fri, 29 Apr 2016 02:40:32 +0000 (22:40 -0400)]
uxcons: Fix on musl libc

musl libc exports FD_SET and friends in sys/select.h.

8 years agoShared ssh_send_channel_data for both SSH-1 and SSH-2.
Ben Harris [Sat, 23 Apr 2016 14:51:45 +0000 (15:51 +0100)]
Shared ssh_send_channel_data for both SSH-1 and SSH-2.

Saves duplication between agent and port forwarding code.

Conflicts:
ssh.c

8 years agoCall ssh2_try_send() from ssh2_add_channel_data() and rename latter
Ben Harris [Sat, 23 Apr 2016 12:17:33 +0000 (13:17 +0100)]
Call ssh2_try_send() from ssh2_add_channel_data() and rename latter

All calls to ssh2_add_channel_data() were followed by a call to
ssh2_try_send(), so it seems sensible to replace ssh2_add_channel_data()
with ssh2_send_channel_data(), which does both.

8 years agoSimplifiy handling of stdin data in SSH-2.
Ben Harris [Sat, 23 Apr 2016 12:10:11 +0000 (13:10 +0100)]
Simplifiy handling of stdin data in SSH-2.

Specifically, don't try to unblock all channels just because we've got
something to send on the main one.  It looks like the code to do that
was left over from when SSH_MSG_CHANNEL_ADJUST was handled in
do_ssh2_authconn().

8 years agoPut handling of incoming data on agent channels into its own function.
Ben Harris [Fri, 22 Apr 2016 22:00:46 +0000 (23:00 +0100)]
Put handling of incoming data on agent channels into its own function.

This function can be shared between SSH-1 and SSH-2, and makes the
per-protocol data-handling functions more generic.

8 years agoSet cfg.ssh_simple in Windows Plink when there are no forwardings.
Ben Harris [Fri, 15 Apr 2016 21:58:26 +0000 (22:58 +0100)]
Set cfg.ssh_simple in Windows Plink when there are no forwardings.

Unix Plink had had this for ages, but for some reason I didn't add it to
Windows Plink at the same time.

8 years agoPut DH group1-sha1 KEX below 'warn' by default.
Jacob Nevins [Sun, 27 Mar 2016 16:24:44 +0000 (17:24 +0100)]
Put DH group1-sha1 KEX below 'warn' by default.

Also try to upgrade the settings of people who haven't changed the
defaults; but anyone who has, or anyone who's used the pre-release
snapshots with elliptic-curve support, will have to review their
settings manually.

8 years agoFix plurality in unknown host keys log message.
Jacob Nevins [Sun, 10 Apr 2016 14:57:00 +0000 (15:57 +0100)]
Fix plurality in unknown host keys log message.

8 years agoCorrect description of NO_SECURITY.
Jacob Nevins [Sun, 10 Apr 2016 13:37:43 +0000 (14:37 +0100)]
Correct description of NO_SECURITY.

8 years agoEnable various features in MinGW builds.
Jacob Nevins [Sun, 10 Apr 2016 13:40:39 +0000 (14:40 +0100)]
Enable various features in MinGW builds.

I've reset the baseline to be the version of mingw-w64 that comes with
Ubuntu 14.04. Right now, that means no features need to be omitted; all
you need to do is set TOOLPATH to i686-w64-mingw32- .

I've removed -mno-cygwin without comment. Toolchains which don't support
this flag have been around since at least 2012, so we can probably
assume that no-one cares about older toolchains by now.

8 years agoRename Makefile.cyg to Makefile.mgw.
Jacob Nevins [Sun, 10 Apr 2016 13:26:54 +0000 (14:26 +0100)]
Rename Makefile.cyg to Makefile.mgw.

It's really only useful with MinGW rather than a Cygwin toolchain these
days, as recent versions of the latter insist against linking with the
Cygwin DLL.

(I think it may no longer be possible to build with Cygwin out of the
box at all these days, but I'm not going to say so without having
actually checked that's the case. Settle for listing MinGW first in
various comments and docs.)

8 years agowinsftp.c needs winsecur.h for process protection.
Jacob Nevins [Sun, 10 Apr 2016 14:08:57 +0000 (15:08 +0100)]
winsftp.c needs winsecur.h for process protection.

8 years agoFix format strings for Windows serial parameters.
Jacob Nevins [Sun, 10 Apr 2016 13:25:34 +0000 (14:25 +0100)]
Fix format strings for Windows serial parameters.

8 years agoSpecify integer type for access rights.
Jacob Nevins [Sun, 10 Apr 2016 13:24:39 +0000 (14:24 +0100)]
Specify integer type for access rights.

Fixes a warning from MinGW GCC.

8 years agoFixed unused-variable warnings from MinGW gcc.
Jacob Nevins [Sun, 10 Apr 2016 13:24:04 +0000 (14:24 +0100)]
Fixed unused-variable warnings from MinGW gcc.

8 years agoSwitch to flow-control-based SFTP uploading.
Ben Harris [Fri, 8 Apr 2016 23:24:12 +0000 (00:24 +0100)]
Switch to flow-control-based SFTP uploading.

Formerly PuTTY's SFTP code would transmit (or buffer) a megabyte of data
before even starting to look for acknowledgements, but wouldn't allow
there to be more than a megabyte of unacknowledged data at a time.  Now,
instead, it pays attention to whether the transmit path is blocked, and
transmits iff it isn't.

This should mean that SFTP goes faster over long fat pipes, and also
doesn't end up buffering so much over thin ones.

I practice, I tend to run into other performance limitations (such as
TCP or SSH-2 windows) before this enhancement looks particularly good,
but with an artificial lag of 250 ms on the loopback interface this
patch almost doubles my upload speed, so I think it's worthwhile.

8 years agopscp: pull out upload block size into a constant.
Ben Harris [Fri, 8 Apr 2016 23:01:13 +0000 (00:01 +0100)]
pscp: pull out upload block size into a constant.

8 years agoCorrect a comment: OUR_V2_WINSIZE is now the default, not maximum.
Ben Harris [Fri, 8 Apr 2016 23:46:25 +0000 (00:46 +0100)]
Correct a comment: OUR_V2_WINSIZE is now the default, not maximum.

8 years agoUpdate build script for Inno Setup 5.5.9.
Simon Tatham [Fri, 8 Apr 2016 10:00:08 +0000 (11:00 +0100)]
Update build script for Inno Setup 5.5.9.

I've just upgraded my build environment to the latest Inno Setup
(apparently fixing some DLL hijacking issues), and found that the
build script doesn't run any more because the name of the output file
has changed - it used to produce Output/setup.exe, but now it produces
Output/mysetup.exe.

Rather than just fixing the build script to expect the new name, I've
explicitly specified an output filename of my own choice in putty.iss,
so that the build script should now work with versions before and
after the change.

8 years agoAdd some missing 'const' in version.c's string data.
Simon Tatham [Thu, 7 Apr 2016 06:52:55 +0000 (07:52 +0100)]
Add some missing 'const' in version.c's string data.

I can't believe this codebase is around 20 years old and has had
multiple giant const-fixing patches, and yet there are _still_ things
that should have been const for years and aren't.

8 years agoFix semantics of empty string in mkfiles.pl "!cflags".
Simon Tatham [Thu, 7 Apr 2016 06:52:01 +0000 (07:52 +0100)]
Fix semantics of empty string in mkfiles.pl "!cflags".

Previously, if you tried to set the special cflags for an object file
to the empty string, mkfiles.pl would normalise that to the string
"1". I'm not entirely sure why - that line of code was added without
explanation in commit 64150a5ef which brought in that directive in the
first place - but I have to guess that it was left over from some
earlier design iteration in which I hadn't quite decided whether I was
going to need a string or a boolean to separate version.o from other
objects.

Of course, setting an object's cflags to "" is a bit of a weird thing
to want to do anyway - why not just leave them unset? But in fact I've
now thought of something useful for it to do: this commit arranges
that setting cflags="" has the effect (in the 'am' makefile type) of
separating the object out into its own little automake library but not
actually giving that library any separate cflags. And the point of
_that_, in turn, will be that then you can add cflags to it
_conditionally_ in a "!begin am" snippet, e.g. conditionalised on
something in configure.

8 years agoWindows PuTTYgen: stop saying "Pageant" in the About box!
Simon Tatham [Wed, 6 Apr 2016 13:12:45 +0000 (14:12 +0100)]
Windows PuTTYgen: stop saying "Pageant" in the About box!

Ahem. Cut-and-paste goof that I introduced in commit 2eb952ca3, when I
moved the application names out of separate text controls in the
resource-file dialog descriptions.

8 years agoFix duplicate definition of typedef 'bufchain'.
Simon Tatham [Wed, 6 Apr 2016 08:06:19 +0000 (09:06 +0100)]
Fix duplicate definition of typedef 'bufchain'.

This was defined in misc.h, and also in network.h (because one
function prototype needed to refer to it in the latter), leading to a
build failure if any source file inconveniently included both those
headers.

Fixed by guarding each copy of the typedef with a #ifdef.

8 years agoGTK 3: tweak margin below the gtkask drawing areas.
Simon Tatham [Mon, 4 Apr 2016 10:49:05 +0000 (11:49 +0100)]
GTK 3: tweak margin below the gtkask drawing areas.

A side effect of commit 1f9df706b seems to have been to squash those
areas right up against the bottom of the dialog box, which is ugly. I
don't fully understand why it only happens to those drawing areas and
not to buttons placed in the fake 'action area' by other dialogs, but
anyway, adding an explicit margin-bottom attribute seems to solve it.

8 years agoAccount for GtkApplicationWindow menu bar in geometry hints.
Simon Tatham [Mon, 4 Apr 2016 10:28:34 +0000 (11:28 +0100)]
Account for GtkApplicationWindow menu bar in geometry hints.

This is another widget that can appear in the top-level window, in
addition to the drawing area and scrollbar we put there ourselves, and
hence which needs to be accounted for when figuring out the
relationship between the drawing area size in character cells and the
full window size in pixels.

Finding the menu bar widget itself is a bit of a hassle, but having
found it, dealing with it is basically the same as dealing with the
scrollbar, only with x and y swapped.

8 years agoGTK: stop using gtk_window_parse_geometry.
Simon Tatham [Mon, 4 Apr 2016 10:27:01 +0000 (11:27 +0100)]
GTK: stop using gtk_window_parse_geometry.

This function, which parses the X11-style '-geometry WxH+X+Y' option
argument and automatically loads the result into the window, is also
being deprecated.

Fortunately we already had a fallback option for GTK1 (which didn't
have gtk_window_parse_geometry in the first place), calling the Xlib
geometry-parsing function and manually loading the results into GTK.
The method of loading into GTK is not the same between the two
versions, but the basic strategy is still viable.

For the sake of maintaining and testing fewer ifdef branches, I've
removed the use of gtk_window_parse_geometry _completely_, even in
GTK2 which did have it. GTK2 now uses the same strategy that I've
switched to for GTK3.

8 years agoGTK: stop using geometry-based window sizing functions.
Simon Tatham [Mon, 4 Apr 2016 10:24:24 +0000 (11:24 +0100)]
GTK: stop using geometry-based window sizing functions.

gtk_window_resize_to_geometry and gtk_window_set_default_geometry are
deprecated as of GTK 3.20, so now we do the geometry -> pixel size
conversion on our side.

8 years agoGTK: split out the computation part from set_geom_hints.
Simon Tatham [Mon, 4 Apr 2016 10:23:25 +0000 (11:23 +0100)]
GTK: split out the computation part from set_geom_hints.

This is preparation for dealing with the fact that GTK's geometry-
based API routines for setting the window size are being deprecated:
we'll no longer be able to specify a width/height in characters and
have GTK convert that into a pixel size based on the geometry hints
we'd already fed it. So we'll need to do that conversion ourselves,
and the easiest approach is to make it easy to recompute the geometry
hints on our side whenever we need them.

8 years agoGTK 3.20 compatibility: switch to gdk_seat_grab.
Simon Tatham [Mon, 4 Apr 2016 10:21:54 +0000 (11:21 +0100)]
GTK 3.20 compatibility: switch to gdk_seat_grab.

gdk_device_grab and all its preparatory faff are now deprecated, and
gdk_seat_grab is the new thing. Introduce yet another branch to all
the ifdefs for keyboard-grabbing. On the plus side, at least it's
slightly simpler than the GdkDevice business.

8 years agoReorganise the Bugs and More Bugs config panels.
Simon Tatham [Sun, 3 Apr 2016 17:16:44 +0000 (18:16 +0100)]
Reorganise the Bugs and More Bugs config panels.

Now bugs that are still likely to come up with relatively recent
server software (because they're only a few years fixed, or because
they're the sort of mistake that new server implementors will likely
make again) are in the Bugs panel, and very old things long since
fixed are relegated to More Bugs.

In particular, More Bugs contains everything SSH-1 related.

8 years agoMerge branch 'master' of ssh://tartarus.org/putty
Owen Dunn [Sun, 3 Apr 2016 14:09:59 +0000 (15:09 +0100)]
Merge branch 'master' of ssh://tartarus.org/putty

8 years agoAllow PROCESS_QUERY_INFORMATION access to our process.
Owen Dunn [Sun, 3 Apr 2016 14:06:44 +0000 (15:06 +0100)]
Allow PROCESS_QUERY_INFORMATION access to our process.

Blocking PROCESS_QUERY_INFORMATION access to the process turned out to
stop screen readers like Microsoft Narrator from reading parts of the
PuTTY window like the System Menu.

8 years agoCompile fix for GTK 3.18: avoid gtk_adjustment_changed().
Simon Tatham [Sun, 3 Apr 2016 09:10:40 +0000 (10:10 +0100)]
Compile fix for GTK 3.18: avoid gtk_adjustment_changed().

That function is deprecated as of 3.18, on the basis that GTK doesn't
need telling any more when the adjustment's owning widget needs
updating. So we just need to condition out the call.

8 years ago64-bit cleanness: fix a couple of format strings in winjump.c.
Simon Tatham [Sat, 2 Apr 2016 13:12:12 +0000 (14:12 +0100)]
64-bit cleanness: fix a couple of format strings in winjump.c.

strcspn() returns a size_t, which is not safe to pass as the parameter
in a printf argument list corresponding to a "*" field width specifier
in the format string, because the latter should be int, which may not
be the same size as size_t.

8 years ago64-bit cleanness: fix integer types in winsftp.c.
Simon Tatham [Sat, 2 Apr 2016 13:11:18 +0000 (14:11 +0100)]
64-bit cleanness: fix integer types in winsftp.c.

We were calling Windows file-handling API functions GetFilesize and
SetFilePointer, each of which returns two halves of a large integer by
writing the high half through a pointer, with pointers to the wrong
integer types. Now we're always passing the exact type defined in the
API, and converting after the fact to our own uint64 type, so this
should avoid any risk of wrong-sized pointers.

8 years ago64-bit cleanness: use INT_PTR/UINT_PTR where appropriate.
Simon Tatham [Sat, 2 Apr 2016 13:10:27 +0000 (14:10 +0100)]
64-bit cleanness: use INT_PTR/UINT_PTR where appropriate.

These integer types are correct for the id/handle parameter to
AppendMenu / InsertMenu / DeleteMenu, and also for the return type of
dialog box procedures.

8 years agoWindows: condition setprocessacl() on lack of -DNO_SECURITY.
Simon Tatham [Sat, 2 Apr 2016 12:48:20 +0000 (13:48 +0100)]
Windows: condition setprocessacl() on lack of -DNO_SECURITY.

We also have the special-purpose -DUNPROTECT to disable just the ACL
changes, but if you want to compile without any Windows security API
support at all (e.g. experimentally building against winelib) then
it's easier not to have to specify both defines separately.

8 years agoWindows: compile with /D_CRT_SECURE_NO_WARNINGS.
Simon Tatham [Sat, 2 Apr 2016 08:21:55 +0000 (09:21 +0100)]
Windows: compile with /D_CRT_SECURE_NO_WARNINGS.

With all due respect to Microsoft, a cross-platform program simply
cannot switch to using MS's assorted 'secure' versions of standard C
functions if it wants to continue compiling on platforms other than
Windows. So I might as well squash the warnings, so that any other
more interesting compiler warnings can avoid being swamped in the
mess.

8 years agoStop supporting fallback between SSH versions.
Jacob Nevins [Mon, 28 Mar 2016 19:23:57 +0000 (20:23 +0100)]
Stop supporting fallback between SSH versions.

The UI now only has "1" and "2" options for SSH protocol version, which
behave like the old "1 only" and "2 only" options; old
SSH-N-with-fallback settings are interpreted as SSH-N-only.

This prevents any attempt at a protocol downgrade attack.
Most users should see no difference; those poor souls who still have to
work with SSH-1 equipment now have to explicitly opt in.

8 years agoProvide a separate post-install README for MSI.
Simon Tatham [Sat, 2 Apr 2016 07:22:12 +0000 (08:22 +0100)]
Provide a separate post-install README for MSI.

The old README.txt instructed you to manually update PATH if you
wanted to run pscp from a command prompt. But the MSI installer can do
that automatically, so the wording needs tweaks. And now that we're
actually launching README (at least optionally) from the installer UI,
it's more important to not make it look silly.

8 years agoMSI installer: offer to display the README file after install.
Simon Tatham [Sat, 2 Apr 2016 07:00:25 +0000 (08:00 +0100)]
MSI installer: offer to display the README file after install.

This is a thing that the Inno Setup installer did, and that I didn't
get round to replicating when I rushed out the initial MSI in a hurry.

I've checked that this doesn't prevent unattended installation by
administrators: running 'msiexec /q /i putty-whatever.msi' as
administrator still installs silently after this change, without
popping up the README unexpectedly on anyone's desktop as a side
effect.

(I _think_ - but I'm still a long way from an MSI expert - that that's
because /q turns off the whole UI part of the MSI system, and the
loading of README is actually triggered by the transition away from
the final UI dialog box, which we now never visit in the first place.)

8 years agoMSI installer: turn the desktop icon off by default.
Simon Tatham [Sat, 2 Apr 2016 07:00:17 +0000 (08:00 +0100)]
MSI installer: turn the desktop icon off by default.

I rushed out the MSI in too much of a hurry to sort out this kind of
thing, but now we've got leisure to reconsider, I think it's better
behaviour not to clutter everyone's desktops unless specifically asked
to.

8 years agoWarn about short RSA/DSA keys in PuTTYgen.
Simon Tatham [Sat, 2 Apr 2016 07:00:37 +0000 (08:00 +0100)]
Warn about short RSA/DSA keys in PuTTYgen.

It's only a warning; Windows PuTTYgen puts it up as a message box, and
will still generate the key if you click yes, and Unix PuTTYgen just
prints the warning and gets on with generation anyway. But it might
help encourage people to move away from 1024-bit keys, if they're
still using them.

8 years agoExtend ACL-restriction to all Windows tools.
Simon Tatham [Sat, 2 Apr 2016 07:00:07 +0000 (08:00 +0100)]
Extend ACL-restriction to all Windows tools.

Protecting our processes from outside interference need not be limited
to just PuTTY: there's no reason why the other SSH-speaking tools
shouldn't have the same treatment (PSFTP, PSCP, Plink), and PuTTYgen
and Pageant which handle private key material.

8 years agoFix a potential time-wraparound issue in pinger.c.
Simon Tatham [Fri, 1 Apr 2016 12:27:03 +0000 (13:27 +0100)]
Fix a potential time-wraparound issue in pinger.c.

A compiler warning drew my attention to the fact that 'next' in
pinger_schedule() was an int, not the unsigned long it should have
been. And looking at the code that handles it, it was also taking no
care with integer wraparound when checking whether an existing
scheduled ping should be moved forward.

So now I do something a bit more robust, by remembering what time it
_was_ when we set pinger->next, and checking if the new time value
falls in the interval between those two times.

8 years agoAdd a missing #include.
Simon Tatham [Fri, 1 Apr 2016 12:14:38 +0000 (13:14 +0100)]
Add a missing #include.

winshare.c uses make_private_security_descriptor(), but wasn't
including winsecur.h where it's declared.

8 years agocmdgen: refuse to generate RSA/DSA keys under 256 bits.
Simon Tatham [Wed, 30 Mar 2016 10:41:11 +0000 (11:41 +0100)]
cmdgen: refuse to generate RSA/DSA keys under 256 bits.

This replicates the existing error message in Windows PuTTYgen, on the
basis that keys smaller than that will actually fail to work with our
signing code.

8 years agoCleanup: rename Windows PuTTYgen's key generation function.
Simon Tatham [Wed, 30 Mar 2016 10:28:59 +0000 (11:28 +0100)]
Cleanup: rename Windows PuTTYgen's key generation function.

It's been a generation function for keys in general for yonks, not
just RSA keys specifically.

8 years agoAdd a file of extra bignum tests.
Simon Tatham [Wed, 30 Mar 2016 07:45:21 +0000 (08:45 +0100)]
Add a file of extra bignum tests.

I generated these as a by-product of using afl-fuzz on the testbn
executable. I'd hoped it would find interesting bugs in the bignum
code itself, but in fact it mostly found bugs in the parsing code in
the test main(). However, even so, it did produce a list of tests
which reach as much of the code as afl-fuzz was able to, and that
seems like a useful thing to save.

Also, of course, just having a place to put explicitly specified
bignum tests is a good thing anyway, because then we can put
regression tests on the end of it every time we fix bugs.

8 years agocmdgen: rescue test suite from bit rot.
Simon Tatham [Wed, 30 Mar 2016 07:25:25 +0000 (08:25 +0100)]
cmdgen: rescue test suite from bit rot.

cmdgen.c has contained code for ages to build a test main() if you
compile with -DTEST_CMDGEN. But it's painful to do so manually, since
you've still got to link in all the same supporting objects, and also
nobody can have actually done that for a while because the stub test
code hasn't been kept up to date with changes in the internal APIs
(specifically prompt_t).

Now we have the ability to include our test programs in Recipe as [UT]
or [XT] so as to leave them out of 'make install', that seems like a
useful thing to do with cmdgen's test suite. So here's a Recipe change
that builds it as 'cgtest', plus fixes for compiler warnings and bit
rot. Pleasantly, the test suite still _passes_ after those are fixed.

8 years agocmdgen: option to specify the random number device to use.
Simon Tatham [Wed, 30 Mar 2016 07:17:03 +0000 (08:17 +0100)]
cmdgen: option to specify the random number device to use.

E.g. you might pass '--random-device=/dev/urandom'.

Mostly because I got sick of waiting for /dev/random to finish
blocking while I was trying to generate throwaway keys for testing bug
fixes in cmdgen itself. But it might also be useful on systems that
call their random device by a different name that we haven't
encountered.

(Since cmdgen also reads the saved PuTTY random seed file, setting
this option to /dev/zero will not render key generation deterministic.
It's tempting to provide _some_ way to do that, for testing purposes
and clearly marked as dangerous of course, but I think it would take
more faff than this.)

8 years agoRework window geometry to avoid using geometry_widget.
Simon Tatham [Tue, 29 Mar 2016 12:42:54 +0000 (13:42 +0100)]
Rework window geometry to avoid using geometry_widget.

Partly this is because the geometry_widget functionality is going away
in a later version of GTK3, so sooner or later we'll need not to be
using it anyway. But also, it turns out that GTK 3's geometry
calculations have the unfortunate effect of setting the window's base
and min heights to values that are not congruent mod height_increment
(because the former is the value we gave, but the latter is based on
the minimum height of the scrollbar), which confuses at least one
window manager (xfwm4) and causes the window to be created one row too
small.

So I've redone all the geometry computations my own way, based on the
knowledge that the only widgets visible in the top-level window are
the drawing area and the scrollbar and I know how both of those
behave, and taking care to keep base_height and min_height congruent
to avoid that xfwm4 bug.

8 years agoMore modern examples of ports we don't have.
Jacob Nevins [Mon, 28 Mar 2016 18:16:14 +0000 (19:16 +0100)]
More modern examples of ports we don't have.

8 years agoRemove call for help with a Windows 3 port.
Jacob Nevins [Mon, 28 Mar 2016 18:15:14 +0000 (19:15 +0100)]
Remove call for help with a Windows 3 port.

I think that in fact we would not welcome this at this point in time.

8 years agoWe will soon have Pageant for Unix.
Jacob Nevins [Mon, 28 Mar 2016 18:16:34 +0000 (19:16 +0100)]
We will soon have Pageant for Unix.

8 years agoTweaks re Mac elsewhere in FAQ after bb6dd98.
Jacob Nevins [Mon, 28 Mar 2016 18:09:11 +0000 (19:09 +0100)]
Tweaks re Mac elsewhere in FAQ after bb6dd98.

8 years agoTweak Unix bits of FAQ after 776a31b.
Jacob Nevins [Mon, 28 Mar 2016 18:13:50 +0000 (19:13 +0100)]
Tweak Unix bits of FAQ after 776a31b.

8 years agoFix punctuation.
Jacob Nevins [Mon, 28 Mar 2016 16:24:23 +0000 (17:24 +0100)]
Fix punctuation.

8 years agoRemove the warning about Unix PuTTY being Linux-specific.
Simon Tatham [Sun, 27 Mar 2016 19:25:59 +0000 (20:25 +0100)]
Remove the warning about Unix PuTTY being Linux-specific.

Since I've been building it on OS X recently, I think it's fair to say
it can now cope with reasonable variation in pty APIs and the like.

8 years agoUpdate Visual Studio versions in README.
Simon Tatham [Sun, 27 Mar 2016 19:25:09 +0000 (20:25 +0100)]
Update Visual Studio versions in README.

VC6 is hopefully long gone, and I've recently been testing on more
up-to-date versions.

8 years agoMention the Secure Contact Key on the Feedback page.
Simon Tatham [Sun, 27 Mar 2016 19:18:21 +0000 (20:18 +0100)]
Mention the Secure Contact Key on the Feedback page.

Both in a new section about reporting vulnerabilities, and in the
section about large attachments (since some large attachments will
surely contain confidential information from the sender).

8 years agoUpdate docs and FAQ for current DSA policy.
Simon Tatham [Sun, 27 Mar 2016 19:10:56 +0000 (20:10 +0100)]
Update docs and FAQ for current DSA policy.

I think the deterministic DSA system we've been using for ages can now
be considered proven in use, not to mention the fact that RFC 6979 and
the Ed25519 spec both give variants on the same idea. So I've removed
the 'don't use DSA if you can avoid it' warning.

8 years agoDecide on a position for ChaCha20-Poly1305.
Simon Tatham [Sun, 27 Mar 2016 19:07:53 +0000 (20:07 +0100)]
Decide on a position for ChaCha20-Poly1305.

Previously, due to confusion, it was placed either at the end of the
list or at the start, depending on whether the user had any saved
configuration at all. Now we get to choose a sensible place for it in
the list, and for the moment I think second place behind AES is
reasonable.

8 years agoFix relative positioning between two new elements in gprefs().
Simon Tatham [Sun, 27 Mar 2016 19:06:33 +0000 (20:06 +0100)]
Fix relative positioning between two new elements in gprefs().

It was only prepared to position a new element relative to an existing
one if the latter was specified in the saved configuration, not if the
latter was another element new to this run of gprefs(). This wasn't
deliberate at all: it was just due to me failing to update the 'seen'
bitmap in the loop adding new elements.

8 years agoSpecial host key warning when a better key exists.
Simon Tatham [Sun, 27 Mar 2016 17:08:49 +0000 (18:08 +0100)]
Special host key warning when a better key exists.

If you're connecting to a new server and it _only_ provides host key
types you've configured to be below the warning threshold, it's OK to
give the standard askalg() message. But if you've newly demoted a host
key type and now reconnect to some server for which that type was the
best key you had cached, the askalg() wording isn't really appropriate
(it's not that the key we've settled on is the first type _supported
by the server_, it's that it's the first type _cached by us_), and
also it's potentially helpful to list the better algorithms so that
the user can pick one to cross-certify.

8 years agoFix assertion failure in host keys log message.
Simon Tatham [Sun, 27 Mar 2016 13:59:18 +0000 (14:59 +0100)]
Fix assertion failure in host keys log message.

When Jacob introduced this message in d0d3c47a0, he was right to
assume that hostkey_algs[] and ssh->uncert_hostkeys[] were sorted in
the same order. Unfortunately, he became wrong less than an hour later
when I committed d06098622. Now we avoid making any such assumption.

8 years agoOmit the conf_launchable check in pterm Duplicate Session.
Simon Tatham [Sun, 27 Mar 2016 13:10:06 +0000 (14:10 +0100)]
Omit the conf_launchable check in pterm Duplicate Session.

It won't return true, because pterm's use of conf is a bit nonstandard
(it doesn't really bother about the protocol field, and has no use for
either host names _or_ serial port filenames). Was affecting both
gtkapp and gtkmain based builds.

8 years agoExamples in man pages for '-fn' option.
Jacob Nevins [Sun, 27 Mar 2016 10:33:21 +0000 (11:33 +0100)]
Examples in man pages for '-fn' option.

I was confused by '-fn Monospace' not working (it needs a font size).

8 years agoMissed a host key doc cross-reference.
Jacob Nevins [Sun, 27 Mar 2016 09:57:25 +0000 (10:57 +0100)]
Missed a host key doc cross-reference.

Also, fix a mangled sentence.

8 years agoFix log message about alternate host keys.
Jacob Nevins [Sat, 26 Mar 2016 18:40:16 +0000 (18:40 +0000)]
Fix log message about alternate host keys.

Since we got a dynamic preference order, it's been bailing out at a
random point, and listing keys we wouldn't use.
(It would still be nice to only mention keys that we'd actually use, but
that's now quite fiddly.)

8 years agoCross-reference all the host key docs.
Jacob Nevins [Sat, 26 Mar 2016 17:38:49 +0000 (17:38 +0000)]
Cross-reference all the host key docs.

And tweak some of the words a bit.

8 years agoSupport sh/csh syntax switching for Unix Pageant.
Simon Tatham [Fri, 25 Mar 2016 16:43:59 +0000 (16:43 +0000)]
Support sh/csh syntax switching for Unix Pageant.

8 years agoAdd some missing 'const' in ssh.c arrays.
Simon Tatham [Fri, 25 Mar 2016 16:22:57 +0000 (16:22 +0000)]
Add some missing 'const' in ssh.c arrays.

I noticed this in passing while tinkering with the hostkey_algs array:
these arrays are full of pointers-to-const, but are not also
themselves declared const, which they should have been all along.

8 years agoConfigurable preference list for SSH host key types.
Simon Tatham [Fri, 25 Mar 2016 15:56:31 +0000 (15:56 +0000)]
Configurable preference list for SSH host key types.

Now we actually have enough of them to worry about, and especially
since some of the types we support are approved by organisations that
people might make their own decisions about whether to trust, it seems
worth having a config list for host keys the same way we have one for
kex types and ciphers.

To make room for this, I've created an SSH > Host Keys config panel,
and moved the existing host-key related configuration (manually
specified fingerprints) into there from the Kex panel.

8 years agoDocument host key cross-certification.
Jacob Nevins [Fri, 25 Mar 2016 15:42:42 +0000 (15:42 +0000)]
Document host key cross-certification.

8 years agoLog when we avoid using an unknown host key.
Jacob Nevins [Fri, 25 Mar 2016 15:37:16 +0000 (15:37 +0000)]
Log when we avoid using an unknown host key.

Intended as a hint that users may want to use the "Cache new host key type"
special command.

8 years agoLogical host name: minor rewording.
Jacob Nevins [Fri, 25 Mar 2016 10:40:03 +0000 (10:40 +0000)]
Logical host name: minor rewording.

8 years agoDemote SSH bypass-auth option; downplay in docs.
Jacob Nevins [Fri, 25 Mar 2016 13:10:00 +0000 (13:10 +0000)]
Demote SSH bypass-auth option; downplay in docs.

It's too esoteric to be the first thing on the Auth panel; I've never
heard of any SSH server that supports it in the decade since I
implemented it. The only Google hits are lost souls mistakenly believing
they need it for passwordless public-key login and the like.

8 years agoEmphasise that agent forwarding exposes all keys.
Jacob Nevins [Fri, 25 Mar 2016 00:18:18 +0000 (00:18 +0000)]
Emphasise that agent forwarding exposes all keys.

(A bit.)

8 years agoDocs: character sets are awful.
Jacob Nevins [Fri, 25 Mar 2016 00:13:06 +0000 (00:13 +0000)]
Docs: character sets are awful.

8 years agoCross-reference Event Log and logfile docs.
Jacob Nevins [Fri, 25 Mar 2016 00:11:13 +0000 (00:11 +0000)]
Cross-reference Event Log and logfile docs.

8 years agoSupport Ed25519 in kh2reg.py.
Simon Tatham [Fri, 25 Mar 2016 09:55:46 +0000 (09:55 +0000)]
Support Ed25519 in kh2reg.py.

8 years agoMake Makefile.gtk default to GTK 3.
Simon Tatham [Fri, 25 Mar 2016 09:11:01 +0000 (09:11 +0000)]
Make Makefile.gtk default to GTK 3.

8 years agoFix Makefile.gtk in the wake of the new [XT] program type.
Simon Tatham [Fri, 25 Mar 2016 09:10:50 +0000 (09:10 +0000)]
Fix Makefile.gtk in the wake of the new [XT] program type.

It's not the recommended makefile any more, but it's not too hard
to keep it working for the moment.

8 years agoDelete the old 'macosx' directory completely.
Simon Tatham [Fri, 25 Mar 2016 09:06:03 +0000 (09:06 +0000)]
Delete the old 'macosx' directory completely.

The current state of the OS X GTK port is looking more or less
plausible - it's not finished, of course, but then neither was the old
native Cocoa port. So I'm inclined to advertise it as *the* unfinished
OS X port: it's the one I intend to keep working on, and it's the one
I'd prefer people offered us help with if they're going to offer.

Hence, leaving the old macosx directory around is just confusing; that
directory is long-unmaintained, probably doesn't even compile, and its
only effect will be to mislead people into thinking it's still
relevant. I'm unilaterally deleting it; of course we can always
recover it from source control history if it's ever necessary to do
so.

8 years agoRewrite the FAQ entry about the MacOS port.
Simon Tatham [Fri, 25 Mar 2016 08:46:34 +0000 (08:46 +0000)]
Rewrite the FAQ entry about the MacOS port.

8 years agoFix display of ECC keys in the Windows Pageant list box.
Simon Tatham [Fri, 25 Mar 2016 08:36:29 +0000 (08:36 +0000)]
Fix display of ECC keys in the Windows Pageant list box.

This is an absolutely horrible piece of code, relying not only on font
metrics but also on an observed correlation between the length of a
key algorithm name and whether or not it needs a separate key size
displayed. But it'll do for the moment, and it's less effort than
writing a custom piece of Windows API code to display the list box
entries in a properly robust way :-(

8 years agoPolish up the PuTTYgen user interface for ECC key types.
Simon Tatham [Fri, 25 Mar 2016 07:53:06 +0000 (07:53 +0000)]
Polish up the PuTTYgen user interface for ECC key types.

Jacob pointed out that a free-text field for entering a key size in
bits is all very well for key types where we actually _can_ generate a
key to a size of your choice, but less useful for key types where
there are only three (or one) legal values for the field, especially
if we don't _say_ what they are.

So I've revamped the UI a bit: now, in ECDSA mode, you get a dropdown
list selector showing the available elliptic curves (and they're even
named, rather than just given by bit count), and in ED25519 mode even
that disappears. The curve selector for ECDSA and the bits selector
for RSA/DSA are independent controls, so each one remembers its last
known value even while temporarily hidden in favour of the other.

The actual generation function still expects a bit count rather than
an actual curve or algorithm ID, so the easiest way to actually
arrange to populate the drop-down list was to have an array of bit
counts exposed by sshecc.c. That's a bit ugly, but there we go.

One small functional change: if you enter an absurdly low value into
the RSA/DSA bit count box (under 256), PuTTYgen used to give a warning
and reset it to 256. Now it resets it to the default key length of
2048, basically because I was touching that code anyway to change a
variable name and just couldn't bring myself to leave it in a state
where it intentionally chose such an utterly useless key size. Of
course this doesn't prevent generation of 256-bit keys if someone
still really wants one - it just means they don't get one selected as
the result of a typo.

8 years agoNote in vt100.txt when it can be expected to work.
Jacob Nevins [Thu, 24 Mar 2016 23:46:10 +0000 (23:46 +0000)]
Note in vt100.txt when it can be expected to work.

8 years agoGTK 3 fake dialog action area: fix margins and spacing.
Simon Tatham [Thu, 24 Mar 2016 07:19:09 +0000 (07:19 +0000)]
GTK 3 fake dialog action area: fix margins and spacing.

The About box is where it showed up most obviously that I'd hastily
bunged a GtkBox inside another GtkBox without considering their
margins: the 'action area' had twice the margin it should have had and
the rightmost button didn't align with the right edge of the rest of
the window contents.

Easily fixed by giving the inner hbox margin 0 (fixing the right align
and the excessive space around all the buttons), and using the
'spacing' property of GtkBox to ensure multiple buttons in it are
nicely separated without having to take care over that in the client
code that adds them.

8 years agoAdd a TODO list to gtkapp.c.
Simon Tatham [Wed, 23 Mar 2016 22:17:09 +0000 (22:17 +0000)]
Add a TODO list to gtkapp.c.

This lists all the things I currently know to be wrong with the OS X
work. There are quite a few of them, but I doubt I've thought of them
all.