mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zkey: Add key checks when importing a CCA-AESCIPHER key
Perform extended checks on a secure key that is imported into the key repository. Warn the user if the imported key is by any means insecure, e.g. has been originally created in an insecure way. Prompt the user to continue the import if a potential insecurity is detected. 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
7fede7021e
commit
0d9e42264d
@@ -793,3 +793,27 @@ int cross_check_apqns(const char *apqns, u64 mkvp, int min_level,
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prompts for yes or no. Returns true if 'y' or 'yes' was entered.
|
||||
*
|
||||
* @param[in] verbose if true, verbose messages are printed
|
||||
*
|
||||
* @returns true if 'y' or 'yes' was entered (case insensitive). Returns false
|
||||
* otherwise.
|
||||
*/
|
||||
bool prompt_for_yes(bool verbose)
|
||||
{
|
||||
char str[20];
|
||||
|
||||
if (fgets(str, sizeof(str), stdin) == NULL)
|
||||
return false;
|
||||
|
||||
if (str[strlen(str) - 1] == '\n')
|
||||
str[strlen(str) - 1] = '\0';
|
||||
pr_verbose(verbose, "Prompt reply: '%s'", str);
|
||||
if (strcasecmp(str, "y") == 0 || strcasecmp(str, "yes") == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user