Skip to content

Commit 9a8b646

Browse files
authored
Merge pull request #1389 from microsoft/dev/qmuntal/go1.23-upgrade
[release-branch.go1.23] Upgrade golang-fips/openssl to 4bcac10661a9
2 parents 550d4d1 + adc145e commit 9a8b646

File tree

3 files changed

+36
-24
lines changed

3 files changed

+36
-24
lines changed

patches/0004-Add-OpenSSL-crypto-backend.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ index 789f5aaa1d3e26..14ced0e416fde8 100644
721721
go 1.23
722722

723723
require (
724-
+ github.com/golang-fips/openssl/v2 v2.0.4-0.20240909165545-0a2f211a8f95
724+
+ github.com/golang-fips/openssl/v2 v2.0.4-0.20241106131105-4bcac10661a9
725725
golang.org/x/crypto v0.23.1-0.20240603234054-0b431c7de36a
726726
golang.org/x/net v0.25.1-0.20240603202750-6249541f2a6c
727727
)
@@ -730,8 +730,8 @@ index a75ea98c7312df..9fad90e123a9f6 100644
730730
--- a/src/go.sum
731731
+++ b/src/go.sum
732732
@@ -1,3 +1,5 @@
733-
+github.com/golang-fips/openssl/v2 v2.0.4-0.20240909165545-0a2f211a8f95 h1:e+JGYwsNT8K58Z9JysRNadrPzxNlGf+0wQXcdlHiv5M=
734-
+github.com/golang-fips/openssl/v2 v2.0.4-0.20240909165545-0a2f211a8f95/go.mod h1:7tuBqX2Zov8Yq5mJ2yzlKhpnxOnWyEzi38AzeWRuQdg=
733+
+github.com/golang-fips/openssl/v2 v2.0.4-0.20241106131105-4bcac10661a9 h1:LSalTbQ1mC7dgzyVZTvgVBV3RY503kOtn5iIvIXTBvY=
734+
+github.com/golang-fips/openssl/v2 v2.0.4-0.20241106131105-4bcac10661a9/go.mod h1:7tuBqX2Zov8Yq5mJ2yzlKhpnxOnWyEzi38AzeWRuQdg=
735735
golang.org/x/crypto v0.23.1-0.20240603234054-0b431c7de36a h1:37MIv+iGfwMYzWJECGyrPCtd5nuqcciRUeJfkNCkCf0=
736736
golang.org/x/crypto v0.23.1-0.20240603234054-0b431c7de36a/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
737737
golang.org/x/net v0.25.1-0.20240603202750-6249541f2a6c h1:CR/7/SLUhIJw6g675eeoDiwggElO2MV9rGkNYjqi8GM=

patches/0005-Add-CNG-crypto-backend.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ index 14ced0e416fde8..41ff48ef919672 100644
11291129
@@ -4,6 +4,7 @@ go 1.23
11301130

