s390/comments: unify copyright messages and remove file names
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / s390 / crypto / zcrypt_cex2a.h
1 /*
2 * zcrypt 2.1.0
3 *
4 * Copyright IBM Corp. 2001, 2006
5 * Author(s): Robert Burroughs
6 * Eric Rossman (edrossma@us.ibm.com)
7 *
8 * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
9 * Major cleanup & driver split: Martin Schwidefsky <schwidefsky@de.ibm.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2, or (at your option)
14 * any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26 #ifndef _ZCRYPT_CEX2A_H_
27 #define _ZCRYPT_CEX2A_H_
28
29 /**
30 * The type 50 message family is associated with a CEX2A card.
31 *
32 * The four members of the family are described below.
33 *
34 * Note that all unsigned char arrays are right-justified and left-padded
35 * with zeroes.
36 *
37 * Note that all reserved fields must be zeroes.
38 */
39 struct type50_hdr {
40 unsigned char reserved1;
41 unsigned char msg_type_code; /* 0x50 */
42 unsigned short msg_len;
43 unsigned char reserved2;
44 unsigned char ignored;
45 unsigned short reserved3;
46 } __attribute__((packed));
47
48 #define TYPE50_TYPE_CODE 0x50
49
50 #define TYPE50_MEB1_FMT 0x0001
51 #define TYPE50_MEB2_FMT 0x0002
52 #define TYPE50_MEB3_FMT 0x0003
53 #define TYPE50_CRB1_FMT 0x0011
54 #define TYPE50_CRB2_FMT 0x0012
55 #define TYPE50_CRB3_FMT 0x0013
56
57 /* Mod-Exp, with a small modulus */
58 struct type50_meb1_msg {
59 struct type50_hdr header;
60 unsigned short keyblock_type; /* 0x0001 */
61 unsigned char reserved[6];
62 unsigned char exponent[128];
63 unsigned char modulus[128];
64 unsigned char message[128];
65 } __attribute__((packed));
66
67 /* Mod-Exp, with a large modulus */
68 struct type50_meb2_msg {
69 struct type50_hdr header;
70 unsigned short keyblock_type; /* 0x0002 */
71 unsigned char reserved[6];
72 unsigned char exponent[256];
73 unsigned char modulus[256];
74 unsigned char message[256];
75 } __attribute__((packed));
76
77 /* Mod-Exp, with a larger modulus */
78 struct type50_meb3_msg {
79 struct type50_hdr header;
80 unsigned short keyblock_type; /* 0x0003 */
81 unsigned char reserved[6];
82 unsigned char exponent[512];
83 unsigned char modulus[512];
84 unsigned char message[512];
85 } __attribute__((packed));
86
87 /* CRT, with a small modulus */
88 struct type50_crb1_msg {
89 struct type50_hdr header;
90 unsigned short keyblock_type; /* 0x0011 */
91 unsigned char reserved[6];
92 unsigned char p[64];
93 unsigned char q[64];
94 unsigned char dp[64];
95 unsigned char dq[64];
96 unsigned char u[64];
97 unsigned char message[128];
98 } __attribute__((packed));
99
100 /* CRT, with a large modulus */
101 struct type50_crb2_msg {
102 struct type50_hdr header;
103 unsigned short keyblock_type; /* 0x0012 */
104 unsigned char reserved[6];
105 unsigned char p[128];
106 unsigned char q[128];
107 unsigned char dp[128];
108 unsigned char dq[128];
109 unsigned char u[128];
110 unsigned char message[256];
111 } __attribute__((packed));
112
113 /* CRT, with a larger modulus */
114 struct type50_crb3_msg {
115 struct type50_hdr header;
116 unsigned short keyblock_type; /* 0x0013 */
117 unsigned char reserved[6];
118 unsigned char p[256];
119 unsigned char q[256];
120 unsigned char dp[256];
121 unsigned char dq[256];
122 unsigned char u[256];
123 unsigned char message[512];
124 } __attribute__((packed));
125
126 /**
127 * The type 80 response family is associated with a CEX2A card.
128 *
129 * Note that all unsigned char arrays are right-justified and left-padded
130 * with zeroes.
131 *
132 * Note that all reserved fields must be zeroes.
133 */
134
135 #define TYPE80_RSP_CODE 0x80
136
137 struct type80_hdr {
138 unsigned char reserved1;
139 unsigned char type; /* 0x80 */
140 unsigned short len;
141 unsigned char code; /* 0x00 */
142 unsigned char reserved2[3];
143 unsigned char reserved3[8];
144 } __attribute__((packed));
145
146 int zcrypt_cex2a_init(void);
147 void zcrypt_cex2a_exit(void);
148
149 #endif /* _ZCRYPT_CEX2A_H_ */