From 97d8340bd81ddd60baac598d3e25ebfb4decb50c Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 21 Aug 2021 21:43:26 +0200 Subject: configfile: add Validate() function, support FlagXChaCha20Poly1305 We used to do validation using lists of mandatory feature flags. With the introduction of XChaCha20Poly1305, this became too simplistic, as it uses a different IV length, hence disabling GCMIV128. Add a dedicated function, Validate(), with open-coded validation logic. The validation and creation logic also gets XChaCha20Poly1305 support, and gocryptfs -init -xchacha now writes the flag into gocryptfs.conf. --- internal/configfile/config_test.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'internal/configfile/config_test.go') diff --git a/internal/configfile/config_test.go b/internal/configfile/config_test.go index 6986888..021b6c1 100644 --- a/internal/configfile/config_test.go +++ b/internal/configfile/config_test.go @@ -152,15 +152,14 @@ func TestIsFeatureFlagKnown(t *testing.T) { testKnownFlags = append(testKnownFlags, f) } - var cf ConfFile for _, f := range testKnownFlags { - if !cf.isFeatureFlagKnown(f) { + if !isFeatureFlagKnown(f) { t.Errorf("flag %q should be known", f) } } f := "StrangeFeatureFlag" - if cf.isFeatureFlagKnown(f) { + if isFeatureFlagKnown(f) { t.Errorf("flag %q should be NOT known", f) } } -- cgit v1.2.3