Debian Codegraph @

internal/crypto/crypto_internal_test.go

raw
1 package crypto
2
3 import "testing"
4
5 func TestPutScratchClearsEncryptedScratch(t *testing.T) {
6 t.Parallel()
7
8 cipher, err := New("test-key")
9 if err != nil {
10 t.Fatal(err)
11 }
12
13 scratch := cipher.getScratch()
14
15 for index := range scratch.encrypted {
16 scratch.encrypted[index] = 0xff
17 }
18
19 cipher.putScratch(scratch)
20
21 for index, value := range scratch.encrypted {
22 if value != 0 {
23 t.Fatalf("encrypted scratch byte %d was not cleared", index)
24 }
25 }
26 }