aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/configfile/config_file.go2
-rw-r--r--internal/configfile/config_test.go23
2 files changed, 23 insertions, 2 deletions
diff --git a/internal/configfile/config_file.go b/internal/configfile/config_file.go
index c769b99..bf56f8b 100644
--- a/internal/configfile/config_file.go
+++ b/internal/configfile/config_file.go
@@ -58,6 +58,7 @@ func CreateConfFile(filename string, password string, plaintextNames bool, logN
// Set feature flags
cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagGCMIV128])
+ cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagHKDF])
if plaintextNames {
cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagPlaintextNames])
} else {
@@ -65,7 +66,6 @@ func CreateConfFile(filename string, password string, plaintextNames bool, logN
cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagEMENames])
cf.FeatureFlags = append(cf.FeatureFlags, knownFlags[FlagLongNames])
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 42a0f2f..dc796ea 100644
--- a/internal/configfile/config_test.go
+++ b/internal/configfile/config_test.go
@@ -59,7 +59,7 @@ func TestLoadV2StrangeFeature(t *testing.T) {
}
}
-func TestCreateConfFile(t *testing.T) {
+func TestCreateConfDefault(t *testing.T) {
err := CreateConfFile("config_test/tmp.conf", "test", false, 10, "test", false)
if err != nil {
t.Fatal(err)
@@ -80,6 +80,27 @@ func TestCreateConfFile(t *testing.T) {
}
}
+func TestCreateConfPlaintextnames(t *testing.T) {
+ err := CreateConfFile("config_test/tmp.conf", "test", true, 10, "test", false)
+ if err != nil {
+ t.Fatal(err)
+ }
+ _, c, err := LoadConfFile("config_test/tmp.conf", "test")
+ if err != nil {
+ t.Fatal(err)
+ }
+ // Check that all expected feature flags are set
+ want := []flagIota{
+ FlagGCMIV128, FlagHKDF,
+ }
+ for _, f := range want {
+ if !c.IsFeatureFlagSet(f) {
+ t.Errorf("Feature flag %q should be set but is not", knownFlags[f])
+ }
+ }
+}
+
+// Reverse mode uses AESSIV
func TestCreateConfFileAESSIV(t *testing.T) {
err := CreateConfFile("config_test/tmp.conf", "test", false, 10, "test", true)
if err != nil {