Skip to content

Commit 3f07afb

Browse files
committed
remove elliptic.P224 usage
Fedora/RedHat distros comply with US patent law and remove this curve, which makes it impossible to run ethereum with distro provided Golang. File crypto/ecies/README claims it is unsupported anyway.
1 parent e7f4232 commit 3f07afb

2 files changed

Lines changed: 1 addition & 14 deletions

File tree

‎crypto/ecies/asn1.go‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,16 @@ func doScheme(base, v []int) asn1.ObjectIdentifier {
8181
type secgNamedCurve asn1.ObjectIdentifier
8282

8383
var (
84-
secgNamedCurveP224 = secgNamedCurve{1, 3, 132, 0, 33}
8584
secgNamedCurveP256 = secgNamedCurve{1, 2, 840, 10045, 3, 1, 7}
8685
secgNamedCurveP384 = secgNamedCurve{1, 3, 132, 0, 34}
8786
secgNamedCurveP521 = secgNamedCurve{1, 3, 132, 0, 35}
88-
rawCurveP224 = []byte{6, 5, 4, 3, 1, 2, 9, 4, 0, 3, 3}
8987
rawCurveP256 = []byte{6, 8, 4, 2, 1, 3, 4, 7, 2, 2, 0, 6, 6, 1, 3, 1, 7}
9088
rawCurveP384 = []byte{6, 5, 4, 3, 1, 2, 9, 4, 0, 3, 4}
9189
rawCurveP521 = []byte{6, 5, 4, 3, 1, 2, 9, 4, 0, 3, 5}
9290
)
9391

9492
func rawCurve(curve elliptic.Curve) []byte {
9593
switch curve {
96-
case elliptic.P224():
97-
return rawCurveP224
9894
case elliptic.P256():
9995
return rawCurveP256
10096
case elliptic.P384():
@@ -120,8 +116,6 @@ func (curve secgNamedCurve) Equal(curve2 secgNamedCurve) bool {
120116

121117
func namedCurveFromOID(curve secgNamedCurve) elliptic.Curve {
122118
switch {
123-
case curve.Equal(secgNamedCurveP224):
124-
return elliptic.P224()
125119
case curve.Equal(secgNamedCurveP256):
126120
return elliptic.P256()
127121
case curve.Equal(secgNamedCurveP384):
@@ -134,8 +128,6 @@ func namedCurveFromOID(curve secgNamedCurve) elliptic.Curve {
134128

135129
func oidFromNamedCurve(curve elliptic.Curve) (secgNamedCurve, bool) {
136130
switch curve {
137-
case elliptic.P224():
138-
return secgNamedCurveP224, true
139131
case elliptic.P256():
140132
return secgNamedCurveP256, true
141133
case elliptic.P384():
@@ -248,7 +240,7 @@ var idEcPublicKeySupplemented = doScheme(idPublicKeyType, []int{0})
248240

249241
func curveToRaw(curve elliptic.Curve) (rv asn1.RawValue, ok bool) {
250242
switch curve {
251-
case elliptic.P224(), elliptic.P256(), elliptic.P384(), elliptic.P521():
243+
case elliptic.P256(), elliptic.P384(), elliptic.P521():
252244
raw := rawCurve(curve)
253245
return asn1.RawValue{
254246
Tag: 30,

‎crypto/ecies/ecies_test.go‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,6 @@ type testCase struct {
407407
}
408408

409409
var testCases = []testCase{
410-
testCase{
411-
Curve: elliptic.P224(),
412-
Name: "P224",
413-
Expected: false,
414-
},
415410
testCase{
416411
Curve: elliptic.P256(),
417412
Name: "P256",

0 commit comments

Comments
 (0)