[golang] removing the elliptic.P224 curve bz1038683

Vincent Batts vbatts at fedoraproject.org
Wed Dec 18 19:26:39 UTC 2013


commit 5152b3a3e6b3ac53c0da0f9f256cf3ed6d64aa48
Author: Vincent Batts <vbatts at redhat.com>
Date:   Wed Dec 18 14:25:44 2013 -0500

    removing the elliptic.P224 curve
    bz1038683

 golang-1.2-remove-ECC-p224.patch |  164 ++++++++++++++++++++++++++++++++++++++
 golang.spec                      |   11 +++-
 2 files changed, 174 insertions(+), 1 deletions(-)
---
diff --git a/golang-1.2-remove-ECC-p224.patch b/golang-1.2-remove-ECC-p224.patch
new file mode 100644
index 0000000..d31b400
--- /dev/null
+++ b/golang-1.2-remove-ECC-p224.patch
@@ -0,0 +1,164 @@
+diff -r 87dea3f5ebe7 api/go1.txt
+--- a/api/go1.txt	Fri Nov 29 08:32:31 2013 +1100
++++ b/api/go1.txt	Fri Dec 06 13:31:29 2013 -0500
+@@ -412,7 +412,6 @@
+ 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
+diff -r 87dea3f5ebe7 src/pkg/crypto/ecdsa/ecdsa_test.go
+--- a/src/pkg/crypto/ecdsa/ecdsa_test.go	Fri Nov 29 08:32:31 2013 +1100
++++ b/src/pkg/crypto/ecdsa/ecdsa_test.go	Fri Dec 06 13:31:29 2013 -0500
+@@ -33,7 +33,6 @@
+ }
+ 
+ func TestKeyGeneration(t *testing.T) {
+-	testKeyGeneration(t, elliptic.P224(), "p224")
+ 	if testing.Short() {
+ 		return
+ 	}
+@@ -63,7 +62,6 @@
+ }
+ 
+ func TestSignAndVerify(t *testing.T) {
+-	testSignAndVerify(t, elliptic.P224(), "p224")
+ 	if testing.Short() {
+ 		return
+ 	}
+@@ -129,8 +127,6 @@
+ 			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":
+diff -r 87dea3f5ebe7 src/pkg/crypto/elliptic/bottombits.go
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/src/pkg/crypto/elliptic/bottombits.go	Fri Dec 06 13:31:29 2013 -0500
+@@ -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
++
+diff -r 87dea3f5ebe7 src/pkg/crypto/elliptic/elliptic.go
+--- a/src/pkg/crypto/elliptic/elliptic.go	Fri Nov 29 08:32:31 2013 +1100
++++ b/src/pkg/crypto/elliptic/elliptic.go	Fri Dec 06 13:31:29 2013 -0500
+@@ -326,7 +326,6 @@
+ var p521 *CurveParams
+ 
+ func initAll() {
+-	initP224()
+ 	initP256()
+ 	initP384()
+ 	initP521()
+diff -r 87dea3f5ebe7 src/pkg/crypto/elliptic/elliptic_test.go
+--- a/src/pkg/crypto/elliptic/elliptic_test.go	Fri Nov 29 08:32:31 2013 +1100
++++ b/src/pkg/crypto/elliptic/elliptic_test.go	Fri Dec 06 13:31:29 2013 -0500
+@@ -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.
+diff -r 87dea3f5ebe7 src/pkg/crypto/elliptic/p224.go
+--- a/src/pkg/crypto/elliptic/p224.go	Fri Nov 29 08:32:31 2013 +1100
++++ b/src/pkg/crypto/elliptic/p224.go	Fri Dec 06 13:31:29 2013 -0500
+@@ -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.
+@@ -183,10 +185,6 @@
+ 	}
+ }
+ 
+-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.
+@@ -215,9 +213,6 @@
+ // "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)
+diff -r 87dea3f5ebe7 src/pkg/crypto/elliptic/p224_test.go
+--- a/src/pkg/crypto/elliptic/p224_test.go	Fri Nov 29 08:32:31 2013 +1100
++++ b/src/pkg/crypto/elliptic/p224_test.go	Fri Dec 06 13:31:29 2013 -0500
+@@ -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.
+diff -r 87dea3f5ebe7 src/pkg/crypto/x509/x509.go
+--- a/src/pkg/crypto/x509/x509.go	Fri Nov 29 08:32:31 2013 +1100
++++ b/src/pkg/crypto/x509/x509.go	Fri Dec 06 13:31:29 2013 -0500
+@@ -305,9 +305,6 @@
+ 
+ // 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 }
+@@ -320,7 +317,6 @@
+ //
+ // 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}
+@@ -328,8 +324,6 @@
+ 
+ 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):
+@@ -342,8 +336,6 @@
+ 
+ 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():
+@@ -1373,7 +1365,7 @@
+ 		hashFunc = crypto.SHA1
+ 	case *ecdsa.PrivateKey:
+ 		switch priv.Curve {
+-		case elliptic.P224(), elliptic.P256():
++		case elliptic.P256():
+ 			hashFunc = crypto.SHA256
+ 			signatureAlgorithm.Algorithm = oidSignatureECDSAWithSHA256
+ 		case elliptic.P384():
diff --git a/golang.spec b/golang.spec
index 2af2b6a..c3fdc5a 100644
--- a/golang.spec
+++ b/golang.spec
@@ -25,7 +25,7 @@
 
 Name:           golang
 Version:        1.2
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        The Go Programming Language
 
 License:        BSD
@@ -54,6 +54,9 @@ Requires:       /usr/bin/godoc
 
 Patch0:         golang-1.2-verbose-build.patch
 
+# https://bugzilla.redhat.com/show_bug.cgi?id=1038683
+Patch2:         golang-1.2-remove-ECC-p224.patch
+
 # Having documentation separate was broken
 Obsoletes:      %{name}-docs < 1.1-4
 
@@ -131,6 +134,9 @@ end
 # increase verbosity of build
 %patch0 -p1
 
+# remove the P224 curve
+%patch2 -p1
+
 # create a [dirty] gcc wrapper to allow us to build with our own flags
 # (dirty because it is spoofing 'gcc' since CC value is stored in the go tool)
 # TODO: remove this and just set CFLAGS/LDFLAGS once upstream supports it
@@ -282,6 +288,9 @@ cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf
 
 
 %changelog
+* Wed Dec 18 2013 Vincent Batts <vbatts at redhat.com> - 1.2-2
+- removing P224 ECC curve
+
 * Mon Dec 2 2013 Vincent Batts <vbatts at fedoraproject.org> - 1.2-1
 - Update to upstream 1.2 release
 - remove the pax tar patches


More information about the scm-commits mailing list