Compare commits

...

No commits in common. "imports/c8s-stream-rhel8/golang-1.16.7-1.module+el8.5.0+12246+1aac4e3f" and "c8-stream-rhel8" have entirely different histories.

14 changed files with 711 additions and 498 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
SOURCES/go-go-1.16.7-1-openssl-fips.tar.gz
SOURCES/go1.21.9-1-openssl-fips.tar.gz
SOURCES/go1.21.9.tar.gz

View File

@ -1 +1,2 @@
e693273f254789980a55720bd48ac8741d446f21 SOURCES/go-go-1.16.7-1-openssl-fips.tar.gz
1162b641e8b23110eaab7496003585ea6c786158 SOURCES/go1.21.9-1-openssl-fips.tar.gz
54c038c82c82ebe2ad4ee2d0a3d7c4d39809f59a SOURCES/go1.21.9.tar.gz

View File

@ -0,0 +1,288 @@
diff --git a/src/crypto/internal/backend/nobackend.go b/src/crypto/internal/backend/nobackend.go
index 5f258a2..5dbbc42 100644
--- a/src/crypto/internal/backend/nobackend.go
+++ b/src/crypto/internal/backend/nobackend.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !linux || !cgo || android || cmd_go_bootstrap || msan || no_openssl
-// +build !linux !cgo android cmd_go_bootstrap msan no_openssl
+//go:build !linux || !cgo || android || cmd_go_bootstrap || msan || no_openssl || static
+// +build !linux !cgo android cmd_go_bootstrap msan no_openssl static
package backend
diff --git a/src/crypto/internal/boring/goboringcrypto.h b/src/crypto/internal/boring/goboringcrypto.h
index d6d99b1..f2fe332 100644
--- a/src/crypto/internal/boring/goboringcrypto.h
+++ b/src/crypto/internal/boring/goboringcrypto.h
@@ -1,4 +1,5 @@
// Copyright 2017 The Go Authors. All rights reserved.
+// +build !static
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
diff --git a/src/crypto/internal/boring/syso/syso.go b/src/crypto/internal/boring/syso/syso.go
index b338754..db5ea1e 100644
--- a/src/crypto/internal/boring/syso/syso.go
+++ b/src/crypto/internal/boring/syso/syso.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build boringcrypto
+//go:build boringcrypto && !static
// This package only exists with GOEXPERIMENT=boringcrypto.
// It provides the actual syso file.
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/aes.go b/src/vendor/github.com/golang-fips/openssl-fips/openssl/aes.go
index 079fc3c..e826d0b 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/aes.go
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/aes.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl
-// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl
+//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl && !static
+// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl,!static
package openssl
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/ecdh.go b/src/vendor/github.com/golang-fips/openssl-fips/openssl/ecdh.go
index 0b61e79..94d0c98 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/ecdh.go
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/ecdh.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl
-// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl
+//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl && !static
+// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl,!static
package openssl
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/ecdsa.go b/src/vendor/github.com/golang-fips/openssl-fips/openssl/ecdsa.go
index afec529..d822152 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/ecdsa.go
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/ecdsa.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl
-// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl
+//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl && !static
+// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl,!static
package openssl
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/goopenssl.h b/src/vendor/github.com/golang-fips/openssl-fips/openssl/goopenssl.h
index 6d6a562..17cc314 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/goopenssl.h
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/goopenssl.h
@@ -1,4 +1,5 @@
// Copyright 2017 The Go Authors. All rights reserved.
+// +build !static
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build linux
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/hkdf.go b/src/vendor/github.com/golang-fips/openssl-fips/openssl/hkdf.go
index ae40b93..17bc075 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/hkdf.go
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/hkdf.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl
-// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl
+//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl && !static
+// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl,!static
package openssl
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/hmac.go b/src/vendor/github.com/golang-fips/openssl-fips/openssl/hmac.go
index 6f00177..f466b18 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/hmac.go
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/hmac.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl
-// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl
+//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl && !static
+// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl,!static
package openssl
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/notboring.go b/src/vendor/github.com/golang-fips/openssl-fips/openssl/notboring.go
index 7c0b5d6..262af07 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/notboring.go
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/notboring.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !linux || !cgo || android || cmd_go_bootstrap || msan || no_openssl
-// +build !linux !cgo android cmd_go_bootstrap msan no_openssl
+//go:build !linux || !cgo || android || cmd_go_bootstrap || msan || no_openssl || static
+// +build !linux !cgo android cmd_go_bootstrap msan no_openssl static
package openssl
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl.go b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl.go
index d49194d..ff15054 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl.go
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl
-// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl
+//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl && !static
+// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl,!static
package openssl
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_ecdsa_signature.c b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_ecdsa_signature.c
index 2349db1..57fbb04 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_ecdsa_signature.c
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_ecdsa_signature.c
@@ -1,4 +1,5 @@
// +build linux
+// +build !static
// +build !android
// +build !no_openssl
// +build !cmd_go_bootstrap
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_evp.c b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_evp.c
index 4379019..5034c46 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_evp.c
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_evp.c
@@ -1,4 +1,5 @@
// +build linux
+// +build !static
// +build !android
// +build !no_openssl
// +build !cmd_go_bootstrap
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_lock_setup.c b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_lock_setup.c
index 49d40a7..3b3dbf8 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_lock_setup.c
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_lock_setup.c
@@ -1,4 +1,5 @@
// +build linux
+// +build !static
// +build !android
// +build !no_openssl
// +build !cmd_go_bootstrap
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_aead_gcm.c b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_aead_gcm.c
index 7eb645e..1c3225a 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_aead_gcm.c
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_aead_gcm.c
@@ -1,4 +1,5 @@
// This file contains a port of the BoringSSL AEAD interface.
+// +build !static
// +build linux
// +build !android
// +build !no_openssl
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_ctr128.c b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_ctr128.c
index df4ebe3..876393b 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_ctr128.c
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_ctr128.c
@@ -1,4 +1,5 @@
// +build linux
+// +build !static
// +build !android
// +build !no_openssl
// +build !cmd_go_bootstrap
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_evp_md5_sha1.c b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_evp_md5_sha1.c
index 2eedd5b..04510d3 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_evp_md5_sha1.c
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_evp_md5_sha1.c
@@ -1,4 +1,5 @@
// This file contains a backport of the EVP_md5_sha1 method.
+// +build !static
// +build linux
// +build !android
// +build !no_openssl
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_hmac.c b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_hmac.c
index 362d9e5..bebafef 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_hmac.c
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_hmac.c
@@ -1,4 +1,5 @@
// This file contains HMAC portability wrappers.
+// +build !static
// +build linux
// +build !android
// +build !no_openssl
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_rsa.c b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_rsa.c
index 2824147..8bc1d85 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_rsa.c
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_rsa.c
@@ -1,4 +1,5 @@
// This file contains RSA portability wrappers.
+// +build !static
// +build linux
// +build !android
// +build !no_openssl
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_stub_rand.c b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_stub_rand.c
index 22bd865..b7aa26b 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_stub_rand.c
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_stub_rand.c
@@ -1,4 +1,5 @@
// +build linux
+// +build !static
// +build !android
// +build !no_openssl
// +build !cmd_go_bootstrap
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/rand.go b/src/vendor/github.com/golang-fips/openssl-fips/openssl/rand.go
index b3668b8..dcdae70 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/rand.go
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/rand.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl
-// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl
+//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl && !static
+// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl,!static
package openssl
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/rsa.go b/src/vendor/github.com/golang-fips/openssl-fips/openssl/rsa.go
index 915c840..8623d9d 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/rsa.go
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/rsa.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl
-// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl
+//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl && !static
+// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl,!static
package openssl
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/sha.go b/src/vendor/github.com/golang-fips/openssl-fips/openssl/sha.go
index 0b55ced..57309c0 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/sha.go
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/sha.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl
-// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl
+//go:build linux && !android && !cmd_go_bootstrap && !msan && !no_openssl && !static
+// +build linux,!android,!cmd_go_bootstrap,!msan,!no_openssl,!static
package openssl

