diff options
author | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-09-30 01:37:44 +0800 |
---|---|---|
committer | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-11-30 20:43:32 +0800 |
commit | c8ad64f33cd04fc10ac6681260ea06e464908c91 (patch) | |
tree | bd48055c50b57e2b17ca0bde4e9e5ae9ba7ca5ce /crypto/ecies/asn1.go | |
parent | 27a50c8f4bc69f98e20db361859bfbb6cf371c00 (diff) | |
download | go-tangerine-c8ad64f33cd04fc10ac6681260ea06e464908c91.tar go-tangerine-c8ad64f33cd04fc10ac6681260ea06e464908c91.tar.gz go-tangerine-c8ad64f33cd04fc10ac6681260ea06e464908c91.tar.bz2 go-tangerine-c8ad64f33cd04fc10ac6681260ea06e464908c91.tar.lz go-tangerine-c8ad64f33cd04fc10ac6681260ea06e464908c91.tar.xz go-tangerine-c8ad64f33cd04fc10ac6681260ea06e464908c91.tar.zst go-tangerine-c8ad64f33cd04fc10ac6681260ea06e464908c91.zip |
crypto, crypto/ecies, crypto/secp256k1: libsecp256k1 scalar mult
thanks to Felix Lange (fjl) for help with design & impl
Diffstat (limited to 'crypto/ecies/asn1.go')
-rw-r--r-- | crypto/ecies/asn1.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crypto/ecies/asn1.go b/crypto/ecies/asn1.go index 6eaf3d2ca..40dabd329 100644 --- a/crypto/ecies/asn1.go +++ b/crypto/ecies/asn1.go @@ -41,6 +41,8 @@ import ( "fmt" "hash" "math/big" + + "github.com/ethereum/go-ethereum/crypto/secp256k1" ) var ( @@ -81,6 +83,7 @@ func doScheme(base, v []int) asn1.ObjectIdentifier { type secgNamedCurve asn1.ObjectIdentifier var ( + secgNamedCurveS256 = secgNamedCurve{1, 3, 132, 0, 10} secgNamedCurveP256 = secgNamedCurve{1, 2, 840, 10045, 3, 1, 7} secgNamedCurveP384 = secgNamedCurve{1, 3, 132, 0, 34} secgNamedCurveP521 = secgNamedCurve{1, 3, 132, 0, 35} @@ -116,6 +119,8 @@ func (curve secgNamedCurve) Equal(curve2 secgNamedCurve) bool { func namedCurveFromOID(curve secgNamedCurve) elliptic.Curve { switch { + case curve.Equal(secgNamedCurveS256): + return secp256k1.S256() case curve.Equal(secgNamedCurveP256): return elliptic.P256() case curve.Equal(secgNamedCurveP384): @@ -134,6 +139,8 @@ func oidFromNamedCurve(curve elliptic.Curve) (secgNamedCurve, bool) { return secgNamedCurveP384, true case elliptic.P521(): return secgNamedCurveP521, true + case secp256k1.S256(): + return secgNamedCurveS256, true } return nil, false |