@@ -255,7 +255,7 @@ index 275c60b4de..58f0034b18 100644
255255 "math/big"
256256 )
257257diff --git a/src/crypto/ecdsa/ecdsa.go b/src/crypto/ecdsa/ecdsa.go
258- index 68272af41f..b1eea00bef 100644
258+ index 03a9a72ddd..4bf497f9cc 100644
259259--- a/src/crypto/ecdsa/ecdsa.go
260260+++ b/src/crypto/ecdsa/ecdsa.go
261261@@ -27,8 +27,8 @@ import (
@@ -350,7 +350,7 @@ index d12ba2f441..6334a56496 100644
350350 }
351351 testHashSignAndHashVerify(t, elliptic.P384(), "p384")
352352diff --git a/src/crypto/ecdsa/ecdsa_test.go b/src/crypto/ecdsa/ecdsa_test.go
353- index 51f58b305e..967e8ff7fb 100644
353+ index 61a4662036..80e484842b 100644
354354--- a/src/crypto/ecdsa/ecdsa_test.go
355355+++ b/src/crypto/ecdsa/ecdsa_test.go
356356@@ -10,7 +10,7 @@ import (
@@ -359,10 +359,10 @@ index 51f58b305e..967e8ff7fb 100644
359359 "crypto/internal/backend/boringtest"
360360- "crypto/internal/boring"
361361+ boring "crypto/internal/backend"
362+ "crypto/internal/bigmod"
362363 "crypto/rand"
363364 "crypto/sha1"
364- "crypto/sha256"
365- @@ -37,7 +37,7 @@ func testAllCurves(t *testing.T, f func(*testing.T, elliptic.Curve)) {
365+ @@ -38,7 +38,7 @@ func testAllCurves(t *testing.T, f func(*testing.T, elliptic.Curve)) {
366366 }
367367 if testing.Short() {
368368 tests = tests[:1]
@@ -371,7 +371,7 @@ index 51f58b305e..967e8ff7fb 100644
371371 p224 := struct {
372372 name string
373373 curve elliptic.Curve
374- @@ -45 ,7 +45 ,7 @@ func testAllCurves(t *testing.T, f func(*testing.T, elliptic.Curve)) {
374+ @@ -46 ,7 +46 ,7 @@ func testAllCurves(t *testing.T, f func(*testing.T, elliptic.Curve)) {
375375 tests = append(tests, p224)
376376 }
377377 for _, test := range tests {
@@ -380,7 +380,7 @@ index 51f58b305e..967e8ff7fb 100644
380380 t.Skip("unsupported test in FIPS mode")
381381 }
382382 curve := test.curve
383- @@ -245 ,7 +245 ,7 @@ func TestVectors(t *testing.T) {
383+ @@ -246 ,7 +246 ,7 @@ func TestVectors(t *testing.T) {
384384
385385 switch curve {
386386 case "P-224":
@@ -2348,24 +2348,24 @@ index 8734dd03c1..22a104f338 100644
23482348 } else {
23492349 testCurve = elliptic.P384()
23502350diff --git a/src/go.mod b/src/go.mod
2351- index 4697da201c..0a5e32e27a 100644
2351+ index 4697da201c..a3891edd78 100644
23522352--- a/src/go.mod
23532353+++ b/src/go.mod
23542354@@ -3,6 +3,7 @@ module std
23552355 go 1.20
23562356
23572357 require (
2358- + github.com/golang-fips/openssl-fips v0.0.0-20230323210700-e1541889d8a8
2358+ + github.com/golang-fips/openssl-fips v0.0.0-20230714114059-9051f24728fe
23592359 golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a
23602360 golang.org/x/net v0.4.1-0.20230214201333-88ed8ca3307d
23612361 )
23622362diff --git a/src/go.sum b/src/go.sum
2363- index 625f2070b3..fb6828ce41 100644
2363+ index 625f2070b3..2e984ad481 100644
23642364--- a/src/go.sum
23652365+++ b/src/go.sum
23662366@@ -1,3 +1,5 @@
2367- + github.com/golang-fips/openssl-fips v0.0.0-20230323210700-e1541889d8a8 h1:nY4kLp8xhBuVWF5mqsluydyZnJzW2FELBC+A4EEtu1o =
2368- + github.com/golang-fips/openssl-fips v0.0.0-20230323210700-e1541889d8a8 /go.mod h1:V2IU8imz/VkScnIbTOrdYsZ5R88ZFypCE0LzhRJ3HsI=
2367+ + github.com/golang-fips/openssl-fips v0.0.0-20230714114059-9051f24728fe h1:Zr44HT3VYwYIkT72fyvaqWZN+sO2Saw++e+6PaXapN0 =
2368+ + github.com/golang-fips/openssl-fips v0.0.0-20230714114059-9051f24728fe /go.mod h1:V2IU8imz/VkScnIbTOrdYsZ5R88ZFypCE0LzhRJ3HsI=
23692369 golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a h1:diz9pEYuTIuLMJLs3rGDkeaTsNyRs6duYdFyPAxzE/U=
23702370 golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
23712371 golang.org/x/net v0.4.1-0.20230214201333-88ed8ca3307d h1:KHU/KRz6+/yWyRHEC24m7T5gou5VSh62duch955ktBY=
@@ -5631,10 +5631,10 @@ index 0000000000..df4ebe3297
56315631+ }
56325632diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_ecdh.c b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_ecdh.c
56335633new file mode 100644
5634- index 0000000000..abdee81a91
5634+ index 0000000000..8205b040c5
56355635--- /dev/null
56365636+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_port_ecdh.c
5637- @@ -0,0 +1,334 @@
5637+ @@ -0,0 +1,342 @@
56385638+ // +build linux
56395639+ // +build !android
56405640+ // +build !no_openssl
@@ -5676,6 +5676,8 @@ index 0000000000..abdee81a91
56765676+ return 0;
56775677+
56785678+ *result = malloc(len);
5679+ + if (!*result)
5680+ + return 0;
56795681+
56805682+ len = _goboringcrypto_EC_POINT_point2oct(group, point,
56815683+ GO_POINT_CONVERSION_UNCOMPRESSED,
@@ -5760,14 +5762,18 @@ index 0000000000..abdee81a91
57605762+ if (!priv)
57615763+ goto err;
57625764+
5763- + if (!_goboringcrypto_internal_OSSL_PARAM_BLD_push_BN(bld, "priv", priv))
5765+ + if (!_goboringcrypto_internal_OSSL_PARAM_BLD_push_BN(bld, "priv", priv)) {
5766+ + _goboringcrypto_BN_clear_free(priv);
57645767+ goto err;
5768+ + }
57655769+
57665770+ params = _goboringcrypto_internal_OSSL_PARAM_BLD_to_param(bld);
5767- + _goboringcrypto_BN_free(priv);
5768- + if (!params)
5771+ + if (!params) {
5772+ + _goboringcrypto_BN_clear_free(priv);
57695773+ goto err;
5774+ + }
57705775+
5776+ + _goboringcrypto_BN_clear_free(priv);
57715777+ selection = GO_EVP_PKEY_KEYPAIR;
57725778+ } else {
57735779+ if (!_goboringcrypto_internal_OSSL_PARAM_BLD_push_octet_string(bld, "pub", bytes, len))
@@ -5797,7 +5803,7 @@ index 0000000000..abdee81a91
57975803+ return result;
57985804+ }
57995805+
5800- + DEFINEFUNCINTERNAL(void, OPENSSL_free , (void *addr), (addr))
5806+ + DEFINEFUNCINTERNAL(void, CRYPTO_free , (void *addr, const char *file, int line ), (addr, file, line ))
58015807+
58025808+ size_t
58035809+ _goboringcrypto_EVP_PKEY_get1_encoded_ecdh_public_key(GO_EVP_PKEY *pkey,
@@ -5812,10 +5818,11 @@ index 0000000000..abdee81a91
58125818+
58135819+ *result = malloc(len);
58145820+ if (!*result) {
5815- + _goboringcrypto_internal_OPENSSL_free (res);
5821+ + _goboringcrypto_internal_CRYPTO_free (res, __FILE__, __LINE__ );
58165822+ return 0;
58175823+ }
58185824+ memcpy(*result, res, len);
5825+ + _goboringcrypto_internal_CRYPTO_free(res, __FILE__, __LINE__);
58195826+ return len;
58205827+ }
58215828+
@@ -5852,6 +5859,7 @@ index 0000000000..abdee81a91
58525859+ err:
58535860+ _goboringcrypto_EC_GROUP_free(group);
58545861+ _goboringcrypto_EC_POINT_free(point);
5862+ + _goboringcrypto_BN_free(priv);
58555863+ free(pub);
58565864+ return result;
58575865+ }
@@ -5875,10 +5883,10 @@ index 0000000000..abdee81a91
58755883+ if (!priv)
58765884+ goto err;
58775885+ if (_goboringcrypto_EC_KEY_set_private_key(key, priv) != 1) {
5878- + _goboringcrypto_BN_free (priv);
5886+ + _goboringcrypto_BN_clear_free (priv);
58795887+ goto err;
58805888+ }
5881- + _goboringcrypto_BN_free (priv);
5889+ + _goboringcrypto_BN_clear_free (priv);
58825890+ } else {
58835891+ const EC_GROUP *group = _goboringcrypto_EC_KEY_get0_group(key);
58845892+ EC_POINT *pub;
@@ -7144,11 +7152,11 @@ index cf82f3f64f..0b55cedc91 100644
71447152
71457153 type sha512Ctx struct {
71467154diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt
7147- index 89a7c86c41..d3e88755be 100644
7155+ index 89a7c86c41..f4f12ecee2 100644
71487156--- a/src/vendor/modules.txt
71497157+++ b/src/vendor/modules.txt
71507158@@ -1,3 +1,6 @@
7151- + # github.com/golang-fips/openssl-fips v0.0.0-20230323210700-e1541889d8a8
7159+ + # github.com/golang-fips/openssl-fips v0.0.0-20230714114059-9051f24728fe
71527160+ ## explicit; go 1.18
71537161+ github.com/golang-fips/openssl-fips/openssl
71547162 # golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a
0 commit comments