Linux 4.2.1
[linux/fpc-iii.git] / drivers / s390 / crypto / zcrypt_pcica.h
blob9a59155cad517cff088e9d00708f4694de5b451c
1 /*
2 * zcrypt 2.1.0
4 * Copyright IBM Corp. 2001, 2006
5 * Author(s): Robert Burroughs
6 * Eric Rossman (edrossma@us.ibm.com)
8 * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
9 * Major cleanup & driver split: Martin Schwidefsky <schwidefsky@de.ibm.com>
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.
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.
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.
26 #ifndef _ZCRYPT_PCICA_H_
27 #define _ZCRYPT_PCICA_H_
29 /**
30 * The type 4 message family is associated with a PCICA card.
32 * The four members of the family are described below.
34 * Note that all unsigned char arrays are right-justified and left-padded
35 * with zeroes.
37 * Note that all reserved fields must be zeroes.
39 struct type4_hdr {
40 unsigned char reserved1;
41 unsigned char msg_type_code; /* 0x04 */
42 unsigned short msg_len;
43 unsigned char request_code; /* 0x40 */
44 unsigned char msg_fmt;
45 unsigned short reserved2;
46 } __attribute__((packed));
48 #define TYPE4_TYPE_CODE 0x04
49 #define TYPE4_REQU_CODE 0x40
51 #define TYPE4_SME_FMT 0x00
52 #define TYPE4_LME_FMT 0x10
53 #define TYPE4_SCR_FMT 0x40
54 #define TYPE4_LCR_FMT 0x50
56 /* Mod-Exp, with a small modulus */
57 struct type4_sme {
58 struct type4_hdr header;
59 unsigned char message[128];
60 unsigned char exponent[128];
61 unsigned char modulus[128];
62 } __attribute__((packed));
64 /* Mod-Exp, with a large modulus */
65 struct type4_lme {
66 struct type4_hdr header;
67 unsigned char message[256];
68 unsigned char exponent[256];
69 unsigned char modulus[256];
70 } __attribute__((packed));
72 /* CRT, with a small modulus */
73 struct type4_scr {
74 struct type4_hdr header;
75 unsigned char message[128];
76 unsigned char dp[72];
77 unsigned char dq[64];
78 unsigned char p[72];
79 unsigned char q[64];
80 unsigned char u[72];
81 } __attribute__((packed));
83 /* CRT, with a large modulus */
84 struct type4_lcr {
85 struct type4_hdr header;
86 unsigned char message[256];
87 unsigned char dp[136];
88 unsigned char dq[128];
89 unsigned char p[136];
90 unsigned char q[128];
91 unsigned char u[136];
92 } __attribute__((packed));
94 /**
95 * The type 84 response family is associated with a PCICA card.
97 * Note that all unsigned char arrays are right-justified and left-padded
98 * with zeroes.
100 * Note that all reserved fields must be zeroes.
103 struct type84_hdr {
104 unsigned char reserved1;
105 unsigned char code;
106 unsigned short len;
107 unsigned char reserved2[4];
108 } __attribute__((packed));
110 #define TYPE84_RSP_CODE 0x84
112 int zcrypt_pcica_init(void);
113 void zcrypt_pcica_exit(void);
115 #endif /* _ZCRYPT_PCICA_H_ */