chiark / gitweb /
build-sys: create Makefile-man.am automatically
[elogind.git] / src / cryptsetup / cryptsetup.c
index 916509ab93481b17b3ddd30077f89e759f12c113..a8cdf10177b6311642470d05976610c2fa7bbe7f 100644 (file)
@@ -62,7 +62,7 @@ static int parse_one_option(const char *option) {
         assert(option);
 
         /* Handled outside of this tool */
-        if (streq(option, "noauto"))
+        if (streq(option, "noauto") || streq(option, "nofail"))
                 return 0;
 
         if (startswith(option, "cipher=")) {
@@ -111,7 +111,7 @@ static int parse_one_option(const char *option) {
                         return 0;
                 }
 
-        } else if (streq(option, "readonly"))
+        } else if (streq(option, "readonly") || streq(option, "read-only"))
                 opt_readonly = true;
         else if (streq(option, "verify"))
                 opt_verify = true;
@@ -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) {