configfile: enable HKDF and Raw64 feature flags by default

Also adds a test to verify that they are set in new config
files.
This commit is contained in:
Jakob Unterwurzacher 2017-03-06 22:20:28 +01:00
parent a80d798c2d
commit 9f17a78b4a
2 changed files with 12 additions and 10 deletions

View File

@ -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[FlagDirIV])
cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagEMENames]) cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagEMENames])
cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagLongNames]) cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagLongNames])
// TODO enable these and release as v1.3-beta1 once we have enough test cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagRaw64])
// coverage. Also enable the Raw64 check in TestCreateConfFile()! cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagHKDF])
//cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagRaw64])
//cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagHKDF])
} }
if aessiv { if aessiv {
cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagAESSIV]) cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagAESSIV])

View File

@ -64,16 +64,20 @@ func TestCreateConfFile(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
_, _, err = LoadConfFile("config_test/tmp.conf", "test") _, c, err := LoadConfFile("config_test/tmp.conf", "test")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
// Raw64 is set by default since gocryptfs v1.3 // Check that all expected feature flags are set
/* want := []flagIota{
if !c.IsFeatureFlagSet(FlagRaw64) { FlagGCMIV128, FlagDirIV, FlagEMENames, FlagLongNames,
t.Error("FlagRaw64 flag should be set but is not") 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) { func TestCreateConfFileAESSIV(t *testing.T) {