Verity salt size is really uint16 in sb and uint32 internally.
[platform/upstream/cryptsetup.git] / lib / utils_crypt.c
index 683409a..1fe9555 100644 (file)
@@ -1,8 +1,8 @@
 /*
- * util_crypt - cipher utilities for cryptsetup
+ * utils_crypt - cipher utilities for cryptsetup
  *
  * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2011, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -58,6 +58,15 @@ int crypt_parse_name_and_mode(const char *s, char *cipher, int *key_nums,
                return 0;
        }
 
+       /* Short version for "empty" cipher */
+       if (!strcmp(s, "null")) {
+               strncpy(cipher, "cipher_null", MAX_CIPHER_LEN);
+               strncpy(cipher_mode, "ecb", 9);
+               if (key_nums)
+                       *key_nums = 0;
+               return 0;
+       }
+
        if (sscanf(s, "%" MAX_CIPHER_LEN_STR "[^-]", cipher) == 1) {
                strncpy(cipher_mode, "cbc-plain", 10);
                if (key_nums)
@@ -368,7 +377,7 @@ int crypt_get_key(const char *prompt,
 
        /* Fail if we exceeded internal default (no specified size) */
        if (unlimited_read && i == keyfile_size_max) {
-               log_err(cd, _("Maximum keyfile size exceeeded.\n"));
+               log_err(cd, _("Maximum keyfile size exceeded.\n"));
                goto out_err;
        }