From 0cab9ad96d222f84e584f88f59c5680365228ec9 Mon Sep 17 00:00:00 2001 From: mertakman Date: Mon, 30 Sep 2024 14:46:46 +0100 Subject: [PATCH] fix:add fix for few format issues --- cmd/mksyscall/main.go | 2 +- internal/cryptotest/aead.go | 8 ++++---- internal/subtle/aliasing_test.go | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/mksyscall/main.go b/cmd/mksyscall/main.go index 8f7ecd0..eec3b93 100644 --- a/cmd/mksyscall/main.go +++ b/cmd/mksyscall/main.go @@ -103,6 +103,6 @@ func generateSyscalls() []byte { log.Fatal(err) } zsys := bout.Bytes() - zsys = bytes.Replace(zsys, []byte("\"internal/syscall/windows/sysdll\""), []byte("\"github.com/microsoft/go-crypto-winnative/internal/sysdll\""), -1) + zsys = bytes.ReplaceAll(zsys, []byte("\"internal/syscall/windows/sysdll\""), []byte("\"github.com/microsoft/go-crypto-winnative/internal/sysdll\"")) return zsys } diff --git a/internal/cryptotest/aead.go b/internal/cryptotest/aead.go index a6107e5..65f21d5 100644 --- a/internal/cryptotest/aead.go +++ b/internal/cryptotest/aead.go @@ -273,7 +273,7 @@ func TestAEAD(t *testing.T, mAEAD MakeAEAD) { // Perturb the nonce and check for an error when Opening alterNonce := make([]byte, aead.NonceSize()) copy(alterNonce, nonce) - alterNonce[len(alterNonce)-1] += 1 + alterNonce[len(alterNonce)-1]++ _, err := aead.Open(nil, alterNonce, ciphertext, addData) if err == nil { @@ -308,7 +308,7 @@ func TestAEAD(t *testing.T, mAEAD MakeAEAD) { // Perturb the Additional Data and check for an error when Opening alterAD := make([]byte, adLen) copy(alterAD, addData) - alterAD[len(alterAD)-1] += 1 + alterAD[len(alterAD)-1]++ _, err := aead.Open(nil, nonce, ciphertext, alterAD) if err == nil { @@ -340,7 +340,7 @@ func TestAEAD(t *testing.T, mAEAD MakeAEAD) { // Perturb the ciphertext and check for an error when Opening alterCT := make([]byte, len(ciphertext)) copy(alterCT, ciphertext) - alterCT[len(alterCT)-1] += 1 + alterCT[len(alterCT)-1]++ _, err := aead.Open(nil, nonce, alterCT, addData) if err == nil { @@ -353,7 +353,7 @@ func TestAEAD(t *testing.T, mAEAD MakeAEAD) { } // Helper function to Seal a plaintext with additional data. Checks that -// ciphertext isn't bigger than the plaintext length plus Overhead() +// ciphertext isn't bigger than the plaintext length plus Overhead(). func sealMsg(t *testing.T, aead cipher.AEAD, ciphertext, nonce, plaintext, addData []byte) []byte { t.Helper() diff --git a/internal/subtle/aliasing_test.go b/internal/subtle/aliasing_test.go index 2a94494..71b5b2c 100644 --- a/internal/subtle/aliasing_test.go +++ b/internal/subtle/aliasing_test.go @@ -32,13 +32,13 @@ var aliasingTests = []struct { } func testAliasing(t *testing.T, i int, x, y []byte, anyOverlap, inexactOverlap bool) { - any := subtle.AnyOverlap(x, y) - if any != anyOverlap { - t.Errorf("%d: wrong AnyOverlap result, expected %v, got %v", i, anyOverlap, any) + isOverlapping := subtle.AnyOverlap(x, y) + if isOverlapping != anyOverlap { + t.Errorf("%d: wrong AnyOverlap result, expected %v, got %v", i, anyOverlap, isOverlapping) } inexact := subtle.InexactOverlap(x, y) if inexact != inexactOverlap { - t.Errorf("%d: wrong InexactOverlap result, expected %v, got %v", i, inexactOverlap, any) + t.Errorf("%d: wrong InexactOverlap result, expected %v, got %v", i, inexactOverlap, isOverlapping) } }