]> Cypherpunks repositories - gostls13.git/commit
crypto/internal/fips140/bigmod: add Nat.InverseVarTime
authorFilippo Valsorda <filippo@golang.org>
Thu, 28 Nov 2024 09:20:58 +0000 (10:20 +0100)
committerGopher Robot <gobot@golang.org>
Sat, 30 Nov 2024 01:47:04 +0000 (01:47 +0000)
commitf7475a0af3169d3d91f6071646defcf103393cc0
treef11f6b9282a464f9a8cbc3985c7a9834d2dbc002
parent22b5c145fb85771cdc5d16cd6aa8294bcf010d46
crypto/internal/fips140/bigmod: add Nat.InverseVarTime

Will be needed for RSA key generation.

We now require Modulus to be > 1 because we don't want to worry about 1
being out of range. There is no use for a Modulus of 1 anyway, and we
already return an error from NewModulus.

Ported from https://cs.opensource.google/boringssl/boringssl/+/master:crypto/fipsmodule/bn/gcd_extra.cc.inc;drc=5813c2c10c73d800f1b0d890a7d74ff973abbffc.

Updates #69799
For #69536

Change-Id: I9850bcc461565b23fa7186a09c65355f7da3e5ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/632415
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/crypto/internal/fips140/bigmod/nat.go
src/crypto/internal/fips140/bigmod/nat_test.go
src/crypto/internal/fips140/bigmod/testdata/mod_inv_tests.txt [new file with mode: 0644]