Full support for Ginger Console
[linux-ginger.git] / drivers / s390 / crypto / zcrypt_cex2a.h
blob8f69d1dacab8a06dcadedde5142f7a5733b35f96
1 /*
2 * linux/drivers/s390/crypto/zcrypt_cex2a.h
4 * zcrypt 2.1.0
6 * Copyright (C) 2001, 2006 IBM Corporation
7 * Author(s): Robert Burroughs
8 * Eric Rossman (edrossma@us.ibm.com)
10 * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
11 * Major cleanup & driver split: Martin Schwidefsky <schwidefsky@de.ibm.com>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
16 * any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #ifndef _ZCRYPT_CEX2A_H_
29 #define _ZCRYPT_CEX2A_H_
31 /**
32 * The type 50 message family is associated with a CEX2A card.
34 * The four members of the family are described below.
36 * Note that all unsigned char arrays are right-justified and left-padded
37 * with zeroes.
39 * Note that all reserved fields must be zeroes.
41 struct type50_hdr {
42 unsigned char reserved1;
43 unsigned char msg_type_code; /* 0x50 */
44 unsigned short msg_len;
45 unsigned char reserved2;
46 unsigned char ignored;
47 unsigned short reserved3;
48 } __attribute__((packed));
50 #define TYPE50_TYPE_CODE 0x50
52 #define TYPE50_MEB1_FMT 0x0001
53 #define TYPE50_MEB2_FMT 0x0002
54 #define TYPE50_CRB1_FMT 0x0011
55 #define TYPE50_CRB2_FMT 0x0012
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));
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));
77 /* CRT, with a small modulus */
78 struct type50_crb1_msg {
79 struct type50_hdr header;
80 unsigned short keyblock_type; /* 0x0011 */
81 unsigned char reserved[6];
82 unsigned char p[64];
83 unsigned char q[64];
84 unsigned char dp[64];
85 unsigned char dq[64];
86 unsigned char u[64];
87 unsigned char message[128];
88 } __attribute__((packed));
90 /* CRT, with a large modulus */
91 struct type50_crb2_msg {
92 struct type50_hdr header;
93 unsigned short keyblock_type; /* 0x0012 */
94 unsigned char reserved[6];
95 unsigned char p[128];
96 unsigned char q[128];
97 unsigned char dp[128];
98 unsigned char dq[128];
99 unsigned char u[128];
100 unsigned char message[256];
101 } __attribute__((packed));
104 * The type 80 response family is associated with a CEX2A card.
106 * Note that all unsigned char arrays are right-justified and left-padded
107 * with zeroes.
109 * Note that all reserved fields must be zeroes.
112 #define TYPE80_RSP_CODE 0x80
114 struct type80_hdr {
115 unsigned char reserved1;
116 unsigned char type; /* 0x80 */
117 unsigned short len;
118 unsigned char code; /* 0x00 */
119 unsigned char reserved2[3];
120 unsigned char reserved3[8];
121 } __attribute__((packed));
123 int zcrypt_cex2a_init(void);
124 void zcrypt_cex2a_exit(void);
126 #endif /* _ZCRYPT_CEX2A_H_ */