]> Cypherpunks repositories - gostls13.git/commit
crypto/internal/nistec: refactor scalar multiplication
authorFilippo Valsorda <filippo@golang.org>
Mon, 13 Feb 2023 19:49:38 +0000 (20:49 +0100)
committerGopher Robot <gobot@golang.org>
Mon, 13 Mar 2023 18:55:22 +0000 (18:55 +0000)
commit778627f33187d874440ce1f353bb4d7bce55304a
tree997f90bd2ef58527d06ce18c39fddaa0328e6cdb
parent90dde5dec1126ddf2236730ec57511ced56a512d
crypto/internal/nistec: refactor scalar multiplication

The assumptions of some of the assembly functions were still scarcely
documented and even disregarded: p256ScalarMult was relying on the fact
that the "undefined behavior" of p256PointAddAsm with regards to
infinity inputs was returning the infinity.

Aside from expanding comments, moving the bit window massaging into a
more easily understood p256OrdRsh function, and fixing the above, this
change folds the last iteration of p256ScalarMult into the loop to
reduce special cases and inverts the iteration order of p256BaseMult so
it matches p256ScalarMult for ease of comparison.

Updates #58647

Change-Id: Ie5712ea778aadbe5adcdb478d111c2527e83caa0
Reviewed-on: https://go-review.googlesource.com/c/go/+/471256
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
src/crypto/internal/nistec/nistec_test.go
src/crypto/internal/nistec/p256_asm.go