@@ -18,7 +18,7 @@ Use a 'go' that was recently built by the current branch to ensure stable result
18
18
.../github.com/golang-fips/openssl/v2/aes.go | 146 ++
19
19
.../golang-fips/openssl/v2/bbig/big.go | 37 +
20
20
.../github.com/golang-fips/openssl/v2/big.go | 11 +
21
- .../golang-fips/openssl/v2/cipher.go | 603 +++++
21
+ .../golang-fips/openssl/v2/cipher.go | 654 + +++++
22
22
.../golang-fips/openssl/v2/const.go | 93 +
23
23
.../github.com/golang-fips/openssl/v2/des.go | 113 +
24
24
.../github.com/golang-fips/openssl/v2/dsa.go | 309 +++
@@ -59,7 +59,7 @@ Use a 'go' that was recently built by the current branch to ensure stable result
59
59
.../internal/cryptokit/hash.go | 255 +++
60
60
.../internal/cryptokit/hkdf.go | 77 +
61
61
.../internal/cryptokit/hmac.go | 144 ++
62
- .../microsoft/go-crypto-darwin/xcrypto/aes.go | 306 +++
62
+ .../microsoft/go-crypto-darwin/xcrypto/aes.go | 336 +++
63
63
.../microsoft/go-crypto-darwin/xcrypto/big.go | 16 +
64
64
.../go-crypto-darwin/xcrypto/cgo_go124.go | 23 +
65
65
.../go-crypto-darwin/xcrypto/cipher.go | 122 +
@@ -78,7 +78,7 @@ Use a 'go' that was recently built by the current branch to ensure stable result
78
78
.../microsoft/go-crypto-darwin/xcrypto/rsa.go | 194 ++
79
79
.../go-crypto-darwin/xcrypto/xcrypto.go | 49 +
80
80
.../microsoft/go-crypto-winnative/LICENSE | 21 +
81
- .../microsoft/go-crypto-winnative/cng/aes.go | 393 ++++
81
+ .../microsoft/go-crypto-winnative/cng/aes.go | 427 ++++
82
82
.../go-crypto-winnative/cng/bbig/big.go | 31 +
83
83
.../microsoft/go-crypto-winnative/cng/big.go | 30 +
84
84
.../go-crypto-winnative/cng/cipher.go | 52 +
@@ -103,7 +103,7 @@ Use a 'go' that was recently built by the current branch to ensure stable result
103
103
.../internal/subtle/aliasing.go | 32 +
104
104
.../internal/sysdll/sys_windows.go | 55 +
105
105
src/vendor/modules.txt | 17 +
106
- 97 files changed, 17015 insertions(+), 7 deletions(-)
106
+ 97 files changed, 17130 insertions(+), 7 deletions(-)
107
107
create mode 100644 src/crypto/internal/backend/deps_ignore.go
108
108
create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/.gitignore
109
109
create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/.gitleaks.toml
@@ -226,7 +226,7 @@ index 00000000000000..ae4055d2d71303
226
226
+// that are used by the backend package. This allows to track
227
227
+// their versions in a single patch file.
228
228
diff --git a/src/go.mod b/src/go.mod
229
- index 28e250668dd52c..0856b1d14f7d34 100644
229
+ index 28e250668dd52c..e5aa4b223a54d4 100644
230
230
--- a/src/go.mod
231
231
+++ b/src/go.mod
232
232
@@ -11,3 +11,9 @@ require (
@@ -240,7 +240,7 @@ index 28e250668dd52c..0856b1d14f7d34 100644
240
240
+ github.com/microsoft/go-crypto-winnative v0.0.0-20250224213920-97653fcd3f40
241
241
+)
242
242
diff --git a/src/go.sum b/src/go.sum
243
- index ca2e7027fad3bd..00efdf0cb6041e 100644
243
+ index ca2e7027fad3bd..f623f220d18598 100644
244
244
--- a/src/go.sum
245
245
+++ b/src/go.sum
246
246
@@ -1,3 +1,9 @@
@@ -254,7 +254,7 @@ index ca2e7027fad3bd..00efdf0cb6041e 100644
254
254
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
255
255
golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
256
256
diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go
257
- index 1eb683a5ae77b7..2adf8c897229cf 100644
257
+ index b261af47e2167c..3ad0b0a3f2f465 100644
258
258
--- a/src/go/build/deps_test.go
259
259
+++ b/src/go/build/deps_test.go
260
260
@@ -518,6 +518,24 @@ var depsRules = `
@@ -311,7 +311,7 @@ index 1eb683a5ae77b7..2adf8c897229cf 100644
311
311
CRYPTO, FMT, math/big
312
312
< crypto/internal/boring/bbig
313
313
< crypto/rand
314
- @@ -858 ,7 +879 ,7 @@ var buildIgnore = []byte("\n//go:build ignore")
314
+ @@ -861 ,7 +882 ,7 @@ var buildIgnore = []byte("\n//go:build ignore")
315
315
316
316
func findImports(pkg string) ([]string, error) {
317
317
vpkg := pkg
@@ -320,7 +320,7 @@ index 1eb683a5ae77b7..2adf8c897229cf 100644
320
320
vpkg = "vendor/" + pkg
321
321
}
322
322
dir := filepath.Join(Default.GOROOT, "src", vpkg)
323
- @@ -868 ,7 +889 ,7 @@ func findImports(pkg string) ([]string, error) {
323
+ @@ -871 ,7 +892 ,7 @@ func findImports(pkg string) ([]string, error) {
324
324
}
325
325
var imports []string
326
326
var haveImport = map[string]bool{}
@@ -679,10 +679,10 @@ index 00000000000000..6461f241f863fc
679
679
+type BigInt []uint
680
680
diff --git a/src/vendor/github.com/golang-fips/openssl/v2/cipher.go b/src/vendor/github.com/golang-fips/openssl/v2/cipher.go
681
681
new file mode 100644
682
- index 00000000000000..2a3a91eb549a68
682
+ index 00000000000000..c9b2a64e181d3e
683
683
--- /dev/null
684
684
+++ b/src/vendor/github.com/golang-fips/openssl/v2/cipher.go
685
- @@ -0,0 +1,603 @@
685
+ @@ -0,0 +1,654 @@
686
686
+//go:build !cmd_go_bootstrap
687
687
+
688
688
+package openssl
@@ -1010,6 +1010,7 @@ index 00000000000000..2a3a91eb549a68
1010
1010
+}
1011
1011
+
1012
1012
+const (
1013
+ + aesBlockSize = 16
1013
1014
+ gcmTagSize = 16
1014
1015
+ gcmStandardNonceSize = 12
1015
1016
+ // TLS 1.2 additional data is constructed as:
@@ -1165,6 +1166,56 @@ index 00000000000000..2a3a91eb549a68
1165
1166
+ return ret
1166
1167
+}
1167
1168
+
1169
+ +func (g *cipherGCM) SealWithRandomNonce(out, nonce, plaintext, aad []byte) {
1170
+ + if uint64(len(plaintext)) > uint64((1<<32)-2)*aesBlockSize {
1171
+ + panic("crypto/cipher: message too large for GCM")
1172
+ + }
1173
+ + if len(nonce) != gcmStandardNonceSize {
1174
+ + panic("crypto/cipher: incorrect nonce length given to GCMWithRandomNonce")
1175
+ + }
1176
+ + if len(out) != len(plaintext)+gcmTagSize {
1177
+ + panic("crypto/cipher: incorrect output length given to GCMWithRandomNonce")
1178
+ + }
1179
+ + if inexactOverlap(out, plaintext) {
1180
+ + panic("crypto/cipher: invalid buffer overlap of output and input")
1181
+ + }
1182
+ + if anyOverlap(out, aad) {
1183
+ + panic("crypto/cipher: invalid buffer overlap of output and additional data")
1184
+ + }
1185
+ +
1186
+ + if g.tls != cipherGCMTLSNone {
1187
+ + panic("cipher: encryption failed")
1188
+ + }
1189
+ +
1190
+ + RandReader.Read(nonce)
1191
+ + ctx, err := newCipherCtx(g.c.kind, cipherModeGCM, cipherOpNone, g.c.key, nil)
1192
+ + if err != nil {
1193
+ + panic(err)
1194
+ + }
1195
+ + defer ossl.EVP_CIPHER_CTX_free(ctx)
1196
+ + if _, err := ossl.EVP_EncryptInit_ex(ctx, nil, nil, nil, base(nonce)); err != nil {
1197
+ + panic(err)
1198
+ + }
1199
+ + var outl, discard int32
1200
+ + if _, err := ossl.EVP_EncryptUpdate(ctx, nil, &discard, baseNeverEmpty(aad), int32(len(aad))); err != nil {
1201
+ + panic(err)
1202
+ + }
1203
+ + if _, err := ossl.EVP_EncryptUpdate(ctx, base(out), &outl, baseNeverEmpty(plaintext), int32(len(plaintext))); err != nil {
1204
+ + panic(err)
1205
+ + }
1206
+ + if len(plaintext) != int(outl) {
1207
+ + panic("cipher: incorrect length returned from GCM EncryptUpdate")
1208
+ + }
1209
+ + if _, err := ossl.EVP_EncryptFinal_ex(ctx, base(out[outl:]), &discard); err != nil {
1210
+ + panic(err)
1211
+ + }
1212
+ + if _, err := ossl.EVP_CIPHER_CTX_ctrl(ctx, ossl.EVP_CTRL_GCM_GET_TAG, 16, unsafe.Pointer(base(out[outl:]))); err != nil {
1213
+ + panic(err)
1214
+ + }
1215
+ + runtime.KeepAlive(g)
1216
+ + return
1217
+ +}
1218
+ +
1168
1219
+var errOpen = errors.New("cipher: message authentication failed")
1169
1220
+
1170
1221
+func (g *cipherGCM) Open(dst, nonce, ciphertext, aad []byte) (_ []byte, err error) {
@@ -12399,10 +12450,10 @@ index 00000000000000..c9f4d67de4c9f3
12399
12450
+}
12400
12451
diff --git a/src/vendor/github.com/microsoft/go-crypto-darwin/xcrypto/aes.go b/src/vendor/github.com/microsoft/go-crypto-darwin/xcrypto/aes.go
12401
12452
new file mode 100644
12402
- index 00000000000000..27a42bfc89ca06
12453
+ index 00000000000000..c9611eef5e2697
12403
12454
--- /dev/null
12404
12455
+++ b/src/vendor/github.com/microsoft/go-crypto-darwin/xcrypto/aes.go
12405
- @@ -0,0 +1,306 @@
12456
+ @@ -0,0 +1,336 @@
12406
12457
+// Copyright (c) Microsoft Corporation.
12407
12458
+// Licensed under the MIT License.
12408
12459
+
@@ -12623,6 +12674,36 @@ index 00000000000000..27a42bfc89ca06
12623
12674
+ return ret
12624
12675
+}
12625
12676
+
12677
+ +func (g *aesGCM) SealWithRandomNonce(out, nonce, plaintext, additionalData []byte) {
12678
+ + if uint64(len(plaintext)) > uint64((1<<32)-2)*aesBlockSize {
12679
+ + panic("crypto/cipher: message too large for GCM")
12680
+ + }
12681
+ + if len(nonce) != gcmStandardNonceSize {
12682
+ + panic("crypto/cipher: incorrect nonce length given to GCMWithRandomNonce")
12683
+ + }
12684
+ + if len(out) != len(plaintext)+gcmTagSize {
12685
+ + panic("crypto/cipher: incorrect output length given to GCMWithRandomNonce")
12686
+ + }
12687
+ + if inexactOverlap(out, plaintext) {
12688
+ + panic("crypto/cipher: invalid buffer overlap of output and input")
12689
+ + }
12690
+ + if anyOverlap(out, additionalData) {
12691
+ + panic("crypto/cipher: invalid buffer overlap of output and additional data")
12692
+ + }
12693
+ +
12694
+ + if g.tls != cipherGCMTLSNone {
12695
+ + panic("cipher: TLS 1.2 and 1.3 modes do not support random nonce")
12696
+ + }
12697
+ +
12698
+ + tag := out[len(out)-gcmTagSize:]
12699
+ + // Generate a random nonce
12700
+ + RandReader.Read(nonce)
12701
+ + err := cryptokit.EncryptAESGCM(g.key, plaintext, nonce, additionalData, out[:len(out)-gcmTagSize], tag)
12702
+ + if err != 0 {
12703
+ + panic("cipher: encryption failed")
12704
+ + }
12705
+ +}
12706
+ +
12626
12707
+var errOpen = errors.New("cipher: message authentication failed")
12627
12708
+
12628
12709
+func (g *aesGCM) Open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) {
@@ -14483,10 +14564,10 @@ index 00000000000000..9e841e7a26e4eb
14483
14564
+ SOFTWARE
14484
14565
diff --git a/src/vendor/github.com/microsoft/go-crypto-winnative/cng/aes.go b/src/vendor/github.com/microsoft/go-crypto-winnative/cng/aes.go
14485
14566
new file mode 100644
14486
- index 00000000000000..097a0fc77f0adb
14567
+ index 00000000000000..692a36ec7079cc
14487
14568
--- /dev/null
14488
14569
+++ b/src/vendor/github.com/microsoft/go-crypto-winnative/cng/aes.go
14489
- @@ -0,0 +1,393 @@
14570
+ @@ -0,0 +1,427 @@
14490
14571
+// Copyright (c) Microsoft Corporation.
14491
14572
+// Licensed under the MIT License.
14492
14573
+
@@ -14826,6 +14907,40 @@ index 00000000000000..097a0fc77f0adb
14826
14907
+ return ret
14827
14908
+}
14828
14909
+
14910
+ +func (g *aesGCM) SealWithRandomNonce(out, nonce, plaintext, additionalData []byte) {
14911
+ + if uint64(len(plaintext)) > uint64((1<<32)-2)*aesBlockSize {
14912
+ + panic("crypto/cipher: message too large for GCM")
14913
+ + }
14914
+ + if len(nonce) != gcmStandardNonceSize {
14915
+ + panic("crypto/cipher: incorrect nonce length given to GCMWithRandomNonce")
14916
+ + }
14917
+ + if len(out) != len(plaintext)+gcmTagSize {
14918
+ + panic("crypto/cipher: incorrect output length given to GCMWithRandomNonce")
14919
+ + }
14920
+ + if subtle.InexactOverlap(out, plaintext) {
14921
+ + panic("crypto/cipher: invalid buffer overlap of output and input")
14922
+ + }
14923
+ + if subtle.AnyOverlap(out, additionalData) {
14924
+ + panic("crypto/cipher: invalid buffer overlap of output and additional data")
14925
+ + }
14926
+ +
14927
+ + if g.tls != cipherGCMTLSNone {
14928
+ + panic("cipher: TLS 1.2 and 1.3 modes do not support random nonce")
14929
+ + }
14930
+ +
14931
+ + RandReader.Read(nonce)
14932
+ + info := bcrypt.NewAUTHENTICATED_CIPHER_MODE_INFO(nonce, additionalData, out[len(out)-gcmTagSize:])
14933
+ + var encSize uint32
14934
+ + err := bcrypt.Encrypt(g.kh, plaintext, unsafe.Pointer(info), nil, out, &encSize, 0)
14935
+ + if err != nil {
14936
+ + panic(err)
14937
+ + }
14938
+ + if int(encSize) != len(plaintext) {
14939
+ + panic("crypto/cipher: plaintext not fully encrypted")
14940
+ + }
14941
+ + runtime.KeepAlive(g)
14942
+ +}
14943
+ +
14829
14944
+var errOpen = errors.New("cipher: message authentication failed")
14830
14945
+
14831
14946
+func (g *aesGCM) Open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) {
@@ -18837,7 +18952,7 @@ index 00000000000000..1722410e5af193
18837
18952
+ return getSystemDirectory() + "\\" + dll
18838
18953
+}
18839
18954
diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt
18840
- index 4c87639632f887..35848b6d6cd2dd 100644
18955
+ index 4c87639632f887..271c698c1d681b 100644
18841
18956
--- a/src/vendor/modules.txt
18842
18957
+++ b/src/vendor/modules.txt
18843
18958
@@ -1,3 +1,20 @@
0 commit comments