simon-git: putty (main): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Thu Apr 21 08:16:22 BST 2022


TL;DR:
  9aae695c NTRU: speed up the polynomial inversion.
  3a54f28a Extra utility function add_to_commasep_pl.
  6a9e4ba2 kexinit_algorithm: switch to storing names as ptrlen.
  7d44e35b transport2: make kexlists dynamically allocated.

Repository:     https://git.tartarus.org/simon/putty.git
On the web:     https://git.tartarus.org/?p=simon/putty.git
Branch updated: main
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2022-04-21 08:16:22

commit 9aae695c62fd23e4832b84c3434f716f3ad2ec0f
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=9aae695c62fd23e4832b84c3434f716f3ad2ec0f;hp=faf1601a5549eda9298f72f7c0f68f39c8f97764
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Apr 20 20:14:25 2022 +0100

    NTRU: speed up the polynomial inversion.
    
    I wasn't really satisfied with the previous version, but it was
    easiest to get Stein's algorithm working on polynomials by doing it
    exactly how I already knew to do it for integers. But now I've
    improved it in two ways.
    
    The first improvement I got from another implementation: instead of
    transforming A into A - kB for some k that makes the constant term
    zero, you can scale _both_ inputs, replacing A with mA - kB for some
    k,m. The advantage is that you can calculate m and k very easily, by
    making each one the constant term of the other polynomial, which means
    you don't need to invert something mod q in every step. (Rather like
    the projective-coordinates optimisations in elliptic curves, where
    instead of inverting in every step you accumulate the product of all
    the factors that need to be inverted, and invert the whole product
    once at the very end.)
    
    The second improvement is to abandon my cumbersome unwinding loop that
    builds up the output coefficients by reversing the steps in the
    original gcd-finding loop. Instead, I do the thing you do in normal
    Euclid's algorithm: keep track of the coefficients as you go through
    the original loop. I had wanted to do this before, but hadn't figured
    out how you could deal with dividing a coefficient by x when (unlike
    the associated real value) the coefficient isn't a multiple of x. But
    the answer is very simple: x is invertible in the ring we're working
    in (its inverse mod x^p-x-1 is just x^{p-1}-1), so you _can_ just
    divide your coefficient by x, and moreover, very easily!
    
    Together, these changes speed up the NTRU key generation by about a
    factor of 1.5. And they remove lots of complicated code as well, so
    everybody wins.

 crypto/ntru.c | 179 +++++++++++++++++++++++-----------------------------------
 1 file changed, 72 insertions(+), 107 deletions(-)

commit 3a54f28a4eab33e322ac526bf8fc74b78c1013ea
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=3a54f28a4eab33e322ac526bf8fc74b78c1013ea;hp=9aae695c62fd23e4832b84c3434f716f3ad2ec0f
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Apr 20 10:32:14 2022 +0100

    Extra utility function add_to_commasep_pl.
    
    Just like add_to_commasep, but takes a ptrlen.

 ssh.h        | 1 +
 ssh/common.c | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

commit 6a9e4ba24af07ae8a45699070a115a3a51df13c7
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=6a9e4ba24af07ae8a45699070a115a3a51df13c7;hp=3a54f28a4eab33e322ac526bf8fc74b78c1013ea
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Apr 20 10:33:08 2022 +0100

    kexinit_algorithm: switch to storing names as ptrlen.
    
    They're now also compared as strings, fixing the slight fragility
    where we depended on string-literal pointer equality.

 ssh/transport2.c | 28 +++++++++++++++++-----------
 ssh/transport2.h |  2 +-
 2 files changed, 18 insertions(+), 12 deletions(-)

commit 7d44e35bb3780c04a36ca6d383fe9ec4c0d37137
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=7d44e35bb3780c04a36ca6d383fe9ec4c0d37137;hp=6a9e4ba24af07ae8a45699070a115a3a51df13c7
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Apr 21 05:11:58 2022 +0100

    transport2: make kexlists dynamically allocated.
    
    The list of kex methods recently ran out of space due to the addition
    of NTRU (at least, if you have GSSAPI enabled). It's time to stop
    having an arbitrary limit on those arrays and switch to doing it
    properly.

 ssh/transport2.c | 88 +++++++++++++++++++++++++++++---------------------------
 ssh/transport2.h |  7 +++--
 2 files changed, 50 insertions(+), 45 deletions(-)



More information about the tartarus-commits mailing list