aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-03-06 22:20:28 +0100
committerJakob Unterwurzacher2017-03-07 20:56:50 +0100
commit9f17a78b4a63d7ab5b7e09c294a483c8b806aa49 (patch)
treeda9fc15d09fa4ce3edee8a9063da630d8b4560c4
parenta80d798c2deab44e2abc37eeae59546f0d7eec40 (diff)
configfile: enable HKDF and Raw64 feature flags by default
Also adds a test to verify that they are set in new config files.
-rw-r--r--internal/configfile/config_file.go6
-rw-r--r--internal/configfile/config_test.go16
2 files changed, 12 insertions, 10 deletions
diff --git a/internal/configfile/config_file.go b/internal/configfile/config_file.go
index 7a94fcb..c769b99 100644
--- a/internal/configfile/config_file.go
+++ b/internal/configfile/config_file.go
@@ -64,10 +64,8 @@ func CreateConfFile(filename string, password string, plaintextNames bool, logN
cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagDirIV])
cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagEMENames])
cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagLongNames])
- // TODO enable these and release as v1.3-beta1 once we have enough test
- // coverage. Also enable the Raw64 check in TestCreateConfFile()!
- //cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagRaw64])
- //cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagHKDF])
+ cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagRaw64])
+ cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagHKDF])
}
if aessiv {
cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagAESSIV])
diff --git a/internal/configfile/config_test.go b/internal/configfile/config_test.go
index 3b72536..42a0f2f 100644
--- a/internal/configfile/config_test.go
+++ b/internal/configfile/config_test.go
@@ -64,16 +64,20 @@ func TestCreateConfFile(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- _, _, err = LoadConfFile("config_test/tmp.conf", "test")
+ _, c, err := LoadConfFile("config_test/tmp.conf", "test")
if err != nil {
t.Fatal(err)
}
- // Raw64 is set by default since gocryptfs v1.3
- /*
- if !c.IsFeatureFlagSet(FlagRaw64) {
- t.Error("FlagRaw64 flag should be set but is not")
+ // Check that all expected feature flags are set
+ want := []flagIota{
+ FlagGCMIV128, FlagDirIV, FlagEMENames, FlagLongNames,
+ FlagRaw64, FlagHKDF,
+ }
+ for _, f := range want {
+ if !c.IsFeatureFlagSet(f) {
+ t.Errorf("Feature flag %q should be set but is not", knownFlags[f])
}
- */
+ }
}
func TestCreateConfFileAESSIV(t *testing.T) {