chiark / gitweb /
hwdb: OUI - use ID_OUI_FROM_DATABASE=
[elogind.git] / src / cryptsetup / cryptsetup.c
index 916509ab93481b17b3ddd30077f89e759f12c113..56a3b50974671114551ab1ef58a1048a68a09215 100644 (file)
@@ -342,7 +342,12 @@ int main(int argc, char *argv[]) {
 
                 opt_tries = opt_tries > 0 ? opt_tries : 3;
                 opt_key_size = (opt_key_size > 0 ? opt_key_size : 256);
-                hash = opt_hash ? opt_hash : "ripemd160";
+                if (opt_hash) {
+                        /* plain isn't a real hash type. it just means "use no hash" */
+                        if (!streq(opt_hash, "plain"))
+                                hash = opt_hash;
+                } else
+                        hash = "ripemd160";
 
                 if (opt_cipher) {
                         size_t l;
@@ -463,7 +468,8 @@ int main(int argc, char *argv[]) {
                                                  opt_keyfile_size,
                                                  &params);
 
-                                pass_volume_key = streq(hash, "plain");
+                                /* hash == NULL implies the user passed "plain" */
+                                pass_volume_key = (hash == NULL);
                         }
 
                         if (k < 0) {