From 7766efd2d2d3fd117a93531c375a170e3e44991b Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 19:13:47 +0000 Subject: [PATCH] test: increase passwd length in crypto io tests (#6380) (#6407) the password is used to derive a key using pbkdf2 and hmac. In fips only mode use of keys shorter than 112 bits is not allowed for hmac. Update the test to use longer passwords. (cherry picked from commit 3c4861cc6f34cd28eb4d116e24341952f2b03744) Co-authored-by: kruskall <99559985+kruskall@users.noreply.github.com> --- internal/pkg/crypto/io_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/pkg/crypto/io_test.go b/internal/pkg/crypto/io_test.go index 76fd455f184..f8188c860da 100644 --- a/internal/pkg/crypto/io_test.go +++ b/internal/pkg/crypto/io_test.go @@ -15,7 +15,7 @@ import ( func TestIO(t *testing.T) { t.Run("encode and decode with the right password", func(t *testing.T) { - passwd := []byte("hello") + passwd := bytes.Repeat([]byte("hello"), 10) msg := []byte("bonjour la famille") dest := new(bytes.Buffer) @@ -40,7 +40,7 @@ func TestIO(t *testing.T) { }) t.Run("Large single write", func(t *testing.T) { - passwd := []byte("hello") + passwd := bytes.Repeat([]byte("hello"), 10) msg, err := randomBytes(1327) require.NoError(t, err) @@ -67,7 +67,7 @@ func TestIO(t *testing.T) { }) t.Run("try to decode with the wrong password", func(t *testing.T) { - passwd := []byte("hello") + passwd := bytes.Repeat([]byte("hello"), 10) msg := []byte("bonjour la famille") dest := new(bytes.Buffer) @@ -90,7 +90,7 @@ func TestIO(t *testing.T) { }) t.Run("Make sure that buffered IO works with the encoder", func(t *testing.T) { - passwd := []byte("hello") + passwd := bytes.Repeat([]byte("hello"), 10) msg, err := randomBytes(2048) require.NoError(t, err) dest := new(bytes.Buffer) @@ -121,7 +121,7 @@ func TestIO(t *testing.T) { }) t.Run("Make sure that buffered IO works with the decoder", func(t *testing.T) { - passwd := []byte("hello") + passwd := bytes.Repeat([]byte("hello"), 10) msg, err := randomBytes(2048) require.NoError(t, err) dest := new(bytes.Buffer) @@ -163,7 +163,7 @@ func TestIO(t *testing.T) { }) t.Run("works with multiple writes", func(t *testing.T) { - passwd := []byte("hello") + passwd := bytes.Repeat([]byte("hello"), 10) expected := []byte("hello world bonjour la famille")