diff --git a/changelogs/unreleased/10579-Lyndon-Li b/changelogs/unreleased/10579-Lyndon-Li new file mode 100644 index 000000000..10edc6bdc --- /dev/null +++ b/changelogs/unreleased/10579-Lyndon-Li @@ -0,0 +1 @@ +Fix issue #10576, change hashing algorithm to HMAC-SHA256-128 for kopia repo \ No newline at end of file diff --git a/pkg/repository/udmrepo/kopialib/backend/common.go b/pkg/repository/udmrepo/kopialib/backend/common.go index 7af061204..2af3512bf 100644 --- a/pkg/repository/udmrepo/kopialib/backend/common.go +++ b/pkg/repository/udmrepo/kopialib/backend/common.go @@ -26,15 +26,15 @@ import ( "github.com/kopia/kopia/repo/content" "github.com/kopia/kopia/repo/encryption" "github.com/kopia/kopia/repo/format" - "github.com/kopia/kopia/repo/hashing" "github.com/kopia/kopia/repo/splitter" "github.com/vmware-tanzu/velero/pkg/repository/udmrepo" ) const ( - DefaultCacheLimitMB = 5000 - maxCacheDurationSecond = 30 + DefaultCacheLimitMB = 5000 + maxCacheDurationSecond = 30 + defaultHashingAlgorithm = "HMAC-SHA256-128" ) func setupLimits(ctx context.Context, flags map[string]string) throttling.Limits { @@ -51,7 +51,7 @@ func setupLimits(ctx context.Context, flags map[string]string) throttling.Limits func SetupNewRepositoryOptions(ctx context.Context, flags map[string]string) repo.NewRepositoryOptions { return repo.NewRepositoryOptions{ BlockFormat: format.ContentFormat{ - Hash: optionalHaveStringWithDefault(udmrepo.StoreOptionGenHashAlgo, flags, hashing.DefaultAlgorithm), + Hash: optionalHaveStringWithDefault(udmrepo.StoreOptionGenHashAlgo, flags, defaultHashingAlgorithm), Encryption: optionalHaveStringWithDefault(udmrepo.StoreOptionGenEncryptAlgo, flags, encryption.DefaultAlgorithm), }, diff --git a/pkg/repository/udmrepo/kopialib/backend/common_test.go b/pkg/repository/udmrepo/kopialib/backend/common_test.go index 1083bca9a..0e21959ae 100644 --- a/pkg/repository/udmrepo/kopialib/backend/common_test.go +++ b/pkg/repository/udmrepo/kopialib/backend/common_test.go @@ -24,7 +24,6 @@ import ( "github.com/kopia/kopia/repo/content" "github.com/kopia/kopia/repo/encryption" "github.com/kopia/kopia/repo/format" - "github.com/kopia/kopia/repo/hashing" "github.com/kopia/kopia/repo/splitter" "github.com/stretchr/testify/assert" @@ -59,7 +58,7 @@ func TestSetupNewRepositoryOptions(t *testing.T) { }, expected: repo.NewRepositoryOptions{ BlockFormat: format.ContentFormat{ - Hash: hashing.DefaultAlgorithm, + Hash: defaultHashingAlgorithm, Encryption: "fake-encrypt", }, ObjectFormat: format.ObjectFormat{ @@ -74,7 +73,7 @@ func TestSetupNewRepositoryOptions(t *testing.T) { }, expected: repo.NewRepositoryOptions{ BlockFormat: format.ContentFormat{ - Hash: hashing.DefaultAlgorithm, + Hash: defaultHashingAlgorithm, Encryption: encryption.DefaultAlgorithm, }, ObjectFormat: format.ObjectFormat{ @@ -89,7 +88,7 @@ func TestSetupNewRepositoryOptions(t *testing.T) { }, expected: repo.NewRepositoryOptions{ BlockFormat: format.ContentFormat{ - Hash: hashing.DefaultAlgorithm, + Hash: defaultHashingAlgorithm, Encryption: encryption.DefaultAlgorithm, }, ObjectFormat: format.ObjectFormat{