zkey: Check crypto card level during APQN cross checking

Secure keys of type CCA-AESCIPHER require a CEX6C or newer crypto
card. Also check for the minimum required card level during cross
checking of APQNs. Also display the card level in the APQN report.

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:
Ingo Franzki
2019-07-26 11:18:58 +02:00
committed by Jan Höppner
parent 560b672bfa
commit b7bb90c552
6 changed files with 126 additions and 15 deletions

View File

@@ -1630,3 +1630,23 @@ const char *get_key_type(const u8 *key, size_t key_size)
return NULL;
}
/**
* Returns the minimum card level for a specific key type
*
* @param[in] key_type the type of the key
*
* @returns the minimum card level, or -1 for unknown key types
*/
int get_min_card_level_for_keytype(const char *key_type)
{
if (key_type == NULL)
return -1;
if (strcasecmp(key_type, KEY_TYPE_CCA_AESDATA) == 0)
return 3;
if (strcasecmp(key_type, KEY_TYPE_CCA_AESCIPHER) == 0)
return 6;
return -1;
}