golang/golang-1.2-remove-ECC-p224.patch

173 lines
5.7 KiB
Diff
Raw Normal View History

2014-05-21 21:30:02 +00:00
Index: go/api/go1.txt
===================================================================
--- go.orig/api/go1.txt
+++ go/api/go1.txt
@@ -412,7 +412,6 @@ pkg crypto/ecdsa, type PublicKey struct,
pkg crypto/ecdsa, type PublicKey struct, embedded elliptic.Curve
pkg crypto/elliptic, func GenerateKey(Curve, io.Reader) ([]uint8, *big.Int, *big.Int, error)
pkg crypto/elliptic, func Marshal(Curve, *big.Int, *big.Int) []uint8
-pkg crypto/elliptic, func P224() Curve
pkg crypto/elliptic, func P256() Curve
pkg crypto/elliptic, func P384() Curve
pkg crypto/elliptic, func P521() Curve
2014-11-04 15:52:19 +00:00
Index: go/src/crypto/ecdsa/ecdsa_test.go
2014-05-21 21:30:02 +00:00
===================================================================
2014-11-04 15:52:19 +00:00
--- go.orig/src/crypto/ecdsa/ecdsa_test.go
+++ go/src/crypto/ecdsa/ecdsa_test.go
2014-05-21 21:30:02 +00:00
@@ -33,7 +33,6 @@ func testKeyGeneration(t *testing.T, c e
}
func TestKeyGeneration(t *testing.T) {
- testKeyGeneration(t, elliptic.P224(), "p224")
if testing.Short() {
return
}
2014-05-21 21:30:02 +00:00
@@ -63,7 +62,6 @@ func testSignAndVerify(t *testing.T, c e
}
func TestSignAndVerify(t *testing.T) {
- testSignAndVerify(t, elliptic.P224(), "p224")
if testing.Short() {
return
}
2014-05-21 21:30:02 +00:00
@@ -129,8 +127,6 @@ func TestVectors(t *testing.T) {
parts := strings.SplitN(line, ",", 2)
switch parts[0] {
- case "P-224":
- pub.Curve = elliptic.P224()
case "P-256":
pub.Curve = elliptic.P256()
case "P-384":
2014-11-04 15:52:19 +00:00
Index: go/src/crypto/elliptic/bottombits.go
2014-05-21 21:30:02 +00:00
===================================================================
--- /dev/null
2014-11-04 15:52:19 +00:00
+++ go/src/crypto/elliptic/bottombits.go
@@ -0,0 +1,14 @@
+
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package elliptic
+
+const bottom12Bits = 0xfff
+const bottom28Bits = 0xfffffff
+
+const two31p3 = 1<<31 + 1<<3
+const two31m3 = 1<<31 - 1<<3
+const two31m15m3 = 1<<31 - 1<<15 - 1<<3
+
2014-11-04 15:52:19 +00:00
Index: go/src/crypto/elliptic/elliptic.go
2014-05-21 21:30:02 +00:00
===================================================================
2014-11-04 15:52:19 +00:00
--- go.orig/src/crypto/elliptic/elliptic.go
+++ go/src/crypto/elliptic/elliptic.go
2014-05-21 21:30:02 +00:00
@@ -326,7 +326,6 @@ var p384 *CurveParams
var p521 *CurveParams
func initAll() {
- initP224()
initP256()
initP384()
initP521()
2014-11-04 15:52:19 +00:00
Index: go/src/crypto/elliptic/elliptic_test.go
2014-05-21 21:30:02 +00:00
===================================================================
2014-11-04 15:52:19 +00:00
--- go.orig/src/crypto/elliptic/elliptic_test.go
+++ go/src/crypto/elliptic/elliptic_test.go
@@ -1,3 +1,5 @@
+// +build ignore
+
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
2014-11-04 15:52:19 +00:00
Index: go/src/crypto/elliptic/p224.go
2014-05-21 21:30:02 +00:00
===================================================================
2014-11-04 15:52:19 +00:00
--- go.orig/src/crypto/elliptic/p224.go
+++ go/src/crypto/elliptic/p224.go
@@ -1,3 +1,5 @@
+// +build ignore
+
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
2014-05-21 21:30:02 +00:00
@@ -183,10 +185,6 @@ func p224Add(out, a, b *p224FieldElement
}
}
-const two31p3 = 1<<31 + 1<<3
-const two31m3 = 1<<31 - 1<<3
-const two31m15m3 = 1<<31 - 1<<15 - 1<<3
-
// p224ZeroModP31 is 0 mod p where bit 31 is set in all limbs so that we can
// subtract smaller amounts without underflow. See the section "Subtraction" in
// [1] for reasoning.
2014-05-21 21:30:02 +00:00
@@ -215,9 +213,6 @@ const two63m35m19 = 1<<63 - 1<<35 - 1<<1
// "Subtraction" in [1] for why.
var p224ZeroModP63 = [8]uint64{two63p35, two63m35, two63m35, two63m35, two63m35m19, two63m35, two63m35, two63m35}
-const bottom12Bits = 0xfff
-const bottom28Bits = 0xfffffff
-
// p224Mul computes *out = a*b
//
// a[i] < 2**29, b[i] < 2**30 (or vice versa)
2014-11-04 15:52:19 +00:00
Index: go/src/crypto/elliptic/p224_test.go
2014-05-21 21:30:02 +00:00
===================================================================
2014-11-04 15:52:19 +00:00
--- go.orig/src/crypto/elliptic/p224_test.go
+++ go/src/crypto/elliptic/p224_test.go
@@ -1,3 +1,5 @@
+// +build ignore
+
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
2014-11-04 15:52:19 +00:00
Index: go/src/crypto/x509/x509.go
2014-05-21 21:30:02 +00:00
===================================================================
2014-11-04 15:52:19 +00:00
--- go.orig/src/crypto/x509/x509.go
+++ go/src/crypto/x509/x509.go
2014-05-21 21:30:02 +00:00
@@ -306,9 +306,6 @@ func getPublicKeyAlgorithmFromOID(oid as
// RFC 5480, 2.1.1.1. Named Curve
//
-// secp224r1 OBJECT IDENTIFIER ::= {
-// iso(1) identified-organization(3) certicom(132) curve(0) 33 }
-//
// secp256r1 OBJECT IDENTIFIER ::= {
// iso(1) member-body(2) us(840) ansi-X9-62(10045) curves(3)
// prime(1) 7 }
2014-05-21 21:30:02 +00:00
@@ -321,7 +318,6 @@ func getPublicKeyAlgorithmFromOID(oid as
//
// NB: secp256r1 is equivalent to prime256v1
var (
- oidNamedCurveP224 = asn1.ObjectIdentifier{1, 3, 132, 0, 33}
oidNamedCurveP256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 3, 1, 7}
oidNamedCurveP384 = asn1.ObjectIdentifier{1, 3, 132, 0, 34}
oidNamedCurveP521 = asn1.ObjectIdentifier{1, 3, 132, 0, 35}
2014-05-21 21:30:02 +00:00
@@ -329,8 +325,6 @@ var (
func namedCurveFromOID(oid asn1.ObjectIdentifier) elliptic.Curve {
switch {
- case oid.Equal(oidNamedCurveP224):
- return elliptic.P224()
case oid.Equal(oidNamedCurveP256):
return elliptic.P256()
case oid.Equal(oidNamedCurveP384):
2014-05-21 21:30:02 +00:00
@@ -343,8 +337,6 @@ func namedCurveFromOID(oid asn1.ObjectId
func oidFromNamedCurve(curve elliptic.Curve) (asn1.ObjectIdentifier, bool) {
switch curve {
- case elliptic.P224():
- return oidNamedCurveP224, true
case elliptic.P256():
return oidNamedCurveP256, true
case elliptic.P384():
2014-05-21 21:30:02 +00:00
@@ -1371,7 +1363,7 @@ func signingParamsForPrivateKey(priv int
pubType = ECDSA
switch priv.Curve {
- case elliptic.P224(), elliptic.P256():
+ case elliptic.P256():
hashFunc = crypto.SHA256
2014-05-21 21:30:02 +00:00
sigAlgo.Algorithm = oidSignatureECDSAWithSHA256
case elliptic.P384():