1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00
putty-source/unix
Simon Tatham 25b034ee39 Complete rewrite of PuTTY's bignum library.
The old 'Bignum' data type is gone completely, and so is sshbn.c. In
its place is a new thing called 'mp_int', handled by an entirely new
library module mpint.c, with API differences both large and small.

The main aim of this change is that the new library should be free of
timing- and cache-related side channels. I've written the code so that
it _should_ - assuming I haven't made any mistakes - do all of its
work without either control flow or memory addressing depending on the
data words of the input numbers. (Though, being an _arbitrary_
precision library, it does have to at least depend on the sizes of the
numbers - but there's a 'formal' size that can vary separately from
the actual magnitude of the represented integer, so if you want to
keep it secret that your number is actually small, it should work fine
to have a very long mp_int and just happen to store 23 in it.) So I've
done all my conditionalisation by means of computing both answers and
doing bit-masking to swap the right one into place, and all loops over
the words of an mp_int go up to the formal size rather than the actual
size.

I haven't actually tested the constant-time property in any rigorous
way yet (I'm still considering the best way to do it). But this code
is surely at the very least a big improvement on the old version, even
if I later find a few more things to fix.

I've also completely rewritten the low-level elliptic curve arithmetic
from sshecc.c; the new ecc.c is closer to being an adjunct of mpint.c
than it is to the SSH end of the code. The new elliptic curve code
keeps all coordinates in Montgomery-multiplication transformed form to
speed up all the multiplications mod the same prime, and only converts
them back when you ask for the affine coordinates. Also, I adopted
extended coordinates for the Edwards curve implementation.

sshecc.c has also had a near-total rewrite in the course of switching
it over to the new system. While I was there, I've separated ECDSA and
EdDSA more completely - they now have separate vtables, instead of a
single vtable in which nearly every function had a big if statement in
it - and also made the externally exposed types for an ECDSA key and
an ECDH context different.

A minor new feature: since the new arithmetic code includes a modular
square root function, we can now support the compressed point
representation for the NIST curves. We seem to have been getting along
fine without that so far, but it seemed a shame not to put it in,
since it was suddenly easy.

In sshrsa.c, one major change is that I've removed the RSA blinding
step in rsa_privkey_op, in which we randomise the ciphertext before
doing the decryption. The purpose of that was to avoid timing leaks
giving away the plaintext - but the new arithmetic code should take
that in its stride in the course of also being careful enough to avoid
leaking the _private key_, which RSA blinding had no way to do
anything about in any case.

Apart from those specific points, most of the rest of the changes are
more or less mechanical, just changing type names and translating code
into the new API.
2018-12-31 14:54:59 +00:00
..
configure Move the Unix configure script up to the top level. 2014-02-22 18:01:32 +00:00
gtkapp.c Move all extern declarations into header files. 2018-11-03 13:47:29 +00:00
gtkask.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
gtkcfg.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
gtkcols.c Add some more miscellaneous asserts. 2018-12-01 17:04:44 +00:00
gtkcols.h Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
gtkcomm.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
gtkcompat.h Adopt C99 <stdbool.h>'s true/false. 2018-11-03 13:45:00 +00:00
gtkdlg.c Add some more miscellaneous asserts. 2018-12-01 17:04:44 +00:00
gtkfont.c Add some more miscellaneous asserts. 2018-12-01 17:04:44 +00:00
gtkfont.h Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
gtkmain.c Move all extern declarations into header files. 2018-11-03 13:47:29 +00:00
gtkmisc.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
gtkmisc.h Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
gtkwin.c Start using C99 variadic macros. 2018-12-08 20:48:41 +00:00
osxlaunch.c osxlaunch: stop setting DYLD_LIBRARY_PATH. 2017-12-20 10:04:02 +00:00
pterm.bundle OS X makefile: stop depending on JHBUILD_PREFIX. 2017-11-26 11:45:48 +00:00
pterm.plist Create OS X application bundles for PuTTY and pterm. 2016-03-23 22:22:48 +00:00
putty.bundle OS X makefile: stop depending on JHBUILD_PREFIX. 2017-11-26 11:45:48 +00:00
putty.plist Create OS X application bundles for PuTTY and pterm. 2016-03-23 22:22:48 +00:00
unix.h Move all extern declarations into header files. 2018-11-03 13:47:29 +00:00
ux_x11.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxagentc.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxagentsock.c Close standard handles in watchdog subprocesses. 2018-10-21 10:16:16 +01:00
uxcfg.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxcons.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxfdsock.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxgen.c Unix PuTTYgen: switch to /dev/urandom by default. 2018-06-03 15:15:51 +01:00
uxgss.c Support GSS key exchange, for Kerberos 5 only. 2018-04-26 07:21:16 +01:00
uxmisc.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxnet.c Start using C99 variadic macros. 2018-12-08 20:48:41 +00:00
uxnogtk.c Include the compile-time GTK version in the build info. 2017-02-15 19:32:42 +00:00
uxnoise.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxpeer.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxpgnt.c Remove some redundant variables and assignments. 2018-12-01 17:00:01 +00:00
uxplink.c Remove some redundant variables and assignments. 2018-12-01 17:00:01 +00:00
uxprint.c Update to r8614: another -D_FORTIFY_SOURCE=2 fix. 2010-02-20 11:21:25 +00:00
uxproxy.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxpterm.c Move all extern declarations into header files. 2018-11-03 13:47:29 +00:00
uxpty.c Remove a load of obsolete printf string limits. 2018-12-08 21:06:59 +00:00
uxputty.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxsel.c unix: make select_result() return void. 2017-05-14 16:34:48 +01:00
uxser.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxserver.c Complete rewrite of PuTTY's bignum library. 2018-12-31 14:54:59 +00:00
uxsftp.c pscp: replace crash with diagnostic on opendir failure. 2018-12-27 16:52:23 +00:00
uxsftpserver.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxshare.c Move all extern declarations into header files. 2018-11-03 13:47:29 +00:00
uxsignal.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxstore.c Rework mungestr() and unmungestr(). 2018-11-03 13:45:00 +00:00
uxucs.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
x11misc.c Ignore X11 BadMatch errors during cut buffer setup. 2016-03-20 18:30:03 +00:00
x11misc.h Basic support for running under GDK Wayland back end. 2018-05-09 09:21:27 +01:00
xkeysym.c Support for non-ISO-8859-1 X keysyms. So in particular, pterm in a 2003-04-27 11:10:48 +00:00
xpmptcfg.c Tweak the icon script, and the generated icons, to more closely 2007-01-07 10:17:12 +00:00
xpmpterm.c Tweak the icon script, and the generated icons, to more closely 2007-01-07 10:17:12 +00:00
xpmpucfg.c Tweak the icon script, and the generated icons, to more closely 2007-01-07 10:17:12 +00:00
xpmputty.c Tweak the icon script, and the generated icons, to more closely 2007-01-07 10:17:12 +00:00