s390/zcrypt: add new low level ep11 functions support file
[linux-2.6-microblaze.git] / drivers / s390 / crypto / zcrypt_ep11misc.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  *  Copyright IBM Corp. 2019
4  *  Author(s): Harald Freudenberger <freude@linux.ibm.com>
5  *
6  *  Collection of EP11 misc functions used by zcrypt and pkey
7  */
8
9 #ifndef _ZCRYPT_EP11MISC_H_
10 #define _ZCRYPT_EP11MISC_H_
11
12 #include <asm/zcrypt.h>
13 #include <asm/pkey.h>
14
15 /* EP11 card info struct */
16 struct ep11_card_info {
17         u32  API_ord_nr;    /* API ordinal number */
18         u16  FW_version;    /* Firmware major and minor version */
19         char serial[16];    /* serial number string (16 ascii, no 0x00 !) */
20         u64  op_mode;       /* card operational mode(s) */
21 };
22
23 /* EP11 domain info struct */
24 struct ep11_domain_info {
25         char cur_wk_state;  /* '0' invalid, '1' valid */
26         char new_wk_state;  /* '0' empty, '1' uncommitted, '2' committed */
27         u8   cur_wkvp[32];  /* current wrapping key verification pattern */
28         u8   new_wkvp[32];  /* new wrapping key verification pattern */
29         u64  op_mode;       /* domain operational mode(s) */
30 };
31
32 /*
33  * Provide information about an EP11 card.
34  */
35 int ep11_get_card_info(u16 card, struct ep11_card_info *info, int verify);
36
37 /*
38  * Provide information about a domain within an EP11 card.
39  */
40 int ep11_get_domain_info(u16 card, u16 domain, struct ep11_domain_info *info);
41
42 void zcrypt_ep11misc_exit(void);
43
44 #endif /* _ZCRYPT_EP11MISC_H_ */