@@ -3719,24 +3719,24 @@ index 3c592e1136..a594823783 100644
3719
3719
} else {
3720
3720
testCurve = elliptic.P384()
3721
3721
diff --git a/src/go.mod b/src/go.mod
3722
- index 737d78da5d..eafc127352 100644
3722
+ index 737d78da5d..a1610087fe 100644
3723
3723
--- a/src/go.mod
3724
3724
+++ b/src/go.mod
3725
3725
@@ -3,6 +3,7 @@ module std
3726
3726
go 1.22
3727
3727
3728
3728
require (
3729
- + github.com/golang-fips/openssl/v2 v2.0.1
3729
+ + github.com/golang-fips/openssl/v2 v2.0.3
3730
3730
golang.org/x/crypto v0.16.1-0.20231129163542-152cdb1503eb
3731
3731
golang.org/x/net v0.19.1-0.20240412193750-db050b07227e
3732
3732
)
3733
3733
diff --git a/src/go.sum b/src/go.sum
3734
- index 86d173c9e6..51fbaeecdf 100644
3734
+ index 86d173c9e6..c7def15f16 100644
3735
3735
--- a/src/go.sum
3736
3736
+++ b/src/go.sum
3737
3737
@@ -1,3 +1,5 @@
3738
- + github.com/golang-fips/openssl/v2 v2.0.1 h1:oNIu7tARUHmSIY7Gqn5lbSCnHSduvkFJoM2FRq294lA =
3739
- + github.com/golang-fips/openssl/v2 v2.0.1 /go.mod h1:7tuBqX2Zov8Yq5mJ2yzlKhpnxOnWyEzi38AzeWRuQdg=
3738
+ + github.com/golang-fips/openssl/v2 v2.0.3 h1:9+J2R0BQio6Jz8+dPZf/0ylISByl0gZWjTEKm+J+y7Y =
3739
+ + github.com/golang-fips/openssl/v2 v2.0.3 /go.mod h1:7tuBqX2Zov8Yq5mJ2yzlKhpnxOnWyEzi38AzeWRuQdg=
3740
3740
golang.org/x/crypto v0.16.1-0.20231129163542-152cdb1503eb h1:1ceSY7sk6sJuiDREHpfyrqDnDljsLfEP2GuTClhBBfI=
3741
3741
golang.org/x/crypto v0.16.1-0.20231129163542-152cdb1503eb/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
3742
3742
golang.org/x/net v0.19.1-0.20240412193750-db050b07227e h1:oDnvqaqHo3ho8OChMtkQbQAyp9eqnm3J7JRtt0+Cabc=
@@ -3784,7 +3784,7 @@ index 0000000000..97e8515401
3784
3784
\ No newline at end of file
3785
3785
diff --git a/src/vendor/github.com/golang-fips/openssl/v2/README.md b/src/vendor/github.com/golang-fips/openssl/v2/README.md
3786
3786
new file mode 100644
3787
- index 0000000000..ba6289ecff
3787
+ index 0000000000..1bfbaf60f4
3788
3788
--- /dev/null
3789
3789
+++ b/src/vendor/github.com/golang-fips/openssl/v2/README.md
3790
3790
@@ -0,0 +1,66 @@
@@ -3816,7 +3816,7 @@ index 0000000000..ba6289ecff
3816
3816
+
3817
3817
+ ### Multiple OpenSSL versions supported
3818
3818
+
3819
- + The `openssl` package has support for multiple OpenSSL versions, namely 1.0.2, 1.1.0, 1.1.1 and 3.0. x.
3819
+ + The `openssl` package has support for multiple OpenSSL versions, namely 1.0.2, 1.1.0, 1.1.1 and 3.x.
3820
3820
+
3821
3821
+ All supported OpenSSL versions pass a small set of automatic tests that ensure they can be built and that there are no major regressions.
3822
3822
+ These tests do not validate the cryptographic correctness of the `openssl` package.
@@ -4022,16 +4022,17 @@ index 0000000000..6461f241f8
4022
4022
+ type BigInt []uint
4023
4023
diff --git a/src/vendor/github.com/golang-fips/openssl/v2/cipher.go b/src/vendor/github.com/golang-fips/openssl/v2/cipher.go
4024
4024
new file mode 100644
4025
- index 0000000000..2b983c5411
4025
+ index 0000000000..72f7aebfc1
4026
4026
--- /dev/null
4027
4027
+++ b/src/vendor/github.com/golang-fips/openssl/v2/cipher.go
4028
- @@ -0,0 +1,582 @@
4028
+ @@ -0,0 +1,569 @@
4029
4029
+ //go:build !cmd_go_bootstrap
4030
4030
+
4031
4031
+ package openssl
4032
4032
+
4033
4033
+ // #include "goopenssl.h"
4034
4034
+ import "C"
4035
+ +
4035
4036
+ import (
4036
4037
+ "crypto/cipher"
4037
4038
+ "encoding/binary"
@@ -4173,8 +4174,6 @@ index 0000000000..2b983c5411
4173
4174
+
4174
4175
+ type evpCipher struct {
4175
4176
+ key []byte
4176
- + enc_ctx C.GO_EVP_CIPHER_CTX_PTR
4177
- + dec_ctx C.GO_EVP_CIPHER_CTX_PTR
4178
4177
+ kind cipherKind
4179
4178
+ blockSize int
4180
4179
+ }
@@ -4187,19 +4186,9 @@ index 0000000000..2b983c5411
4187
4186
+ c := &evpCipher{key: make([]byte, len(key)), kind: kind}
4188
4187
+ copy(c.key, key)
4189
4188
+ c.blockSize = int(C.go_openssl_EVP_CIPHER_get_block_size(cipher))
4190
- + runtime.SetFinalizer(c, (*evpCipher).finalize)
4191
4189
+ return c, nil
4192
4190
+ }
4193
4191
+
4194
- + func (c *evpCipher) finalize() {
4195
- + if c.enc_ctx != nil {
4196
- + C.go_openssl_EVP_CIPHER_CTX_free(c.enc_ctx)
4197
- + }
4198
- + if c.dec_ctx != nil {
4199
- + C.go_openssl_EVP_CIPHER_CTX_free(c.dec_ctx)
4200
- + }
4201
- + }
4202
- +
4203
4192
+ func (c *evpCipher) encrypt(dst, src []byte) error {
4204
4193
+ if len(src) < c.blockSize {
4205
4194
+ return errors.New("input not full block")
@@ -4212,15 +4201,13 @@ index 0000000000..2b983c5411
4212
4201
+ if inexactOverlap(dst[:c.blockSize], src[:c.blockSize]) {
4213
4202
+ return errors.New("invalid buffer overlap")
4214
4203
+ }
4215
- + if c.enc_ctx == nil {
4216
- + var err error
4217
- + c.enc_ctx, err = newCipherCtx(c.kind, cipherModeECB, cipherOpEncrypt, c.key, nil)
4218
- + if err != nil {
4219
- + return err
4220
- + }
4204
+ + enc_ctx, err := newCipherCtx(c.kind, cipherModeECB, cipherOpEncrypt, c.key, nil)
4205
+ + if err != nil {
4206
+ + return err
4221
4207
+ }
4208
+ + defer C.go_openssl_EVP_CIPHER_CTX_free(enc_ctx)
4222
4209
+
4223
- + if C.go_openssl_EVP_EncryptUpdate_wrapper(c. enc_ctx, base(dst), base(src), C.int(c.blockSize)) != 1 {
4210
+ + if C.go_openssl_EVP_EncryptUpdate_wrapper(enc_ctx, base(dst), base(src), C.int(c.blockSize)) != 1 {
4224
4211
+ return errors.New("EncryptUpdate failed")
4225
4212
+ }
4226
4213
+ runtime.KeepAlive(c)
@@ -4239,18 +4226,17 @@ index 0000000000..2b983c5411
4239
4226
+ if inexactOverlap(dst[:c.blockSize], src[:c.blockSize]) {
4240
4227
+ return errors.New("invalid buffer overlap")
4241
4228
+ }
4242
- + if c.dec_ctx == nil {
4243
- + var err error
4244
- + c.dec_ctx, err = newCipherCtx(c.kind, cipherModeECB, cipherOpDecrypt, c.key, nil)
4245
- + if err != nil {
4246
- + return err
4247
- + }
4248
- + if C.go_openssl_EVP_CIPHER_CTX_set_padding(c.dec_ctx, 0) != 1 {
4249
- + return errors.New("could not disable cipher padding")
4250
- + }
4229
+ + dec_ctx, err := newCipherCtx(c.kind, cipherModeECB, cipherOpDecrypt, c.key, nil)
4230
+ + if err != nil {
4231
+ + return err
4232
+ + }
4233
+ + defer C.go_openssl_EVP_CIPHER_CTX_free(dec_ctx)
4234
+ +
4235
+ + if C.go_openssl_EVP_CIPHER_CTX_set_padding(dec_ctx, 0) != 1 {
4236
+ + return errors.New("could not disable cipher padding")
4251
4237
+ }
4252
4238
+
4253
- + C.go_openssl_EVP_DecryptUpdate_wrapper(c. dec_ctx, base(dst), base(src), C.int(c.blockSize))
4239
+ + C.go_openssl_EVP_DecryptUpdate_wrapper(dec_ctx, base(dst), base(src), C.int(c.blockSize))
4254
4240
+ runtime.KeepAlive(c)
4255
4241
+ return nil
4256
4242
+ }
@@ -4349,7 +4335,7 @@ index 0000000000..2b983c5411
4349
4335
+ )
4350
4336
+
4351
4337
+ type cipherGCM struct {
4352
- + ctx C.GO_EVP_CIPHER_CTX_PTR
4338
+ + c *evpCipher
4353
4339
+ tls cipherGCMTLS
4354
4340
+ // minNextNonce is the minimum value that the next nonce can be, enforced by
4355
4341
+ // all TLS modes.
@@ -4407,19 +4393,10 @@ index 0000000000..2b983c5411
4407
4393
+ }
4408
4394
+
4409
4395
+ func (c *evpCipher) newGCM(tls cipherGCMTLS) (cipher.AEAD, error) {
4410
- + ctx, err := newCipherCtx(c.kind, cipherModeGCM, cipherOpNone, c.key, nil)
4411
- + if err != nil {
4412
- + return nil, err
4413
- + }
4414
- + g := &cipherGCM{ctx: ctx, tls: tls, blockSize: c.blockSize}
4415
- + runtime.SetFinalizer(g, (*cipherGCM).finalize)
4396
+ + g := &cipherGCM{c: c, tls: tls, blockSize: c.blockSize}
4416
4397
+ return g, nil
4417
4398
+ }
4418
4399
+
4419
- + func (g *cipherGCM) finalize() {
4420
- + C.go_openssl_EVP_CIPHER_CTX_free(g.ctx)
4421
- + }
4422
- +
4423
4400
+ func (g *cipherGCM) NonceSize() int {
4424
4401
+ return gcmStandardNonceSize
4425
4402
+ }
@@ -4492,14 +4469,19 @@ index 0000000000..2b983c5411
4492
4469
+ panic("cipher: invalid buffer overlap")
4493
4470
+ }
4494
4471
+
4472
+ + ctx, err := newCipherCtx(g.c.kind, cipherModeGCM, cipherOpNone, g.c.key, nil)
4473
+ + if err != nil {
4474
+ + panic(err)
4475
+ + }
4476
+ + defer C.go_openssl_EVP_CIPHER_CTX_free(ctx)
4495
4477
+ // Encrypt additional data.
4496
4478
+ // When sealing a TLS payload, OpenSSL app sets the additional data using
4497
4479
+ // 'EVP_CIPHER_CTX_ctrl(g.ctx, C.EVP_CTRL_AEAD_TLS1_AAD, C.EVP_AEAD_TLS1_AAD_LEN, base(additionalData))'.
4498
4480
+ // This makes the explicit nonce component to monotonically increase on every Seal operation without
4499
4481
+ // relying in the explicit nonce being securely set externally,
4500
4482
+ // and it also gives some interesting speed gains.
4501
4483
+ // Unfortunately we can't use it because Go expects AEAD.Seal to honor the provided nonce.
4502
- + if C.go_openssl_EVP_CIPHER_CTX_seal_wrapper(g. ctx, base(out), base(nonce),
4484
+ + if C.go_openssl_EVP_CIPHER_CTX_seal_wrapper(ctx, base(out), base(nonce),
4503
4485
+ base(plaintext), C.int(len(plaintext)),
4504
4486
+ base(additionalData), C.int(len(additionalData))) != 1 {
4505
4487
+
@@ -4534,8 +4516,13 @@ index 0000000000..2b983c5411
4534
4516
+ panic("cipher: invalid buffer overlap")
4535
4517
+ }
4536
4518
+
4519
+ + ctx, err := newCipherCtx(g.c.kind, cipherModeGCM, cipherOpNone, g.c.key, nil)
4520
+ + if err != nil {
4521
+ + return nil, err
4522
+ + }
4523
+ + defer C.go_openssl_EVP_CIPHER_CTX_free(ctx)
4537
4524
+ ok := C.go_openssl_EVP_CIPHER_CTX_open_wrapper(
4538
- + g. ctx, base(out), base(nonce),
4525
+ + ctx, base(out), base(nonce),
4539
4526
+ base(ciphertext), C.int(len(ciphertext)),
4540
4527
+ base(additionalData), C.int(len(additionalData)), base(tag))
4541
4528
+ runtime.KeepAlive(g)
@@ -7826,15 +7813,15 @@ index 0000000000..a14663298b
7826
7813
+ }
7827
7814
diff --git a/src/vendor/github.com/golang-fips/openssl/v2/init_unix.go b/src/vendor/github.com/golang-fips/openssl/v2/init_unix.go
7828
7815
new file mode 100644
7829
- index 0000000000..dbf5ac448f
7816
+ index 0000000000..5c09da86ee
7830
7817
--- /dev/null
7831
7818
+++ b/src/vendor/github.com/golang-fips/openssl/v2/init_unix.go
7832
7819
@@ -0,0 +1,31 @@
7833
7820
+ //go:build unix && !cmd_go_bootstrap
7834
7821
+
7835
7822
+ package openssl
7836
7823
+
7837
- + // #cgo LDFLAGS: -ldl
7824
+ + // #cgo LDFLAGS: -ldl -pthread
7838
7825
+ // #include <stdlib.h>
7839
7826
+ // #include <dlfcn.h>
7840
7827
+ import "C"
@@ -9688,11 +9675,11 @@ index 0000000000..5de62f95a7
9688
9675
+ return nil
9689
9676
+ }
9690
9677
diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt
9691
- index 9a234e59b1..f65e24f457 100644
9678
+ index 9a234e59b1..a2dc68599f 100644
9692
9679
--- a/src/vendor/modules.txt
9693
9680
+++ b/src/vendor/modules.txt
9694
9681
@@ -1,3 +1,7 @@
9695
- + # github.com/golang-fips/openssl/v2 v2.0.1
9682
+ + # github.com/golang-fips/openssl/v2 v2.0.3
9696
9683
+ ## explicit; go 1.20
9697
9684
+ github.com/golang-fips/openssl/v2
9698
9685
+ github.com/golang-fips/openssl/v2/bbig
0 commit comments