]> Cypherpunks repositories - gostls13.git/commit
crypto/elliptic: use generics for nistec-based curves
authorFilippo Valsorda <filippo@golang.org>
Sat, 30 Oct 2021 06:01:35 +0000 (02:01 -0400)
committerFilippo Valsorda <filippo@golang.org>
Wed, 27 Apr 2022 14:22:53 +0000 (14:22 +0000)
commit83ff0b0c61c6ae99a058c851f4b0680064d46e8b
tree4eb31aa54eb89da6e42c998705bb493c4355fbd6
parent6796a7924c20d2c58b0cf78766b94543abfadc1b
crypto/elliptic: use generics for nistec-based curves

There was no way to use an interface because the methods on the Point
types return concrete Point values, as they should.

A couple somewhat minor annoyances:

    - Allocations went up due to #48849. This is fine here, where
      math/big causes allocations anyway, but would probably not be fine
      in nistec itself.

    - Carrying the newPoint/newGenerator functions around as a field is
      a little weird, even if type-safe. It also means we have to make
      what were functions methods so they can access newPoint to return
      the zero value. This is #35966.

For #52182

Change-Id: I050f3a27f15d3f189818da80da9de0cba0548931
Reviewed-on: https://go-review.googlesource.com/c/go/+/360015
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/crypto/elliptic/nistec.go [new file with mode: 0644]
src/crypto/elliptic/p224.go [deleted file]
src/crypto/elliptic/p384.go [deleted file]
src/crypto/elliptic/p521.go [deleted file]