From 3ba1fa3cee58aabaee0550b19d2bcb9a103f82d0 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sat, 24 Feb 2024 17:20:10 +0100 Subject: [PATCH] repository: remove a few global variables --- internal/repository/key.go | 2 +- internal/repository/testing.go | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/internal/repository/key.go b/internal/repository/key.go index d9f8d8e17..4d597da4d 100644 --- a/internal/repository/key.go +++ b/internal/repository/key.go @@ -47,7 +47,7 @@ type Key struct { // calibrated on the first run of AddKey(). var Params *crypto.Params -var ( +const ( // KDFTimeout specifies the maximum runtime for the KDF. KDFTimeout = 500 * time.Millisecond diff --git a/internal/repository/testing.go b/internal/repository/testing.go index dbbdbeb07..faa40c70a 100644 --- a/internal/repository/testing.go +++ b/internal/repository/testing.go @@ -17,13 +17,6 @@ import ( "github.com/restic/chunker" ) -// testKDFParams are the parameters for the KDF to be used during testing. -var testKDFParams = crypto.Params{ - N: 128, - R: 1, - P: 1, -} - type logger interface { Logf(format string, args ...interface{}) } @@ -31,7 +24,11 @@ type logger interface { // TestUseLowSecurityKDFParameters configures low-security KDF parameters for testing. func TestUseLowSecurityKDFParameters(t logger) { t.Logf("using low-security KDF parameters for test") - Params = &testKDFParams + Params = &crypto.Params{ + N: 128, + R: 1, + P: 1, + } } // TestBackend returns a fully configured in-memory backend.