diff --git a/zkey/zkey-cryptsetup.1 b/zkey/zkey-cryptsetup.1 index ffd600d4..20a3cd20 100644 --- a/zkey/zkey-cryptsetup.1 +++ b/zkey/zkey-cryptsetup.1 @@ -34,7 +34,7 @@ To encrypt a volume using \fBLUKS2\fP and the \fBpaes\fP cipher, generate a secure AES key using \fBzkey\fP: \fB'zkey generate luks.key \-\-xts'\fP. Then format the device with \fBcryptsetup\fP using the just generated secure AES key from file luks.key: \fB'cryptsetup luksFormat \-\-type luks2 -\-\-cipher paes\-xts\-plain64 \-\-master\-key\-file luks.key +\-\-cipher paes\-xts\-plain64 \-\-volume\-key\-file luks.key \-\-key\-size 1024'\fP. For more details about \fBzkey\fP or \fBcryptsetup\fP see the corresponding man pages. . @@ -285,7 +285,7 @@ behave in the same way as with \fBcryptsetup\fP. .B zkey\-cryptsetup .BR setkey | setk .I device -.BR \-\-master\-key\-file | \-m +.BR \-\-volume\-key\-file | \-m .IR file\-name .RB [ \-\-key\-file | \-d .IR file\-name ] @@ -313,7 +313,7 @@ in a file, and this copy was re-enciphered when the CCA or EP11 master key has been changed. Thus, the copy of the secure key must be currently enciphered with the CCA or EP11 master key in the CURRENT or OLD master key register. Specify the secure key file with option -.B \-\-master\-key\-file +.B \-\-volume\-key\-file to set this secure key as the new volume key. .PP In case the LUKS2 header of the volume contains a verification pattern token, @@ -401,10 +401,15 @@ Suppresses all confirmation questions. Use with care! . .SS "Options for the setkey command" .TP -.BR \-m ", " \-\-master\-key\-file\~\fIfile\-name\fP +.BR \-m ", " \-\-volume\-key\-file\~\fIfile\-name\fP Specifies the name of a file containing the secure AES key that is set as the new volume key. .TP +.BR \-\-master\-key\-file\~\fIfile\-name\fP +Alias for the +.BR \-\-volume\-key\-file\~\fIfile\-name\fP +option. +.TP .BR \-q ", " \-\-batch\-mode Suppresses all confirmation questions. Use with care! . @@ -479,6 +484,6 @@ displays its attributes. Sets the verification pattern of the secure volume key of the encrypted volume /dev/dasdd1. .TP -.B zkey\-cryptsetup setkey /dev/dasdd1 \-\-master\-key\-file seckey.key +.B zkey\-cryptsetup setkey /dev/dasdd1 \-\-volume\-key\-file seckey.key Sets the secure key contained in file seckey.key as the new volume key for the encrypted volume /dev/dasdd1. diff --git a/zkey/zkey-cryptsetup.c b/zkey/zkey-cryptsetup.c index 784c574f..566cc076 100644 --- a/zkey/zkey-cryptsetup.c +++ b/zkey/zkey-cryptsetup.c @@ -102,7 +102,7 @@ static struct zkey_cryptsetup_globals { bool complete; bool inplace; bool staged; - char *master_key_file; + char *volume_key_file; bool batch_mode; bool debug; bool verbose; @@ -232,12 +232,19 @@ static struct util_opt opt_vec[] = { .command = COMMAND_SETKEY, }, { - .option = {"master-key-file", required_argument, NULL, 'm'}, + .option = {"volume-key-file", required_argument, NULL, 'm'}, .argument = "FILE-NAME", .desc = "Specifies the name of a file containing the secure " "AES key that is set as new volume key", .command = COMMAND_SETKEY, }, + { + .option = {"master-key-file", required_argument, NULL, 'm'}, + .argument = "FILE-NAME", + .desc = "Alias for the '--volume-key-file'|'-m' option", + .command = COMMAND_SETKEY, + .flags = UTIL_OPT_FLAG_NOSHORT, + }, OPT_PASSPHRASE_ENTRY(COMMAND_SETKEY), { .option = {"batch-mode", 0, NULL, 'q'}, @@ -2175,12 +2182,12 @@ static int command_setkey(void) int token; int rc; - if (g.master_key_file == NULL) { - misc_print_required_parm("--master-key-file/-m"); + if (g.volume_key_file == NULL) { + misc_print_required_parm("--volume-key-file/-m"); return EXIT_FAILURE; } - newkey = read_secure_key(g.master_key_file, &newkey_size, g.verbose); + newkey = read_secure_key(g.volume_key_file, &newkey_size, g.verbose); if (newkey == NULL) return EXIT_FAILURE; @@ -2198,7 +2205,7 @@ static int command_setkey(void) &is_old_mk, NULL, g.verbose); if (rc != 0) { warnx("The secure key in file '%s' is not valid", - g.master_key_file); + g.volume_key_file); goto out; } @@ -2208,7 +2215,7 @@ static int command_setkey(void) "enciphered with the master key in the OLD " "master key register. Do you want to set this " "key as the new volume key anyway [y/N]?", - g.master_key_file); + g.volume_key_file); util_print_indented(msg, 0); free(msg); @@ -2229,7 +2236,7 @@ static int command_setkey(void) if (keysize - integrity_keysize == newkey_size - integrity_keysize && memcmp(newkey, key, keysize - integrity_keysize) == 0) { warnx("The secure key in file '%s' is equal to the current " - "volume key, setkey is ignored", g.master_key_file); + "volume key, setkey is ignored", g.volume_key_file); rc = 0; goto out; } @@ -2238,7 +2245,7 @@ static int command_setkey(void) key + keysize - integrity_keysize, integrity_keysize) != 0) { warnx("The secure key in file '%s' contains a different " "integrity key (i.e. the last %lu bytes of the key) than " - "the current volume key.", g.master_key_file, + "the current volume key.", g.volume_key_file, integrity_keysize); rc = -EINVAL; goto out; @@ -2278,7 +2285,7 @@ static int command_setkey(void) "volume if you set the wrong volume key!\n" "Are you sure that the key in file '%s' is the " "correct volume key for volume '%s' [y/N]?", - g.master_key_file, g.pos_arg); + g.volume_key_file, g.pos_arg); util_print_indented(msg, 0); free(msg); @@ -2457,7 +2464,7 @@ int main(int argc, char *argv[]) } break; case 'm': - g.master_key_file = optarg; + g.volume_key_file = optarg; break; case 'q': g.batch_mode = true;