mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zkey: Add function to obtain the mkvp of a secure key
A secure AES key token contains the master key verification pattern of the master key it is encrypted with. Add a function to obtain the master key verification pattern of a secure key token. 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
b32c031474
commit
ea7cc9ea60
21
zkey/pkey.c
21
zkey/pkey.c
@@ -769,3 +769,24 @@ out:
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int get_master_key_verification_pattern(const u8 *secure_key,
|
||||
size_t secure_key_size, u64 *mkvp,
|
||||
bool verbose)
|
||||
{
|
||||
struct secaeskeytoken *token = (struct secaeskeytoken *)secure_key;
|
||||
|
||||
util_assert(secure_key != NULL, "Internal error: secure_key is NULL");
|
||||
util_assert(mkvp != NULL, "Internal error: mkvp is NULL");
|
||||
|
||||
if (secure_key_size < SECURE_KEY_SIZE) {
|
||||
pr_verbose(verbose, "Size of secure key is too small: "
|
||||
"%lu expected %lu", secure_key_size,
|
||||
SECURE_KEY_SIZE);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
*mkvp = token->mkvp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -112,4 +112,8 @@ int validate_secure_key(int pkey_fd,
|
||||
int generate_key_verification_pattern(const char *key, size_t key_size,
|
||||
char *vp, size_t vp_len, bool verbose);
|
||||
|
||||
int get_master_key_verification_pattern(const u8 *secure_key,
|
||||
size_t secure_key_size, u64 *mkvp,
|
||||
bool verbose);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user