zkey: Reject re-enciphering of PVSECRET-AES keys

Keys of type PVSECRET-AES can not be reenciphered using 'zkey reencipher'
or 'zkey-cryptsetup reencipher'. Reject that with a proper error message.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Jorg Schmidbauer <jschmidb@de.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Ingo Franzki
2024-02-19 11:26:41 +01:00
committed by Steffen Eiden
parent 5276d408fd
commit a8eb2bd4e7
5 changed files with 38 additions and 6 deletions
+7
View File
@@ -2118,6 +2118,13 @@ static int command_reencipher_file(void)
if (secure_key == NULL)
return EXIT_FAILURE;
if (!is_secure_key(secure_key, secure_key_size)) {
warnx("A key of type %s can not be re-enciphered",
get_key_type(secure_key, secure_key_size));
rc = EXIT_FAILURE;
goto out;
}
rc = validate_secure_key(g.pkey_fd, secure_key, secure_key_size, NULL,
&is_old_mk, NULL, g.verbose);
if (rc != 0) {