1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright IBM Corp. 2001, 2006
4 * Author(s): Robert Burroughs
5 * Eric Rossman (edrossma@us.ibm.com)
7 * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
8 * Major cleanup & driver split: Martin Schwidefsky <schwidefsky@de.ibm.com>
11 #ifndef _ZCRYPT_CEX2A_H_
12 #define _ZCRYPT_CEX2A_H_
15 * The type 50 message family is associated with CEXxA cards.
17 * The four members of the family are described below.
19 * Note that all unsigned char arrays are right-justified and left-padded
22 * Note that all reserved fields must be zeroes.
25 unsigned char reserved1
;
26 unsigned char msg_type_code
; /* 0x50 */
27 unsigned short msg_len
;
28 unsigned char reserved2
;
29 unsigned char ignored
;
30 unsigned short reserved3
;
33 #define TYPE50_TYPE_CODE 0x50
35 #define TYPE50_MEB1_FMT 0x0001
36 #define TYPE50_MEB2_FMT 0x0002
37 #define TYPE50_MEB3_FMT 0x0003
38 #define TYPE50_CRB1_FMT 0x0011
39 #define TYPE50_CRB2_FMT 0x0012
40 #define TYPE50_CRB3_FMT 0x0013
42 /* Mod-Exp, with a small modulus */
43 struct type50_meb1_msg
{
44 struct type50_hdr header
;
45 unsigned short keyblock_type
; /* 0x0001 */
46 unsigned char reserved
[6];
47 unsigned char exponent
[128];
48 unsigned char modulus
[128];
49 unsigned char message
[128];
52 /* Mod-Exp, with a large modulus */
53 struct type50_meb2_msg
{
54 struct type50_hdr header
;
55 unsigned short keyblock_type
; /* 0x0002 */
56 unsigned char reserved
[6];
57 unsigned char exponent
[256];
58 unsigned char modulus
[256];
59 unsigned char message
[256];
62 /* Mod-Exp, with a larger modulus */
63 struct type50_meb3_msg
{
64 struct type50_hdr header
;
65 unsigned short keyblock_type
; /* 0x0003 */
66 unsigned char reserved
[6];
67 unsigned char exponent
[512];
68 unsigned char modulus
[512];
69 unsigned char message
[512];
72 /* CRT, with a small modulus */
73 struct type50_crb1_msg
{
74 struct type50_hdr header
;
75 unsigned short keyblock_type
; /* 0x0011 */
76 unsigned char reserved
[6];
82 unsigned char message
[128];
85 /* CRT, with a large modulus */
86 struct type50_crb2_msg
{
87 struct type50_hdr header
;
88 unsigned short keyblock_type
; /* 0x0012 */
89 unsigned char reserved
[6];
92 unsigned char dp
[128];
93 unsigned char dq
[128];
95 unsigned char message
[256];
98 /* CRT, with a larger modulus */
99 struct type50_crb3_msg
{
100 struct type50_hdr header
;
101 unsigned short keyblock_type
; /* 0x0013 */
102 unsigned char reserved
[6];
103 unsigned char p
[256];
104 unsigned char q
[256];
105 unsigned char dp
[256];
106 unsigned char dq
[256];
107 unsigned char u
[256];
108 unsigned char message
[512];
112 * The type 80 response family is associated with a CEXxA cards.
114 * Note that all unsigned char arrays are right-justified and left-padded
117 * Note that all reserved fields must be zeroes.
120 #define TYPE80_RSP_CODE 0x80
123 unsigned char reserved1
;
124 unsigned char type
; /* 0x80 */
126 unsigned char code
; /* 0x00 */
127 unsigned char reserved2
[3];
128 unsigned char reserved3
[8];
131 int zcrypt_cex2a_init(void);
132 void zcrypt_cex2a_exit(void);
134 #endif /* _ZCRYPT_CEX2A_H_ */