View File

@ -0,0 +1,13 @@
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index 36a20e8b2a..8c2dd1b44b 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -1125,7 +1125,7 @@ func (t *tester) registerCgoTests(heading string) {
} else {
panic("unknown linkmode with static build: " + linkmode)
}
- gt.tags = append(gt.tags, "static")
+ gt.tags = append(gt.tags, "static", "no_openssl")
}
gt.ldflags = strings.Join(ldflags, " ")

View File

@ -1,235 +0,0 @@
diff --git a/src/crypto/internal/boring/goopenssl.h b/src/crypto/internal/boring/goopenssl.h
index 3585458..ae1607b 100644
--- a/src/crypto/internal/boring/goopenssl.h
+++ b/src/crypto/internal/boring/goopenssl.h
@@ -667,6 +667,7 @@ typedef EVP_PKEY GO_EVP_PKEY;
DEFINEFUNC(GO_EVP_PKEY *, EVP_PKEY_new, (void), ())
DEFINEFUNC(void, EVP_PKEY_free, (GO_EVP_PKEY * arg0), (arg0))
DEFINEFUNC(int, EVP_PKEY_set1_RSA, (GO_EVP_PKEY * arg0, GO_RSA *arg1), (arg0, arg1))
+DEFINEFUNC(int, EVP_PKEY_set1_EC_KEY, (GO_EVP_PKEY * arg0, GO_EC_KEY *arg1), (arg0, arg1))
DEFINEFUNC(int, EVP_PKEY_verify,
(EVP_PKEY_CTX *ctx, const unsigned char *sig, unsigned int siglen, const unsigned char *tbs, size_t tbslen),
(ctx, sig, siglen, tbs, tbslen))
diff --git a/src/crypto/internal/boring/openssl_ecdsa_signature.c b/src/crypto/internal/boring/openssl_ecdsa_signature.c
index 4c14cc9..daa1252 100644
--- a/src/crypto/internal/boring/openssl_ecdsa_signature.c
+++ b/src/crypto/internal/boring/openssl_ecdsa_signature.c
@@ -9,19 +9,32 @@
int
_goboringcrypto_ECDSA_sign(EVP_MD* md, const uint8_t *msg, size_t msgLen, uint8_t *sig, unsigned int *slen, GO_EC_KEY *eckey)
{
+ int result;
EVP_PKEY *key = _goboringcrypto_EVP_PKEY_new();
- if (!_goboringcrypto_EVP_PKEY_assign_EC_KEY(key, eckey))
- return 0;
- return _goboringcrypto_EVP_sign(md, NULL, msg, msgLen, sig, slen, key);
+ if (!_goboringcrypto_EVP_PKEY_set1_EC_KEY(key, eckey)) {
+ result = 0;
+ goto err;
+ }
+ result = _goboringcrypto_EVP_sign(md, NULL, msg, msgLen, sig, slen, key);
+err:
+ _goboringcrypto_EVP_PKEY_free(key);
+ return result;
}
int
_goboringcrypto_ECDSA_verify(EVP_MD* md, const uint8_t *msg, size_t msgLen, const uint8_t *sig, unsigned int slen, GO_EC_KEY *eckey)
{
+ int result;
EVP_PKEY *key = _goboringcrypto_EVP_PKEY_new();
- if (!_goboringcrypto_EVP_PKEY_assign_EC_KEY(key, eckey))
- return 0;
+ if (!_goboringcrypto_EVP_PKEY_set1_EC_KEY(key, eckey)) {
+ result = 0;
+ goto err;
+ }
- return _goboringcrypto_EVP_verify(md, NULL, msg, msgLen, sig, slen, key);
+ result = _goboringcrypto_EVP_verify(md, NULL, msg, msgLen, sig, slen, key);
+
+err:
+ _goboringcrypto_EVP_PKEY_free(key);
+ return result;
}
diff --git a/src/crypto/internal/boring/openssl_port_rsa.c b/src/crypto/internal/boring/openssl_port_rsa.c
index a8d047d..2e56499 100644
--- a/src/crypto/internal/boring/openssl_port_rsa.c
+++ b/src/crypto/internal/boring/openssl_port_rsa.c
@@ -25,14 +25,13 @@ int _goboringcrypto_RSA_digest_and_sign_pss_mgf1(GO_RSA *rsa, unsigned int *out_
EVP_PKEY_CTX *ctx;
unsigned int siglen;
+ int ret = 0;
EVP_PKEY *key = _goboringcrypto_EVP_PKEY_new();
- if (!_goboringcrypto_EVP_PKEY_assign_RSA(key, rsa))
- return 0;
+ if (!_goboringcrypto_EVP_PKEY_set1_RSA(key, rsa))
+ goto err;
ctx = _goboringcrypto_EVP_PKEY_CTX_new(key, NULL /* no engine */);
if (!ctx)
- return 0;
-
- int ret = 0;
+ goto err;
EVP_MD_CTX *mdctx = NULL;
if (!(mdctx = _goboringcrypto_EVP_MD_CTX_create()))
@@ -67,6 +66,10 @@ int _goboringcrypto_RSA_digest_and_sign_pss_mgf1(GO_RSA *rsa, unsigned int *out_
err:
if (mdctx)
_goboringcrypto_EVP_MD_CTX_free(mdctx);
+ if (ctx)
+ _goboringcrypto_EVP_PKEY_CTX_free(ctx);
+ if (key)
+ _goboringcrypto_EVP_PKEY_free(key);
return ret;
}
@@ -78,18 +81,17 @@ int _goboringcrypto_RSA_sign_pss_mgf1(GO_RSA *rsa, unsigned int *out_len, uint8_
EVP_PKEY *pkey;
size_t siglen;
+ int ret = 0;
pkey = _goboringcrypto_EVP_PKEY_new();
if (!pkey)
- return 0;
+ goto err;
if (_goboringcrypto_EVP_PKEY_set1_RSA(pkey, rsa) <= 0)
- return 0;
-
+ goto err;
+
ctx = _goboringcrypto_EVP_PKEY_CTX_new(pkey, NULL /* no engine */);
if (!ctx)
- return 0;
-
- int ret = 0;
+ goto err;
if (_goboringcrypto_EVP_PKEY_sign_init(ctx) <= 0)
goto err;
@@ -101,7 +103,7 @@ int _goboringcrypto_RSA_sign_pss_mgf1(GO_RSA *rsa, unsigned int *out_len, uint8_
goto err;
if (_goboringcrypto_EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, mgf1_md) <= 0)
goto err;
-
+
/* Determine buffer length */
if (_goboringcrypto_EVP_PKEY_sign(ctx, NULL, &siglen, in, in_len) <= 0)
goto err;
@@ -116,7 +118,10 @@ int _goboringcrypto_RSA_sign_pss_mgf1(GO_RSA *rsa, unsigned int *out_len, uint8_
ret = 1;
err:
- _goboringcrypto_EVP_PKEY_CTX_free(ctx);
+ if (ctx)
+ _goboringcrypto_EVP_PKEY_CTX_free(ctx);
+ if (pkey)
+ _goboringcrypto_EVP_PKEY_free(pkey);
return ret;
}
@@ -130,14 +135,14 @@ int _goboringcrypto_RSA_verify_pss_mgf1(RSA *rsa, const uint8_t *msg, unsigned i
pkey = _goboringcrypto_EVP_PKEY_new();
if (!pkey)
- return 0;
+ goto err;
if (_goboringcrypto_EVP_PKEY_set1_RSA(pkey, rsa) <= 0)
- return 0;
-
+ goto err;
+
ctx = _goboringcrypto_EVP_PKEY_CTX_new(pkey, NULL /* no engine */);
if (!ctx)
- return 0;
+ goto err;
if (_goboringcrypto_EVP_PKEY_verify_init(ctx) <= 0)
goto err;
@@ -155,25 +160,40 @@ int _goboringcrypto_RSA_verify_pss_mgf1(RSA *rsa, const uint8_t *msg, unsigned i
ret = 1;
err:
- _goboringcrypto_EVP_PKEY_CTX_free(ctx);
+ if (ctx)
+ _goboringcrypto_EVP_PKEY_CTX_free(ctx);
+ if (pkey)
+ _goboringcrypto_EVP_PKEY_free(pkey);
+
return ret;
}
int _goboringcrypto_EVP_RSA_sign(EVP_MD *md, const uint8_t *msg, unsigned int msgLen, uint8_t *sig, unsigned int *slen, RSA *rsa)
{
+ int result;
EVP_PKEY *key = _goboringcrypto_EVP_PKEY_new();
- if (!_goboringcrypto_EVP_PKEY_assign_RSA(key, rsa))
- return 0;
- return _goboringcrypto_EVP_sign(md, NULL, msg, msgLen, sig, slen, key);
+ if (!_goboringcrypto_EVP_PKEY_set1_RSA(key, rsa)) {
+ result = 0;
+ goto err;
+ }
+ result = _goboringcrypto_EVP_sign(md, NULL, msg, msgLen, sig, slen, key);
+err:
+ _goboringcrypto_EVP_PKEY_free(key);
+ return result;
}
int _goboringcrypto_EVP_RSA_verify(EVP_MD *md, const uint8_t *msg, unsigned int msgLen, const uint8_t *sig, unsigned int slen, GO_RSA *rsa)
{
+ int result;
EVP_PKEY *key = _goboringcrypto_EVP_PKEY_new();
- if (!_goboringcrypto_EVP_PKEY_assign_RSA(key, rsa))
- {
- return 0;
+ if (!_goboringcrypto_EVP_PKEY_set1_RSA(key, rsa)) {
+ result = 0;
+ goto err;
}
- return _goboringcrypto_EVP_verify(md, NULL, msg, msgLen, sig, slen, key);
+ result = _goboringcrypto_EVP_verify(md, NULL, msg, msgLen, sig, slen, key);
+err:
+ _goboringcrypto_EVP_PKEY_free(key);
+ return result;
+
}
diff --git a/src/crypto/internal/boring/rsa.go b/src/crypto/internal/boring/rsa.go
index 2eefc27..698c08e 100644
--- a/src/crypto/internal/boring/rsa.go
+++ b/src/crypto/internal/boring/rsa.go
@@ -162,12 +162,23 @@ func setupRSA(withKey func(func(*C.GO_RSA) C.int) C.int,
return nil, nil, NewOpenSSLError("EVP_PKEY_set_rsa_oaep_md failed")
}
// ctx takes ownership of label, so malloc a copy for BoringCrypto to free.
- clabel := (*C.uint8_t)(C.malloc(C.size_t(len(label))))
- if clabel == nil {
- return nil, nil, fail("OPENSSL_malloc")
+ var clabel *C.uint8_t
+ clabel = nil
+ // OpenSSL 1.1.1 does not take ownership of the label if the length is zero.
+ // Depending on the malloc implementation, if clabel is allocated with malloc(0),
+ // metadata for the size-zero allocation is never cleaned up, which is a memory leak.
+ // As such, we must only allocate clabel if the label is of non zero length.
+ if len(label) > 0 {
+ clabel = (*C.uint8_t)(C.malloc(C.size_t(len(label))))
+ if clabel == nil {
+ return nil, nil, fail("OPENSSL_malloc")
+ }
+ copy((*[1 << 30]byte)(unsafe.Pointer(clabel))[:len(label)], label)
}
- copy((*[1 << 30]byte)(unsafe.Pointer(clabel))[:len(label)], label)
- if C._goboringcrypto_EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, clabel, C.int(len(label))) == 0 {
+ if C._goboringcrypto_EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, clabel, C.int(len(label))) != 1 {
+ if clabel != nil {
+ C.free(unsafe.Pointer(clabel))
+ }
return nil, nil, NewOpenSSLError("EVP_PKEY_CTX_set0_rsa_oaep_label failed")
}
}

View File

@ -0,0 +1,172 @@
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/ecdh.go b/src/vendor/github.com/golang-fips/openssl-fips/openssl/ecdh.go
index 56adf47bf6..9537870e3c 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/ecdh.go
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/ecdh.go
@@ -22,22 +22,10 @@ var (
type PublicKeyECDH struct {
_pkey *C.GO_EVP_PKEY
bytes []byte
-
- // priv is only set when PublicKeyECDH is derived from a private key,
- // in which case priv's finalizer is responsible for freeing _pkey.
- // This ensures priv is not finalized while the public key is alive,
- // which could cause use-after-free and double-free behavior.
- //
- // We could avoid this altogether by using EVP_PKEY_up_ref
- // when instantiating a derived public key, unfortunately
- // it is not available on OpenSSL 1.0.2.
- priv *PrivateKeyECDH
}
func (k *PublicKeyECDH) finalize() {
- if k.priv == nil {
- C._goboringcrypto_EVP_PKEY_free(k._pkey)
- }
+ C._goboringcrypto_EVP_PKEY_free(k._pkey)
}
type PrivateKeyECDH struct {
@@ -58,7 +46,7 @@ func NewPublicKeyECDH(curve string, bytes []byte) (*PublicKeyECDH, error) {
if err != nil {
return nil, err
}
- k := &PublicKeyECDH{pkey, append([]byte(nil), bytes...), nil}
+ k := &PublicKeyECDH{pkey, append([]byte(nil), bytes...)}
runtime.SetFinalizer(k, (*PublicKeyECDH).finalize)
return k, nil
}
@@ -87,14 +75,22 @@ func (k *PrivateKeyECDH) PublicKey() (*PublicKeyECDH, error) {
var bytes []byte
var cbytes *C.uchar
- n := C._goboringcrypto_EVP_PKEY_get1_encoded_ecdh_public_key(k._pkey, &cbytes)
+ pkey := C._goboringcrypto_EVP_PKEY_ref(k._pkey)
+ if pkey == nil {
+ return nil, NewOpenSSLError("EVP_PKEY_ref")
+ }
+ defer func() {
+ C._goboringcrypto_EVP_PKEY_free(pkey)
+ }()
+ n := C._goboringcrypto_EVP_PKEY_get1_encoded_ecdh_public_key(pkey, &cbytes)
if n == 0 {
return nil, NewOpenSSLError("EVP_PKEY_get1_encoded_ecdh_public_key")
}
bytes = C.GoBytes(unsafe.Pointer(cbytes), C.int(n))
C.free(unsafe.Pointer(cbytes))
- pub := &PublicKeyECDH{k._pkey, bytes, k}
+ pub := &PublicKeyECDH{pkey, bytes}
+ pkey = nil
runtime.SetFinalizer(pub, (*PublicKeyECDH).finalize)
return pub, nil
}
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/goopenssl.h b/src/vendor/github.com/golang-fips/openssl-fips/openssl/goopenssl.h
index a900b3f9e7..03367d5520 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/goopenssl.h
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/goopenssl.h
@@ -827,6 +827,9 @@ DEFINEFUNC(GO_EVP_PKEY *, EVP_PKEY_new, (void), ())
DEFINEFUNC(void, EVP_PKEY_free, (GO_EVP_PKEY * arg0), (arg0))
DEFINEFUNC(int, EVP_PKEY_set1_RSA, (GO_EVP_PKEY * arg0, GO_RSA *arg1), (arg0, arg1))
DEFINEFUNC(int, EVP_PKEY_set1_EC_KEY, (GO_EVP_PKEY * arg0, GO_EC_KEY *arg1), (arg0, arg1))
+DEFINEFUNC(const GO_EC_KEY *, EVP_PKEY_get0_EC_KEY, (const GO_EVP_PKEY *pkey), (pkey))
+GO_EVP_PKEY *_goboringcrypto_EVP_PKEY_ref(GO_EVP_PKEY *pkey);
+
DEFINEFUNC(int, EVP_PKEY_verify,
(EVP_PKEY_CTX *ctx, const unsigned char *sig, unsigned int siglen, const unsigned char *tbs, size_t tbslen),
(ctx, sig, siglen, tbs, tbslen))
@@ -1083,15 +1086,6 @@ enum {
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
DEFINEFUNC(int, EVP_PKEY_set1_encoded_public_key, (GO_EVP_PKEY *pkey, const unsigned char *pub, size_t publen), (pkey, pub, publen))
DEFINEFUNC(size_t, EVP_PKEY_get1_encoded_public_key, (GO_EVP_PKEY *pkey, unsigned char **ppub), (pkey, ppub))
-
-DEFINEFUNC(const GO_EC_KEY *, EVP_PKEY_get0_EC_KEY, (const GO_EVP_PKEY *pkey), (pkey))
-#else
-DEFINEFUNCINTERNAL(void *, EVP_PKEY_get0, (const GO_EVP_PKEY *pkey), (pkey))
-static const GO_EC_KEY *
-_goboringcrypto_EVP_PKEY_get0_EC_KEY(const GO_EVP_PKEY *pkey)
-{
- return _goboringcrypto_internal_EVP_PKEY_get0(pkey);
-}
#endif
GO_EVP_PKEY *_goboringcrypto_EVP_PKEY_new_for_ecdh(int nid, const uint8_t *bytes, size_t len, int is_private);
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_evp.c b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_evp.c
index 24a9615108..c6b23a984b 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_evp.c
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_evp.c
@@ -5,6 +5,7 @@
// +build !msan
#include "goopenssl.h"
+#include <assert.h>
int _goboringcrypto_EVP_sign(EVP_MD *md, EVP_PKEY_CTX *ctx, const uint8_t *msg,
size_t msgLen, uint8_t *sig, size_t *slen,
@@ -138,3 +139,52 @@ err:
return ret;
}
+
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+DEFINEFUNCINTERNAL(int, EVP_PKEY_up_ref, (GO_EVP_PKEY *pkey), (pkey))
+
+GO_EVP_PKEY *
+_goboringcrypto_EVP_PKEY_ref(GO_EVP_PKEY *pkey)
+{
+ if (_goboringcrypto_internal_EVP_PKEY_up_ref(pkey) != 1)
+ return NULL;
+
+ return pkey;
+}
+
+#else
+GO_EVP_PKEY *
+_goboringcrypto_EVP_PKEY_ref(GO_EVP_PKEY *pkey)
+{
+ GO_EVP_PKEY *result = NULL;
+
+ if (pkey->type != EVP_PKEY_EC && pkey->type != EVP_PKEY_RSA)
+ return NULL;
+
+ result = _goboringcrypto_EVP_PKEY_new();
+ if (!result)
+ goto err;
+
+ switch (pkey->type) {
+ case EVP_PKEY_EC:
+ if (_goboringcrypto_EVP_PKEY_set1_EC_KEY(result, _goboringcrypto_EVP_PKEY_get0_EC_KEY()) != 1)
+ goto err;
+ break;
+
+ case EVP_PKEY_RSA:
+ if (_goboringcrypto_EVP_PKEY_set1_RSA_KEY(result, _goboringcrypto_EVP_PKEY_get0_RSA_KEY()) != 1)
+ goto err;
+
+ break;
+
+ default:
+ assert(0);
+ }
+
+ return result;
+
+err:
+ _goboringcrypto_EVP_PKEY_free(result);
+ return NULL;
+}
+#endif
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/rsa.go b/src/vendor/github.com/golang-fips/openssl-fips/openssl/rsa.go
index 75ba7a8a59..1e016676a0 100644
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/rsa.go
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/rsa.go
@@ -116,7 +116,9 @@ func (k *PrivateKeyRSA) withKey(f func(*C.GO_RSA) C.int) C.int {
func setupRSA(withKey func(func(*C.GO_RSA) C.int) C.int,
padding C.int, h hash.Hash, label []byte, saltLen int, ch crypto.Hash,
- init func(*C.GO_EVP_PKEY_CTX) C.int) (pkey *C.GO_EVP_PKEY, ctx *C.GO_EVP_PKEY_CTX, err error) {
+ init func(*C.GO_EVP_PKEY_CTX) C.int) (_ *C.GO_EVP_PKEY,_ *C.GO_EVP_PKEY_CTX, err error) {
+ var pkey *C.GO_EVP_PKEY
+ var ctx *C.GO_EVP_PKEY_CTX
defer func() {
if err != nil {
if pkey != nil {

View File

@ -1,5 +1,5 @@
diff --git a/src/cmd/go/testdata/script/list_std.txt b/src/cmd/go/testdata/script/list_std.txt
index 6ab1bd1674..4a00e436fd 100644
index 6ab1bd1..4a00e43 100644
--- a/src/cmd/go/testdata/script/list_std.txt
+++ b/src/cmd/go/testdata/script/list_std.txt
@@ -6,7 +6,7 @@ env GO111MODULE=off

View File

@ -1,70 +0,0 @@
diff -up go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/internal_test.go.time go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/internal_test.go
--- go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/internal_test.go.time 2017-12-05 01:10:10.000000000 +0100
+++ go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/internal_test.go 2017-12-05 14:55:10.574637475 +0100
@@ -4,13 +4,15 @@
package time
+import "runtime"
+
func init() {
// force US/Pacific for time zone tests
ForceUSPacificForTesting()
}
func initTestingZone() {
- z, err := loadLocation("America/Los_Angeles", zoneSources[len(zoneSources)-1:])
+ z, err := loadLocation("America/Los_Angeles", zoneSources)
if err != nil {
panic("cannot load America/Los_Angeles for testing: " + err.Error())
}
@@ -21,8 +23,9 @@ func initTestingZone() {
var OrigZoneSources = zoneSources
func forceZipFileForTesting(zipOnly bool) {
- zoneSources = make([]string, len(OrigZoneSources))
+ zoneSources = make([]string, len(OrigZoneSources)+1)
copy(zoneSources, OrigZoneSources)
+ zoneSources = append(zoneSources, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
if zipOnly {
zoneSources = zoneSources[len(zoneSources)-1:]
}
diff -up go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_test.go.time go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_test.go
--- go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_test.go.time 2017-12-05 01:10:10.000000000 +0100
+++ go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_test.go 2017-12-05 14:58:09.823109248 +0100
@@ -8,6 +8,7 @@ import (
"fmt"
"os"
"reflect"
+ "runtime"
"testing"
"time"
)
@@ -128,7 +129,7 @@ func TestLoadLocationFromTZData(t *testi
t.Fatal(err)
}
- tzinfo, err := time.LoadTzinfo(locationName, time.OrigZoneSources[len(time.OrigZoneSources)-1])
+ tzinfo, err := time.LoadTzinfo(locationName, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
if err != nil {
t.Fatal(err)
}
diff -up go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_unix.go.time go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_unix.go
--- go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_unix.go.time 2017-12-05 01:10:10.000000000 +0100
+++ go-dd7cbf3a846c2cb125ac65173abaf6a8b9f903ff/src/time/zoneinfo_unix.go 2017-12-05 14:55:10.574637475 +0100
@@ -12,7 +12,6 @@
package time
import (
- "runtime"
"syscall"
)
@@ -22,7 +21,6 @@ var zoneSources = []string{
"/usr/share/zoneinfo/",
"/usr/share/lib/zoneinfo/",
"/usr/lib/locale/TZ/",
- runtime.GOROOT() + "/lib/time/zoneinfo.zip",
}
func initLocal() {

View File

@ -1,25 +0,0 @@
diff --git a/src/crypto/x509/verify.go b/src/crypto/x509/verify.go
index 50f4d4a..121fd1b 100644
--- a/src/crypto/x509/verify.go
+++ b/src/crypto/x509/verify.go
@@ -20,6 +20,9 @@ import (
// ignoreCN disables interpreting Common Name as a hostname. See issue 24151.
var ignoreCN = !strings.Contains(os.Getenv("GODEBUG"), "x509ignoreCN=0")
+// if using Common Name as a hostname is enabled via x509ignoreCN=0,
+// warnCN enables a warning whenever Common Name is interpreted as a hostname.
+var warnCN = strings.Contains(os.Getenv("GODEBUG"), "x509warnCN=1")
type InvalidReason int
@@ -1078,6 +1081,10 @@ func (c *Certificate) VerifyHostname(h string) error {
names := c.DNSNames
if c.commonNameAsHostname() {
names = []string{c.Subject.CommonName}
+ if warnCN {
+ fmt.Fprintf(os.Stderr, "x509: Warning - certificate relies on legacy Common Name field. " +
+ "Using CN without SAN is deprecated and will not work in future versions.\n")
+ }
}
candidateName := toLowerCaseASCII(h) // Save allocations inside the loop.

View File

@ -0,0 +1,22 @@
From eab9004c072200e58df83ab94678bda1faa7b229 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= <asm@redhat.com>
Date: Fri, 9 Feb 2024 20:06:16 +0100
Subject: [PATCH] Set GOTOOLCHAIN to local
---
go.env | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/go.env b/go.env
index 6ff2b921d4..e87f6e7b6d 100644
--- a/go.env
+++ b/go.env
@@ -9,4 +9,4 @@ GOSUMDB=sum.golang.org
# Automatically download newer toolchains as directed by go.mod files.
# See https://go.dev/doc/toolchain for details.
-GOTOOLCHAIN=auto
+GOTOOLCHAIN=local
--
2.43.0

View File

@ -1,109 +0,0 @@
diff --git a/doc/go1.16.html b/doc/go1.16.html
index 0beb62d..fc6b668 100644
--- a/doc/go1.16.html
+++ b/doc/go1.16.html
@@ -891,6 +891,14 @@ func TestFoo(t *testing.T) {
is missing; this is common on musl-based systems and makes
Go programs match the behavior of C programs on those systems.
</p>
+ <p><!-- CL325829 -->
+ The <a href="/pkg/net/#ParseIP"><code>ParseIP</code></a> and <a href="/pkg/net/#ParseCIDR"><code>ParseCIDR</code></a>
+ functions now reject IPv4 addresses which contain decimal components with leading zeros.
+ These components were always interpreted as decimal, but some operating systems treat them as octal.
+ This mismatch could hypothetically lead to security issues if a Go application was used to validate IP addresses
+ which were then used in their original form with non-Go applications which interpreted components as octal. Generally,
+ it is advisable to always re-encoded values after validation, which avoids this class of parser misalignment issues.
+ </p>
</dd>
</dl><!-- net -->
diff --git a/src/net/hosts_test.go b/src/net/hosts_test.go
index f850e2f..19c4399 100644
--- a/src/net/hosts_test.go
+++ b/src/net/hosts_test.go
@@ -36,7 +36,7 @@ var lookupStaticHostTests = []struct {
},
},
{
- "testdata/ipv4-hosts", // see golang.org/issue/8996
+ "testdata/ipv4-hosts",
[]staticHostEntry{
{"localhost", []string{"127.0.0.1", "127.0.0.2", "127.0.0.3"}},
{"localhost.localdomain", []string{"127.0.0.3"}},
@@ -102,7 +102,7 @@ var lookupStaticAddrTests = []struct {
},
},
{
- "testdata/ipv4-hosts", // see golang.org/issue/8996
+ "testdata/ipv4-hosts",
[]staticHostEntry{
{"127.0.0.1", []string{"localhost"}},
{"127.0.0.2", []string{"localhost"}},
diff --git a/src/net/ip.go b/src/net/ip.go
index c00fe8e..007f3f7 100644
--- a/src/net/ip.go
+++ b/src/net/ip.go
@@ -552,6 +552,10 @@ func parseIPv4(s string) IP {
if !ok || n > 0xFF {
return nil
}
+ if c > 1 && s[0] == '0' {
+ // Reject non-zero components with leading zeroes.
+ return nil
+ }
s = s[c:]
p[i] = byte(n)
}
diff --git a/src/net/ip_test.go b/src/net/ip_test.go
index a5fc5e6..585381d 100644
--- a/src/net/ip_test.go
+++ b/src/net/ip_test.go
@@ -20,9 +20,7 @@ var parseIPTests = []struct {
}{
{"127.0.1.2", IPv4(127, 0, 1, 2)},
{"127.0.0.1", IPv4(127, 0, 0, 1)},
- {"127.001.002.003", IPv4(127, 1, 2, 3)},
{"::ffff:127.1.2.3", IPv4(127, 1, 2, 3)},
- {"::ffff:127.001.002.003", IPv4(127, 1, 2, 3)},
{"::ffff:7f01:0203", IPv4(127, 1, 2, 3)},
{"0:0:0:0:0000:ffff:127.1.2.3", IPv4(127, 1, 2, 3)},
{"0:0:0:0:000000:ffff:127.1.2.3", IPv4(127, 1, 2, 3)},
@@ -42,6 +40,11 @@ var parseIPTests = []struct {
{"fe80::1%911", nil},
{"", nil},
{"a1:a2:a3:a4::b1:b2:b3:b4", nil}, // Issue 6628
+ {"127.001.002.003", nil},
+ {"::ffff:127.001.002.003", nil},
+ {"123.000.000.000", nil},
+ {"1.2..4", nil},
+ {"0123.0.0.1", nil},
}
func TestParseIP(t *testing.T) {
@@ -357,6 +360,7 @@ var parseCIDRTests = []struct {
{"0.0.-2.0/32", nil, nil, &ParseError{Type: "CIDR address", Text: "0.0.-2.0/32"}},
{"0.0.0.-3/32", nil, nil, &ParseError{Type: "CIDR address", Text: "0.0.0.-3/32"}},
{"0.0.0.0/-0", nil, nil, &ParseError{Type: "CIDR address", Text: "0.0.0.0/-0"}},
+ {"127.000.000.001/32", nil, nil, &ParseError{Type: "CIDR address", Text: "127.000.000.001/32"}},
{"", nil, nil, &ParseError{Type: "CIDR address", Text: ""}},
}
diff --git a/src/net/testdata/ipv4-hosts b/src/net/testdata/ipv4-hosts
index 5208bb4..6b99675 100644
--- a/src/net/testdata/ipv4-hosts
+++ b/src/net/testdata/ipv4-hosts
@@ -1,12 +1,8 @@
# See https://tools.ietf.org/html/rfc1123.
-#
-# The literal IPv4 address parser in the net package is a relaxed
-# one. It may accept a literal IPv4 address in dotted-decimal notation
-# with leading zeros such as "001.2.003.4".
# internet address and host name
127.0.0.1 localhost # inline comment separated by tab
-127.000.000.002 localhost # inline comment separated by space
+127.0.0.2 localhost # inline comment separated by space
# internet address, host name and aliases
-127.000.000.003 localhost localhost.localdomain
+127.0.0.3 localhost localhost.localdomain

View File

@ -0,0 +1,15 @@
diff --git a/src/crypto/rsa/pkcs1v15_test.go b/src/crypto/rsa/pkcs1v15_test.go
index 0853178e3a..16eb37734b 100644
--- a/src/crypto/rsa/pkcs1v15_test.go
+++ b/src/crypto/rsa/pkcs1v15_test.go
@@ -247,6 +247,10 @@ func TestVerifyPKCS1v15(t *testing.T) {
}
func TestOverlongMessagePKCS1v15(t *testing.T) {
+ // OpenSSL now returns a random string instead of an error
+ if boring.Enabled() {
+ t.Skip("Not relevant in boring mode")
+ }
ciphertext := decodeBase64("fjOVdirUzFoLlukv80dBllMLjXythIf22feqPrNo0YoIjzyzyoMFiLjAc/Y4krkeZ11XFThIrEvw\nkRiZcCq5ng==")
_, err := DecryptPKCS1v15(nil, rsaPrivateKey, ciphertext)
if err == nil {

View File

@ -1,8 +1,8 @@
diff --git a/src/crypto/x509/x509_test.go b/src/crypto/x509/x509_test.go
index 51dda16815..2d1e1b1e6e 100644
index b1cdabb..09eaace 100644
--- a/src/crypto/x509/x509_test.go
+++ b/src/crypto/x509/x509_test.go
@@ -2880,6 +2880,7 @@ func (bs *brokenSigner) Sign(_ io.Reader, _ []byte, _ crypto.SignerOpts) ([]byte
@@ -2993,6 +2993,7 @@ func (bs *brokenSigner) Sign(_ io.Reader, _ []byte, _ crypto.SignerOpts) ([]byte
}
func TestCreateCertificateBrokenSigner(t *testing.T) {

View File

@ -56,7 +56,7 @@
%endif
# Controls what ever we fail on failed tests
%ifarch x86_64 %{arm} aarch64 ppc64le
%ifarch x86_64 %{arm} ppc64le s390x
%global fail_on_tests 1
%else
%global fail_on_tests 0
@ -69,12 +69,8 @@
%global shared 0
%endif
# Pre build std lib with -race enabled
%ifarch x86_64
%global race 1
%else
# Disabled due to 1.20 new cache usage, see 1.20 upstream release notes
%global race 0
%endif
%ifarch x86_64
%global gohostarch amd64
@ -95,20 +91,28 @@
%global gohostarch s390x
%endif
%global go_api 1.16
%global go_version 1.16.7
%global go_api 1.21
%global version 1.21.9
%global pkg_release 1
Name: golang
Version: %{go_version}
Version: %{version}
Release: 1%{?dist}
Summary: The Go Programming Language
# source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain
License: BSD and Public Domain
URL: http://golang.org/
Source0: https://pagure.io/go/archive/go-%{go_version}-%{pkg_release}-openssl-fips/go-go-%{go_version}-%{pkg_release}-openssl-fips.tar.gz
Source0: https://github.com/golang/go/archive/refs/tags/go%{version}.tar.gz
# Go's FIPS mode bindings are now provided as a standalone
# module instead of in tree. This makes it easier to see
# the actual changes vs upstream Go. The module source is
# located at https://github.com/golang-fips/openssl-fips,
# And pre-genetated patches to set up the module for a given
# Go release are located at https://github.com/golang-fips/go.
Source1: https://github.com/golang-fips/go/archive/refs/tags/go%{version}-%{pkg_release}-openssl-fips.tar.gz
# make possible to override default traceback level at build time by setting build tag rpm_crashtraceback
Source1: fedora.go
Source2: fedora.go
# The compiler is written in Go. Needs go(1.4+) compiler for build.
# Actual Go based bootstrap compiler provided by above source.
@ -133,27 +137,16 @@ Requires: %{name}-src = %{version}-%{release}
Requires: openssl-devel
Requires: diffutils
# we had been just removing the zoneinfo.zip, but that caused tests to fail for users that
# later run `go test -a std`. This makes it only use the zoneinfo.zip where needed in tests.
Patch215: go1.5-zoneinfo_testing_only.patch
# Proposed patch by jcajka https://golang.org/cl/86541
Patch221: fix_TestScript_list_std.patch
# Add an env var to optionally trigger a warning in x509 when
# Common Name is used as hostname
# rhbz#1889437
Patch223: golang-1.15-warnCN.patch
# Fix incorrect parsing of extraneous zeros in net/ip
# https://bugzilla.redhat.com/show_bug.cgi?id=1993316
# https://go-review.googlesource.com/c/go/+/325829
Patch1993316: reject-leading-zeros.patch
Patch229: fix-memleak-setupRSA.patch
Patch1939923: skip_test_rhbz1939923.patch
# Fix FIPS mode memory leaks
Patch1951877: fix-crypto-memory-leaks.patch
Patch2: disable_static_tests_part1.patch
Patch3: disable_static_tests_part2.patch
Patch4: skip-test-overlong-message.patch
Patch5: modify_go.env.patch
# Having documentation separate was broken
Obsoletes: %{name}-docs < 1.1-4
@ -161,6 +154,9 @@ Obsoletes: %{name}-docs < 1.1-4
# RPM can't handle symlink -> dir with subpackages, so merge back
Obsoletes: %{name}-data < 1.1.1-4
# We don't build golang-race anymore, rhbz#2230599
Obsoletes: golang-race < 1.20.0
# These are the only RHEL/Fedora architectures that we compile this package for
ExclusiveArch: %{golang_arches}
@ -242,22 +238,26 @@ Requires: %{name} = %{version}-%{release}
%endif
%prep
%setup -q -n go-go-%{go_version}-%{pkg_release}-openssl-fips
%setup -q -n go-go%{version}
%patch215 -p1
pushd ..
tar -xf %{SOURCE1}
popd
patch -p1 < ../go-go%{version}-%{pkg_release}-openssl-fips/patches/000-initial-setup.patch
patch -p1 < ../go-go%{version}-%{pkg_release}-openssl-fips/patches/001-initial-openssl-for-fips.patch
patch -p1 < ../go-go%{version}-%{pkg_release}-openssl-fips/patches/002-strict-fips-runtime-detection.patch
%patch221 -p1
# Configure crypto tests
pushd ../go-go%{version}-%{pkg_release}-openssl-fips
ln -s ../go-go%{version} go
./scripts/configure-crypto-tests.sh
popd
%patch223 -p1
%autopatch -p1
%patch1939923 -p1
sed -i '1s/$/ (%{?rhel:Red Hat} %{version}-%{release})/' VERSION
%patch1993316 -p1
%patch1951877 -p1
cp %{SOURCE1} ./src/runtime/
cp %{SOURCE2} ./src/runtime/
%build
set -xe
@ -326,7 +326,7 @@ rm -rf pkg/bootstrap/bin
# install everything into libdir (until symlink problems are fixed)
# https://code.google.com/p/go/issues/detail?id=5830
cp -apv api bin doc favicon.ico lib pkg robots.txt src misc test VERSION \
cp -apv api bin doc lib pkg src misc test go.env VERSION \
$RPM_BUILD_ROOT%{goroot}
# bz1099206
@ -339,12 +339,11 @@ cwd=$(pwd)
src_list=$cwd/go-src.list
pkg_list=$cwd/go-pkg.list
shared_list=$cwd/go-shared.list
race_list=$cwd/go-race.list
misc_list=$cwd/go-misc.list
docs_list=$cwd/go-docs.list
tests_list=$cwd/go-tests.list
rm -f $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list $race_list
touch $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list $race_list
rm -f $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list
touch $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list
pushd $RPM_BUILD_ROOT%{goroot}
find src/ -type d -a \( ! -name testdata -a ! -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $src_list
find src/ ! -type d -a \( ! -ipath '*/testdata/*' -a ! -name '*_test*.go' \) -printf '%{goroot}/%p\n' >> $src_list
@ -375,13 +374,6 @@ pushd $RPM_BUILD_ROOT%{goroot}
find pkg/*_dynlink/ ! -type d -printf '%{goroot}/%p\n' >> $shared_list
%endif
%if %{race}
find pkg/*_race/ -type d -printf '%%%dir %{goroot}/%p\n' >> $race_list
find pkg/*_race/ ! -type d -printf '%{goroot}/%p\n' >> $race_list
%endif
find test/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
find test/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
find src/ -type d -a \( -name testdata -o -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $tests_list
@ -414,6 +406,9 @@ cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang.gdb
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d
cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf
# Quick fix for the rhbz#2014704
sed -i 's/const defaultGO_LDSO = `.*`/const defaultGO_LDSO = ``/' $RPM_BUILD_ROOT%{goroot}/src/internal/buildcfg/zbootstrap.go
%check
export GOROOT=$(pwd -P)
export PATH="$GOROOT"/bin:"$PATH"
@ -448,6 +443,9 @@ export GO_TEST_RUN=""
%if %{fail_on_tests}
# TestEd25519Vectors needs network connectivity but it should be cover by
# this test https://pkgs.devel.redhat.com/cgit/tests/golang/tree/Regression/internal-testsuite/runtest.sh#n127
./run.bash --no-rebuild -v -v -v -k $GO_TEST_RUN
# Run tests with FIPS enabled.
@ -469,7 +467,7 @@ cd ..
%files
%doc AUTHORS CONTRIBUTORS LICENSE PATENTS
%doc LICENSE PATENTS
# VERSION has to be present in the GOROOT, for `go install std` to work
%doc %{goroot}/VERSION
%dir %{goroot}/doc
@ -513,16 +511,158 @@ cd ..
%files -f go-pkg.list bin
%{_bindir}/go
%{_bindir}/gofmt
%{goroot}/go.env
%if %{shared}
%files -f go-shared.list shared
%endif
%if %{race}
%files -f go-race.list race
%endif
%changelog
* Fri Apr 12 2024 David Benoit <dbenoit@redhat.com> - 1.21.9-1
- Fix CVE-2023-45288
- Resolves: RHEL-31915
* Mon Apr 1 2024 Archana Ravindar <aravinda@redhat.com> - 1.21.7-2
- Fix CVE-2024-1394
- Resolves RHEL-24300
* Tue Feb 13 2024 Alejandro Sáez <asm@redhat.com> - 1.21.7-1
- Rebase to Go 1.21.7
- Add release information
- Set GOTOOLCHAIN to local
- Skip TestOverlongMessagePKCS1v15
- Resolves: RHEL-24082
- Resolves: RHEL-18363
- Resolves: RHEL-18382
* Wed Nov 08 2023 David Benoit <dbenoit@redhat.com> - 1.21.3-4
- Do not remove GOPROXY/GOSUMDB
- Related: RHEL-12620
* Thu Nov 02 2023 David Benoit <dbenoit@redhat.com> - 1.21.3-3
- Fix go.env in Go 1.21
- Related: RHEL-12620
* Tue Oct 31 2023 Archana Ravindar <aravinda@redhat.com> - 1.21.3-2
- Rebase disable_static_tests_part2.patch to Go 1.21.3
- Add missing strict fips runtime detection patch
- Temporarily disable FIPS tests on aarch64 due to builder kernel bugs
- Remove fix-memory-leak patch as it is fixed upstream
- Resolves: RHEL-12620
* Fri Oct 20 2023 Archana Ravindar <aravinda@redhat.com> - 1.21.3-1
- Rebase Go to 1.21.3
- Resolves: RHEL-12620
* Mon Aug 14 2023 Alejandro Sáez <asm@redhat.com> - 1.20.6-2
- Retire golang-race package
- Resolves: rhbz#2230599
* Tue Jul 25 2023 Alejandro Sáez <asm@redhat.com> - 1.20.6-1
- Rebase to Go 1.20.6
- Resolves: rhbz#2217596
* Mon May 29 2023 Alejandro Sáez <asm@redhat.com> - 1.20.4-1
- Rebase to Go 1.20.4
- Resolves: rhbz#2204474
* Tue Apr 11 2023 David Benoit <dbenoit@redhat.com> - 1.20.3-1
- Rebase to Go 1.20.3
- Remove race archives
- Update static tests patches
- Resolves: rhbz#2185260
* Tue Jan 3 2023 David Benoit <dbenoit@redhat.com> - 1.19.4-2
- Fix memory leaks in EVP_{sign,verify}_raw
- Resolves: rhbz#2132767
* Wed Dec 21 2022 David Benoit <dbenoit@redhat.com> - 1.19.4-1
- Rebase to Go 1.19.4
- Fix ppc64le linker issue
- Remove defunct patches
- Remove downstream generated FIPS mode patches
- Add golang-fips/go as the source for FIPS mode patches
- Resolves: rhbz#2144542
* Mon Oct 17 2022 David Benoit <dbenoit@redhat.com> - 1.19.2-4
- Enable big endian support in FIPS mode
- Resolves: rhbz#1969844
* Mon Oct 17 2022 David Benoit <dbenoit@redhat.com> - 1.19.2-3
- Restore old HashSign/HashVerify API
- Resolves: rhbz#2132730
* Mon Oct 17 2022 David Benoit <dbenoit@redhat.com> - 1.19.2-2
- Add support for 4096 bit keys in x509
- Resolves: rhbz#2132694
* Thu Oct 13 2022 David Benoit <dbenoit@redhat.com> - 1.19.2-1
- Rebase to Go 1.19.2
- Resolves: rhbz#2132730
* Wed Sep 14 2022 David Benoit <dbenoit@redhat.com> - 1.19.1-2
- Rebase to Go 1.19.1
- Resolves: rhbz#2131026
* Wed Aug 03 2022 Alejandro Sáez <asm@redhat.com> - 1.18.4-2
- Adds patch for PIE mode issues on PPC64LE
- Resolves: rhbz#2111593
* Wed Jul 20 2022 David Benoit <dbenoit@redhat.com> - 1.18.4-1
- Update Go to version 1.18.4
- Resolves: rhbz#2109179
* Wed Jul 20 2022 David Benoit <dbenoit@redhat.com> - 1.18.2-3
- Clean up dist-git patches
- Resolves: rhbz#2109175
* Thu Jul 07 2022 Alejandro Sáez <asm@redhat.com> - 1.18.2-2
- Bump up release version
- Related: rhbz#2075162
* Thu Jun 16 2022 David Benoit <dbenoit@redhat.com> - 1.18.2-1
- Update to Go 1.18.2
- Related: rhbz#2075162
* Mon Apr 18 2022 David Benoit <dbenoit@redhat.com> - 1.18.0-2
- Enable SHA1 in some contexts
- Related: rhbz#2075162
* Wed Apr 13 2022 David Benoit <dbenoit@redhat.com> - 1.18.0-1
- Update Go to 1.18.0
- Resolves: rhbz#2075162
* Thu Feb 17 2022 David Benoit <dbenoit@redhat.com> - 1.17.7-1
- Rebase to Go 1.17.7
- Remove fips memory leak patch (fixed in tree)
- Resolves: rhbz#2015930
* Fri Dec 10 2021 David Benoit <dbenoit@redhat.com> - 1.17.5-1
- Rebase to Go 1.17.5
- Remove vdso_s390x_gettime patch
- Resolves: rhbz#2031112
- Related: rhbz#2028570
* Fri Dec 03 2021 David Benoit <dbenoit@redhat.com> - 1.17.4-1
- Rebase Go to 1.17.4
- Add remove_waitgroup_misuse_tests patch
- Related: rhbz#2014088
- Resolves: rhbz#2028570
- Resolves: rhbz#2022828
- Resolves: rhbz#2024686
- Resolves: rhbz#2028662
* Wed Oct 27 2021 Alejandro Sáez <asm@redhat.com> - 1.17.2-2
- Resolves: rhbz#2014704
* Tue Oct 12 2021 Alejandro Sáez <asm@redhat.com> - 1.17.2-1
- Rebase to Go 1.17.2
- Related: rhbz#2014088
- Remove golang-1.15-warnCN.patch
- Remove reject-leading-zeros.patch
- Remove favicon.ico and robots.txt references
- Exclude TestEd25519Vectors test
* Tue Aug 17 2021 David Benoit <dbenoit@redhat.com> - 1.16.7-1
- Rebase to Go 1.16.7
- Resolves: rhbz#1994079