aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-RSA
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo@golang.org>2022-11-12 14:01:15 +0100
committerGopher Robot <gobot@golang.org>2022-11-21 16:19:15 +0000
commitd7812ab38031ae524a731b4d2f19adcecd22c2f4 (patch)
tree09047be60d7c7af0abf8697d1312e11002be3c86 /src/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-RSA
parent831c6509ccddfc55c7f2121c5158f5f40916e6ad (diff)
downloadgo-d7812ab38031ae524a731b4d2f19adcecd22c2f4.tar.xz
crypto/internal/bigmod: move nat implementation out of crypto/rsa
This will let us reuse it in crypto/ecdsa for the NIST scalar fields. The main change in API is around encoding and decoding. The SetBytes + ExpandFor sequence was hacky: SetBytes could produce a bigger size than the modulus if leading zeroes in the top byte overflowed the limb boundary, so ExpandFor had to check for and tolerate that. Also, the caller was responsible for checking that the overflow was actually all zeroes (which we weren't doing, exposing a crasher in decryption and signature verification) and then for checking that the result was less than the modulus. Instead, make SetBytes take a modulus and return an error if the value overflows. Same with Bytes: we were always allocating based on Size before FillBytes anyway, so now Bytes takes a modulus. Finally, SetBig was almost only used for moduli, so replaced NewModulusFromNat and SetBig with NewModulusFromBig. Moved the constant-time bitLen to math/big.Int.BitLen. It's slower, but BitLen is primarily used in cryptographic code, so it's safer this way. Change-Id: Ibaf7f36d80695578cb80484167d82ce1aa83832f Reviewed-on: https://go-review.googlesource.com/c/go/+/450055 Auto-Submit: Filippo Valsorda <filippo@golang.org> Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Roland Shoemaker <roland@golang.org>
Diffstat (limited to 'src/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-RSA')
0 files changed, 0 insertions, 0 deletions