chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
util: fix fd_cloexec(), fd_nonblock()
[elogind.git]
/
src
/
cryptsetup
/
cryptsetup.c
diff --git
a/src/cryptsetup/cryptsetup.c
b/src/cryptsetup/cryptsetup.c
index a647a94e6e52ffa47d8d0147bff80477a4ad05de..812b32f6cab2e140635e8ca362da817653cd5535 100644
(file)
--- a/
src/cryptsetup/cryptsetup.c
+++ b/
src/cryptsetup/cryptsetup.c
@@
-88,6
+88,13
@@
static int parse_one_option(const char *option) {
return 0;
}
return 0;
}
+ if (arg_key_size % 8) {
+ log_error("size= not a multiple of 8, ignoring.");
+ return 0;
+ }
+
+ arg_key_size /= 8;
+
} else if (startswith(option, "key-slot=")) {
arg_type = CRYPT_LUKS1;
} else if (startswith(option, "key-slot=")) {
arg_type = CRYPT_LUKS1;
@@
-414,7
+421,7
@@
static int attach_luks_or_plain(struct crypt_device *cd,
/* for CRYPT_PLAIN limit reads
* from keyfile to key length, and
* ignore keyfile-size */
/* for CRYPT_PLAIN limit reads
* from keyfile to key length, and
* ignore keyfile-size */
- arg_keyfile_size = arg_key_size
/ 8
;
+ arg_keyfile_size = arg_key_size;
/* In contrast to what the name
* crypt_setup() might suggest this
/* In contrast to what the name
* crypt_setup() might suggest this
@@
-577,7
+584,7
@@
int main(int argc, char *argv[]) {
else
until = 0;
else
until = 0;
- arg_key_size = (arg_key_size > 0 ? arg_key_size :
256
);
+ arg_key_size = (arg_key_size > 0 ? arg_key_size :
(256 / 8)
);
if (key_file) {
struct stat st;
if (key_file) {
struct stat st;