@@ -135,6 +135,27 @@ index f933f2800a..223ce04340 100644
135
135
testenv.MustHaveExternalNetwork(t)
136
136
137
137
// Create a temp dir and modcache subdir.
138
+ diff --git a/src/crypto/internal/backend/bbig/big.go b/src/crypto/internal/backend/bbig/big.go
139
+ new file mode 100644
140
+ index 0000000000..5652398605
141
+ --- /dev/null
142
+ +++ b/src/crypto/internal/backend/bbig/big.go
143
+ @@ -0,0 +1,15 @@
144
+ + // Copyright 2022 The Go Authors. All rights reserved.
145
+ + // Use of this source code is governed by a BSD-style
146
+ + // license that can be found in the LICENSE file.
147
+ +
148
+ + // This is a mirror of
149
+ + // https://github.com/golang/go/blob/36b87f273cc43e21685179dc1664ebb5493d26ae/src/crypto/internal/boring/bbig/big.go.
150
+ +
151
+ + package bbig
152
+ +
153
+ + import (
154
+ + "github.com/golang-fips/openssl/v2/bbig"
155
+ + )
156
+ +
157
+ + var Enc = bbig.Enc
158
+ + var Dec = bbig.Dec
138
159
diff --git a/src/crypto/internal/backend/boringtest/config.go b/src/crypto/internal/backend/boringtest/config.go
139
160
new file mode 100644
140
161
index 0000000000..6c8c00d11e
@@ -192,10 +213,10 @@ new file mode 100644
192
213
index 0000000000..e69de29bb2
193
214
diff --git a/src/crypto/internal/backend/nobackend.go b/src/crypto/internal/backend/nobackend.go
194
215
new file mode 100644
195
- index 0000000000..15c1ee8cbe
216
+ index 0000000000..528ded04d7
196
217
--- /dev/null
197
218
+++ b/src/crypto/internal/backend/nobackend.go
198
- @@ -0,0 +1,163 @@
219
+ @@ -0,0 +1,170 @@
199
220
+ // Copyright 2017 The Go Authors. All rights reserved.
200
221
+ // Use of this source code is governed by a BSD-style
201
222
+ // license that can be found in the LICENSE file.
@@ -359,12 +380,19 @@ index 0000000000..15c1ee8cbe
359
380
+ func HashSignECDSA(priv *PrivateKeyECDSA, hash []byte, h crypto.Hash) (*big.Int, *big.Int, error) {
360
381
+ panic("boringcrypto: not available")
361
382
+ }
383
+ +
384
+ + func SupportsTLS1PRF() bool {
385
+ + panic("boringcrypto: not available")
386
+ + }
387
+ + func TLS1PRF(result, secret, label, seed []byte, h func() hash.Hash) error {
388
+ + panic("boringcrypto: not available")
389
+ + }
362
390
diff --git a/src/crypto/internal/backend/openssl.go b/src/crypto/internal/backend/openssl.go
363
391
new file mode 100644
364
- index 0000000000..2087c555a4
392
+ index 0000000000..6ec71c625d
365
393
--- /dev/null
366
394
+++ b/src/crypto/internal/backend/openssl.go
367
- @@ -0,0 +1,122 @@
395
+ @@ -0,0 +1,125 @@
368
396
+ // Copyright 2017 The Go Authors. All rights reserved.
369
397
+ // Use of this source code is governed by a BSD-style
370
398
+ // license that can be found in the LICENSE file.
@@ -487,27 +515,9 @@ index 0000000000..2087c555a4
487
515
+ var ExtractHKDF = openssl.ExtractHKDF
488
516
+ var ExpandHKDF = openssl.ExpandHKDF
489
517
+ var SupportsHKDF = openssl.SupportsHKDF
490
- diff --git a/src/crypto/internal/backend/bbig/big.go b/src/crypto/internal/backend/bbig/big.go
491
- new file mode 100644
492
- index 0000000000..7fac1ec7e1
493
- --- /dev/null
494
- +++ b/src/crypto/internal/backend/bbig/big.go
495
- @@ -0,0 +1,15 @@
496
- + // Copyright 2022 The Go Authors. All rights reserved.
497
- + // Use of this source code is governed by a BSD-style
498
- + // license that can be found in the LICENSE file.
499
- +
500
- + // This is a mirror of
501
- + // https://github.com/golang/go/blob/36b87f273cc43e21685179dc1664ebb5493d26ae/src/crypto/internal/boring/bbig/big.go.
502
- +
503
- + package bbig
504
- +
505
- + import (
506
- + "github.com/golang-fips/openssl/v2/bbig"
507
- + )
508
518
+
509
- + var Enc = bbig.Enc
510
- + var Dec = bbig.Dec
519
+ + var SupportsTLS1PRF = openssl.SupportsTLS1PRF
520
+ + var TLS1PRF = openssl.TLS1PRF
511
521
diff --git a/src/crypto/rsa/pkcs1v15_test.go b/src/crypto/rsa/pkcs1v15_test.go
512
522
index dfa1eddc88..39a4fc184a 100644
513
523
--- a/src/crypto/rsa/pkcs1v15_test.go
@@ -734,28 +744,6 @@ index cf03e3cb7e..1226149321 100644
734
744
t.Fatalf("SignPSS unexpected error: got %v, want %v", err, InvalidSaltLenErr)
735
745
}
736
746
737
- diff --git a/src/crypto/rsa/rsa.go b/src/crypto/rsa/rsa.go
738
- index 63bc8dad1a..ab56ccd1ed 100644
739
- --- a/src/crypto/rsa/rsa.go
740
- +++ b/src/crypto/rsa/rsa.go
741
- @@ -509,7 +509,7 @@ func EncryptOAEP(hash hash.Hash, random io.Reader, pub *PublicKey, msg []byte, l
742
- if err != nil {
743
- return nil, err
744
- }
745
- - return boring.EncryptRSAOAEP(hash, hash, bkey, msg, label)
746
- + return boring.EncryptRSAOAEP(hash, hash, bkey, msg, label)
747
- }
748
- boring.UnreachableExceptTests()
749
-
750
- @@ -680,7 +680,7 @@ func decryptOAEP(hash, mgfHash hash.Hash, random io.Reader, priv *PrivateKey, ci
751
- if err != nil {
752
- return nil, err
753
- }
754
- - out, err := boring.DecryptRSAOAEP(hash, mgfHash, bkey, ciphertext, label)
755
- + out, err := boring.DecryptRSAOAEP(hash, mgfHash, bkey, ciphertext, label)
756
- if err != nil {
757
- return nil, ErrDecryption
758
- }
759
747
diff --git a/src/crypto/rsa/rsa_test.go b/src/crypto/rsa/rsa_test.go
760
748
index 3278a7ff30..b994daec19 100644
761
749
--- a/src/crypto/rsa/rsa_test.go
@@ -1128,7 +1116,7 @@ index ba68f355eb..7bfe3f9417 100644
1128
1116
1129
1117
// A self-signed test certificate with an RSA key of size 2048, for testing
1130
1118
diff --git a/src/crypto/tls/cipher_suites.go b/src/crypto/tls/cipher_suites.go
1131
- index 04e6dfe018..b6ed936cd1 100644
1119
+ index 589e8b6faf..669208bb86 100644
1132
1120
--- a/src/crypto/tls/cipher_suites.go
1133
1121
+++ b/src/crypto/tls/cipher_suites.go
1134
1122
@@ -354,6 +354,11 @@ var defaultCipherSuitesTLS13NoAES = []uint16{
@@ -1144,7 +1132,7 @@ index 04e6dfe018..b6ed936cd1 100644
1144
1132
hasGCMAsmAMD64 = cpu.X86.HasAES && cpu.X86.HasPCLMULQDQ
1145
1133
hasGCMAsmARM64 = cpu.ARM64.HasAES && cpu.ARM64.HasPMULL
1146
1134
diff --git a/src/crypto/tls/common.go b/src/crypto/tls/common.go
1147
- index 5394d64ac6..db4e2dbf60 100644
1135
+ index e0885a0da9..5edbd19995 100644
1148
1136
--- a/src/crypto/tls/common.go
1149
1137
+++ b/src/crypto/tls/common.go
1150
1138
@@ -12,6 +12,7 @@ import (
@@ -1155,7 +1143,7 @@ index 5394d64ac6..db4e2dbf60 100644
1155
1143
"crypto/rand"
1156
1144
"crypto/rsa"
1157
1145
"crypto/sha512"
1158
- @@ -994 ,6 +995 ,9 @@ const roleServer = false
1146
+ @@ -1031 ,6 +1032 ,9 @@ const roleServer = false
1159
1147
func (c *Config) supportedVersions(isClient bool) []uint16 {
1160
1148
versions := make([]uint16, 0, len(supportedVersions))
1161
1149
for _, v := range supportedVersions {
@@ -1166,10 +1154,10 @@ index 5394d64ac6..db4e2dbf60 100644
1166
1154
continue
1167
1155
}
1168
1156
diff --git a/src/crypto/tls/handshake_client.go b/src/crypto/tls/handshake_client.go
1169
- index 63d86b9f3a..a8ee915041 100644
1157
+ index 4649f36dea..5e1976caf3 100644
1170
1158
--- a/src/crypto/tls/handshake_client.go
1171
1159
+++ b/src/crypto/tls/handshake_client.go
1172
- @@ -127 ,7 +127 ,9 @@ func (c *Conn) makeClientHello() (*clientHelloMsg, *ecdh.PrivateKey, error) {
1160
+ @@ -139 ,7 +139 ,9 @@ func (c *Conn) makeClientHello() (*clientHelloMsg, *ecdh.PrivateKey, error) {
1173
1161
if len(hello.supportedVersions) == 1 {
1174
1162
hello.cipherSuites = nil
1175
1163
}
@@ -1181,10 +1169,10 @@ index 63d86b9f3a..a8ee915041 100644
1181
1169
} else {
1182
1170
hello.cipherSuites = append(hello.cipherSuites, defaultCipherSuitesTLS13NoAES...)
1183
1171
diff --git a/src/crypto/tls/handshake_client_test.go b/src/crypto/tls/handshake_client_test.go
1184
- index 22be38faff..d460eeb880 100644
1172
+ index a2052ceb70..1666b58ef3 100644
1185
1173
--- a/src/crypto/tls/handshake_client_test.go
1186
1174
+++ b/src/crypto/tls/handshake_client_test.go
1187
- @@ -2156 ,6 +2156 ,7 @@ func testBuffering(t *testing.T, version uint16) {
1175
+ @@ -2198 ,6 +2198 ,7 @@ func testBuffering(t *testing.T, version uint16) {
1188
1176
}
1189
1177
1190
1178
func TestAlertFlushing(t *testing.T) {
@@ -1193,7 +1181,7 @@ index 22be38faff..d460eeb880 100644
1193
1181
done := make(chan bool)
1194
1182
1195
1183
diff --git a/src/crypto/tls/handshake_client_tls13.go b/src/crypto/tls/handshake_client_tls13.go
1196
- index 4a8661085e..87fe11de5c 100644
1184
+ index 2f59f6888c..a84cede1b0 100644
1197
1185
--- a/src/crypto/tls/handshake_client_tls13.go
1198
1186
+++ b/src/crypto/tls/handshake_client_tls13.go
1199
1187
@@ -41,10 +41,6 @@ type clientHandshakeStateTLS13 struct {
@@ -1208,10 +1196,10 @@ index 4a8661085e..87fe11de5c 100644
1208
1196
// sections 4.1.2 and 4.1.3.
1209
1197
if c.handshakes > 0 {
1210
1198
diff --git a/src/crypto/tls/handshake_server_tls13.go b/src/crypto/tls/handshake_server_tls13.go
1211
- index b7b568cd84..af75e7dbe0 100644
1199
+ index 07b1a3851e..938a329668 100644
1212
1200
--- a/src/crypto/tls/handshake_server_tls13.go
1213
1201
+++ b/src/crypto/tls/handshake_server_tls13.go
1214
- @@ -44 ,10 +44 ,6 @@ type serverHandshakeStateTLS13 struct {
1202
+ @@ -45 ,10 +45 ,6 @@ type serverHandshakeStateTLS13 struct {
1215
1203
func (hs *serverHandshakeStateTLS13) handshake() error {
1216
1204
c := hs.c
1217
1205
@@ -1223,7 +1211,7 @@ index b7b568cd84..af75e7dbe0 100644
1223
1211
if err := hs.processClientHello(); err != nil {
1224
1212
return err
1225
1213
diff --git a/src/crypto/tls/key_schedule.go b/src/crypto/tls/key_schedule.go
1226
- index ae8f80a7cf..30a8450f40 100644
1214
+ index d7f082c9ee..e7a360fdd4 100644
1227
1215
--- a/src/crypto/tls/key_schedule.go
1228
1216
+++ b/src/crypto/tls/key_schedule.go
1229
1217
@@ -7,6 +7,7 @@ package tls
@@ -1234,7 +1222,7 @@ index ae8f80a7cf..30a8450f40 100644
1234
1222
"errors"
1235
1223
"fmt"
1236
1224
"hash"
1237
- @@ -58 ,9 +59 ,20 @@ func (c *cipherSuiteTLS13) expandLabel(secret []byte, label string, context []by
1225
+ @@ -59 ,9 +60 ,20 @@ func (c *cipherSuiteTLS13) expandLabel(secret []byte, label string, context []by
1238
1226
panic(fmt.Errorf("failed to construct HKDF label: %s", err))
1239
1227
}
1240
1228
out := make([]byte, length)
@@ -1258,7 +1246,7 @@ index ae8f80a7cf..30a8450f40 100644
1258
1246
}
1259
1247
return out
1260
1248
}
1261
- @@ -78 ,7 +90 ,15 @@ func (c *cipherSuiteTLS13) extract(newSecret, currentSecret []byte) []byte {
1249
+ @@ -79 ,7 +91 ,15 @@ func (c *cipherSuiteTLS13) extract(newSecret, currentSecret []byte) []byte {
1262
1250
if newSecret == nil {
1263
1251
newSecret = make([]byte, c.hash.Size())
1264
1252
}
@@ -1305,7 +1293,7 @@ index 33fd0ed52b..102acda578 100644
1305
1293
I_R1 := testBoringCert(t, "I_R1", boringRSAKey(t, 3072), R1, boringCertCA|boringCertFIPSOK)
1306
1294
testBoringCert(t, "I_R2", I_R1.key, R2, boringCertCA|boringCertFIPSOK)
1307
1295
diff --git a/src/crypto/x509/x509_test.go b/src/crypto/x509/x509_test.go
1308
- index 8846b00312..8734dd03c1 100644
1296
+ index 19deeab54d..0c2cbf3182 100644
1309
1297
--- a/src/crypto/x509/x509_test.go
1310
1298
+++ b/src/crypto/x509/x509_test.go
1311
1299
@@ -12,6 +12,8 @@ import (
@@ -1424,7 +1412,7 @@ index 8846b00312..8734dd03c1 100644
1424
1412
commonName := "test.example.com"
1425
1413
template := Certificate{
1426
1414
SerialNumber: big.NewInt(1),
1427
- @@ -3607 ,11 +3638 ,19 @@ func TestParseRevocationList(t *testing.T) {
1415
+ @@ -3682 ,11 +3713 ,19 @@ func TestParseRevocationList(t *testing.T) {
1428
1416
}
1429
1417
1430
1418
func TestRevocationListCheckSignatureFrom(t *testing.T) {
@@ -1447,10 +1435,10 @@ index 8846b00312..8734dd03c1 100644
1447
1435
t.Fatalf("failed to generate test key: %s", err)
1448
1436
}
1449
1437
diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go
1450
- index 08452c7b1d..0732db0662 100644
1438
+ index 592f2fd72a..1c1caa6897 100644
1451
1439
--- a/src/go/build/deps_test.go
1452
1440
+++ b/src/go/build/deps_test.go
1453
- @@ -396 ,9 +396 ,11 @@ var depsRules = `
1441
+ @@ -423 ,9 +423 ,11 @@ var depsRules = `
1454
1442
< crypto/internal/alias
1455
1443
< crypto/cipher;
1456
1444
@@ -1463,7 +1451,7 @@ index 08452c7b1d..0732db0662 100644
1463
1451
< crypto/boring;
1464
1452
1465
1453
crypto/internal/alias
1466
- @@ -427 ,11 +429 ,13 @@ var depsRules = `
1454
+ @@ -454 ,11 +456 ,13 @@ var depsRules = `
1467
1455
crypto/sha512
1468
1456
< CRYPTO;
1469
1457
@@ -1478,15 +1466,15 @@ index 08452c7b1d..0732db0662 100644
1478
1466
< crypto/rand
1479
1467
< crypto/ed25519
1480
1468
< encoding/asn1
1481
- @@ -629 ,6 +633 ,7 @@ func listStdPkgs(goroot string) ([]string, error) {
1469
+ @@ -663 ,6 +667 ,7 @@ func listStdPkgs(goroot string) ([]string, error) {
1482
1470
}
1483
1471
1484
1472
func TestDependencies(t *testing.T) {
1485
1473
+ t.Skip("openssl based toolchain has different dependencies than upstream")
1486
1474
if !testenv.HasSrc() {
1487
1475
// Tests run in a limited file system and we do not
1488
1476
// provide access to every source file.
1489
- @@ -671 ,7 +676 ,7 @@ var buildIgnore = []byte("\n//go:build ignore")
1477
+ @@ -705 ,7 +710 ,7 @@ var buildIgnore = []byte("\n//go:build ignore")
1490
1478
1491
1479
func findImports(pkg string) ([]string, error) {
1492
1480
vpkg := pkg
@@ -1495,7 +1483,7 @@ index 08452c7b1d..0732db0662 100644
1495
1483
vpkg = "vendor/" + pkg
1496
1484
}
1497
1485
dir := filepath.Join(Default.GOROOT, "src", vpkg)
1498
- @@ -681 ,7 +686 ,7 @@ func findImports(pkg string) ([]string, error) {
1486
+ @@ -715 ,7 +720 ,7 @@ func findImports(pkg string) ([]string, error) {
1499
1487
}
1500
1488
var imports []string
1501
1489
var haveImport = map[string]bool{}
@@ -1505,7 +1493,7 @@ index 08452c7b1d..0732db0662 100644
1505
1493
}
1506
1494
fset := token.NewFileSet()
1507
1495
diff --git a/src/runtime/pprof/proto_test.go b/src/runtime/pprof/proto_test.go
1508
- index 780b481de8..63db9e9ed7 100644
1496
+ index 8ec9c9109a..d7f287261f 100644
1509
1497
--- a/src/runtime/pprof/proto_test.go
1510
1498
+++ b/src/runtime/pprof/proto_test.go
1511
1499
@@ -15,6 +15,7 @@ import (
0 commit comments