mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zkey: Allow 'zkey-cryptsetup setkey' to set different key types
When a secure key has been converted from type CCA-AESDATA to type CCA-AESCIPHER, the secure key stored in the LUKS2 header of a volume encrypted with that key should also changed. Command 'zkey-cryptsetup setkey' allows to set (replace) the volume key in the LUKS2 header. It now accepts keys to be set that have a different size of the original volume keys. CCA-AESCIPHER keys are larger than CCA-AESDATA keys. Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com> Reviewed-by: Harald Freudenberger <freude@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
a86e41a518
commit
bc987c8d18
@@ -2169,14 +2169,7 @@ static int command_setkey(void)
|
||||
if (rc < 0)
|
||||
goto out;
|
||||
|
||||
if (keysize != newkey_size) {
|
||||
warnx("The secure key in file '%s' has an invalid size",
|
||||
g.master_key_file);
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (memcmp(newkey, key, keysize) == 0) {
|
||||
if (keysize == newkey_size && memcmp(newkey, key, keysize) == 0) {
|
||||
warnx("The secure key in file '%s' is equal to the current "
|
||||
"volume key, setkey is ignored", g.master_key_file);
|
||||
rc = 0;
|
||||
|
||||
Reference in New Issue
Block a user