11311131
require (
1132-
github.com/golang-fips/openssl/v2 v2.0.4-0.20240909165545-0a2f211a8f95
1132+
github.com/golang-fips/openssl/v2 v2.0.4-0.20241106131105-4bcac10661a9
11331133
+ github.com/microsoft/go-crypto-winnative v0.0.0-20240925170411-b29b5cde7fdd
11341134
golang.org/x/crypto v0.23.1-0.20240603234054-0b431c7de36a
11351135
golang.org/x/net v0.25.1-0.20240603202750-6249541f2a6c
@@ -1139,8 +1139,8 @@ index 9fad90e123a9f6..acdcbd6cd5bcb2 100644
11391139
--- a/src/go.sum
11401140
+++ b/src/go.sum
11411141
@@ -1,5 +1,7 @@
1142-
github.com/golang-fips/openssl/v2 v2.0.4-0.20240909165545-0a2f211a8f95 h1:e+JGYwsNT8K58Z9JysRNadrPzxNlGf+0wQXcdlHiv5M=
1143-
github.com/golang-fips/openssl/v2 v2.0.4-0.20240909165545-0a2f211a8f95/go.mod h1:7tuBqX2Zov8Yq5mJ2yzlKhpnxOnWyEzi38AzeWRuQdg=
1142+
github.com/golang-fips/openssl/v2 v2.0.4-0.20241106131105-4bcac10661a9 h1:LSalTbQ1mC7dgzyVZTvgVBV3RY503kOtn5iIvIXTBvY=
1143+
github.com/golang-fips/openssl/v2 v2.0.4-0.20241106131105-4bcac10661a9/go.mod h1:7tuBqX2Zov8Yq5mJ2yzlKhpnxOnWyEzi38AzeWRuQdg=
11441144
+github.com/microsoft/go-crypto-winnative v0.0.0-20240925170411-b29b5cde7fdd h1:2ziav5Bdjyv0VYCCftEExmA+QQZ193w8BvSgoEZ+qAY=
11451145
+github.com/microsoft/go-crypto-winnative v0.0.0-20240925170411-b29b5cde7fdd/go.mod h1:fveERXKbeK+XLmOyU24caKnIT/S5nniAX9XCRHfnrM4=
11461146
golang.org/x/crypto v0.23.1-0.20240603234054-0b431c7de36a h1:37MIv+iGfwMYzWJECGyrPCtd5nuqcciRUeJfkNCkCf0=

patches/0006-Vendor-crypto-backends.patch

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ To reproduce, run 'go mod vendor' in 'go/src'.
1717
.../github.com/golang-fips/openssl/v2/ecdh.go | 323 +++++++
1818
.../golang-fips/openssl/v2/ecdsa.go | 217 +++++
1919
.../golang-fips/openssl/v2/ed25519.go | 218 +++++
20-
.../github.com/golang-fips/openssl/v2/evp.go | 471 +++++++++++
20+
.../github.com/golang-fips/openssl/v2/evp.go | 483 +++++++++++
2121
.../golang-fips/openssl/v2/goopenssl.c | 218 +++++
2222
.../golang-fips/openssl/v2/goopenssl.h | 255 ++++++
2323
.../github.com/golang-fips/openssl/v2/hash.go | 793 ++++++++++++++++++
@@ -61,7 +61,7 @@ To reproduce, run 'go mod vendor' in 'go/src'.
6161
.../internal/subtle/aliasing.go | 32 +
6262
.../internal/sysdll/sys_windows.go | 55 ++
6363
src/vendor/modules.txt | 11 +
64-
56 files changed, 9049 insertions(+)
64+
56 files changed, 9061 insertions(+)
6565
create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/.gitleaks.toml
6666
create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/LICENSE
6767
create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/README.md
@@ -1936,10 +1936,10 @@ index 00000000000000..f74bd8f8d7a993
19361936
+}
19371937
diff --git a/src/vendor/github.com/golang-fips/openssl/v2/evp.go b/src/vendor/github.com/golang-fips/openssl/v2/evp.go
19381938
new file mode 100644
1939-
index 00000000000000..a9237a6a0ce9aa
1939+
index 00000000000000..ff07f5f55bf974
19401940
--- /dev/null
19411941
+++ b/src/vendor/github.com/golang-fips/openssl/v2/evp.go
1942-
@@ -0,0 +1,471 @@
1942+
@@ -0,0 +1,483 @@
19431943
+//go:build !cmd_go_bootstrap
19441944
+
19451945
+package openssl
@@ -1993,12 +1993,28 @@ index 00000000000000..a9237a6a0ce9aa
19931993
+ return v.(C.GO_EVP_MD_PTR)
19941994
+ }
19951995
+ defer func() {
1996-
+ if md != nil && vMajor == 3 {
1997-
+ // On OpenSSL 3, directly operating on a EVP_MD object
1998-
+ // not created by EVP_MD_fetch has negative performance
1999-
+ // implications, as digest operations will have
2000-
+ // to fetch it on every call. Better to just fetch it once here.
2001-
+ md = C.go_openssl_EVP_MD_fetch(nil, C.go_openssl_EVP_MD_get0_name(md), nil)
1996+
+ if md != nil {
1997+
+ switch vMajor {
1998+
+ case 1:
1999+
+ // On OpenSSL 1 EVP_MD objects can be not-nil even
2000+
+ // when they are not supported. We need to pass the md
2001+
+ // to a EVP_MD_CTX to really know if they can be used.
2002+
+ ctx := C.go_openssl_EVP_MD_CTX_new()
2003+
+ if ctx != nil {
2004+
+ if C.go_openssl_EVP_DigestInit_ex(ctx, md, nil) != 1 {
2005+
+ md = nil
2006+
+ }
2007+
+ C.go_openssl_EVP_MD_CTX_free(ctx)
2008+
+ }
2009+
+ case 3:
2010+
+ // On OpenSSL 3, directly operating on a EVP_MD object
2011+
+ // not created by EVP_MD_fetch has negative performance
2012+
+ // implications, as digest operations will have
2013+
+ // to fetch it on every call. Better to just fetch it once here.
2014+
+ md = C.go_openssl_EVP_MD_fetch(nil, C.go_openssl_EVP_MD_get0_name(md), nil)
2015+
+ default:
2016+
+ panic(errUnsupportedVersion())
2017+
+ }
20022018
+ }
20032019
+ cacheMD.Store(ch, md)
20042020
+ }()
@@ -2014,13 +2030,9 @@ index 00000000000000..a9237a6a0ce9aa
20142030
+ }
20152031
+ switch ch {
20162032
+ case crypto.MD4:
2017-
+ if versionAtOrAbove(1, 1, 0) || !FIPS() {
2018-
+ return C.go_openssl_EVP_md4()
2019-
+ }
2033+
+ return C.go_openssl_EVP_md4()
20202034
+ case crypto.MD5:
2021-
+ if versionAtOrAbove(1, 1, 0) || !FIPS() {
2022-
+ return C.go_openssl_EVP_md5()
2023-
+ }
2035+
+ return C.go_openssl_EVP_md5()
20242036
+ case crypto.SHA1:
20252037
+ return C.go_openssl_EVP_sha1()
20262038
+ case crypto.SHA224:
@@ -9489,11 +9501,11 @@ index 00000000000000..1722410e5af193
94899501
+ return getSystemDirectory() + "\\" + dll
94909502
+}
94919503
diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt
9492-
index b8a0b84a282a32..3677388dc80929 100644
9504+
index b8a0b84a282a32..fa72eda0979db6 100644
94939505
--- a/src/vendor/modules.txt
94949506
+++ b/src/vendor/modules.txt
94959507
@@ -1,3 +1,14 @@
9496-
+# github.com/golang-fips/openssl/v2 v2.0.4-0.20240909165545-0a2f211a8f95
9508+
+# github.com/golang-fips/openssl/v2 v2.0.4-0.20241106131105-4bcac10661a9
94979509
+## explicit; go 1.20
94989510
+github.com/golang-fips/openssl/v2
94999511
+github.com/golang-fips/openssl/v2/bbig

0 commit comments

Comments
 (0)