aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/s390/crypto/z90crypt.h185
-rw-r--r--include/asm-s390/z90crypt.h212
2 files changed, 214 insertions, 183 deletions
diff --git a/drivers/s390/crypto/z90crypt.h b/drivers/s390/crypto/z90crypt.h
index 5e6b1f535f62..0ca1d126ccb6 100644
--- a/drivers/s390/crypto/z90crypt.h
+++ b/drivers/s390/crypto/z90crypt.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/drivers/s390/crypto/z90crypt.h 2 * linux/drivers/s390/crypto/z90crypt.h
3 * 3 *
4 * z90crypt 1.3.3 4 * z90crypt 1.3.3 (kernel-private header)
5 * 5 *
6 * Copyright (C) 2001, 2005 IBM Corporation 6 * Copyright (C) 2001, 2005 IBM Corporation
7 * Author(s): Robert Burroughs (burrough@us.ibm.com) 7 * Author(s): Robert Burroughs (burrough@us.ibm.com)
@@ -27,188 +27,7 @@
27#ifndef _Z90CRYPT_H_ 27#ifndef _Z90CRYPT_H_
28#define _Z90CRYPT_H_ 28#define _Z90CRYPT_H_
29 29
30#include <linux/ioctl.h> 30#include <asm/z90crypt.h>
31
32#define z90crypt_VERSION 1
33#define z90crypt_RELEASE 3 // 2 = PCIXCC, 3 = rewrite for coding standards
34#define z90crypt_VARIANT 3 // 3 = CEX2A support
35
36/**
37 * struct ica_rsa_modexpo
38 *
39 * Requirements:
40 * - outputdatalength is at least as large as inputdatalength.
41 * - All key parts are right justified in their fields, padded on
42 * the left with zeroes.
43 * - length(b_key) = inputdatalength
44 * - length(n_modulus) = inputdatalength
45 */
46struct ica_rsa_modexpo {
47 char __user * inputdata;
48 unsigned int inputdatalength;
49 char __user * outputdata;
50 unsigned int outputdatalength;
51 char __user * b_key;
52 char __user * n_modulus;
53};
54
55/**
56 * struct ica_rsa_modexpo_crt
57 *
58 * Requirements:
59 * - inputdatalength is even.
60 * - outputdatalength is at least as large as inputdatalength.
61 * - All key parts are right justified in their fields, padded on
62 * the left with zeroes.
63 * - length(bp_key) = inputdatalength/2 + 8
64 * - length(bq_key) = inputdatalength/2
65 * - length(np_key) = inputdatalength/2 + 8
66 * - length(nq_key) = inputdatalength/2
67 * - length(u_mult_inv) = inputdatalength/2 + 8
68 */
69struct ica_rsa_modexpo_crt {
70 char __user * inputdata;
71 unsigned int inputdatalength;
72 char __user * outputdata;
73 unsigned int outputdatalength;
74 char __user * bp_key;
75 char __user * bq_key;
76 char __user * np_prime;
77 char __user * nq_prime;
78 char __user * u_mult_inv;
79};
80
81#define Z90_IOCTL_MAGIC 'z' // NOTE: Need to allocate from linux folks
82
83/**
84 * Interface notes:
85 *
86 * The ioctl()s which are implemented (along with relevant details)
87 * are:
88 *
89 * ICARSAMODEXPO
90 * Perform an RSA operation using a Modulus-Exponent pair
91 * This takes an ica_rsa_modexpo struct as its arg.
92 *
93 * NOTE: please refer to the comments preceding this structure
94 * for the implementation details for the contents of the
95 * block
96 *
97 * ICARSACRT
98 * Perform an RSA operation using a Chinese-Remainder Theorem key
99 * This takes an ica_rsa_modexpo_crt struct as its arg.
100 *
101 * NOTE: please refer to the comments preceding this structure
102 * for the implementation details for the contents of the
103 * block
104 *
105 * Z90STAT_TOTALCOUNT
106 * Return an integer count of all device types together.
107 *
108 * Z90STAT_PCICACOUNT
109 * Return an integer count of all PCICAs.
110 *
111 * Z90STAT_PCICCCOUNT
112 * Return an integer count of all PCICCs.
113 *
114 * Z90STAT_PCIXCCMCL2COUNT
115 * Return an integer count of all MCL2 PCIXCCs.
116 *
117 * Z90STAT_PCIXCCMCL3COUNT
118 * Return an integer count of all MCL3 PCIXCCs.
119 *
120 * Z90STAT_CEX2CCOUNT
121 * Return an integer count of all CEX2Cs.
122 *
123 * Z90STAT_CEX2ACOUNT
124 * Return an integer count of all CEX2As.
125 *
126 * Z90STAT_REQUESTQ_COUNT
127 * Return an integer count of the number of entries waiting to be
128 * sent to a device.
129 *
130 * Z90STAT_PENDINGQ_COUNT
131 * Return an integer count of the number of entries sent to a
132 * device awaiting the reply.
133 *
134 * Z90STAT_TOTALOPEN_COUNT
135 * Return an integer count of the number of open file handles.
136 *
137 * Z90STAT_DOMAIN_INDEX
138 * Return the integer value of the Cryptographic Domain.
139 *
140 * Z90STAT_STATUS_MASK
141 * Return an 64 element array of unsigned chars for the status of
142 * all devices.
143 * 0x01: PCICA
144 * 0x02: PCICC
145 * 0x03: PCIXCC_MCL2
146 * 0x04: PCIXCC_MCL3
147 * 0x05: CEX2C
148 * 0x06: CEX2A
149 * 0x0d: device is disabled via the proc filesystem
150 *
151 * Z90STAT_QDEPTH_MASK
152 * Return an 64 element array of unsigned chars for the queue
153 * depth of all devices.
154 *
155 * Z90STAT_PERDEV_REQCNT
156 * Return an 64 element array of unsigned integers for the number
157 * of successfully completed requests per device since the device
158 * was detected and made available.
159 *
160 * ICAZ90STATUS (deprecated)
161 * Return some device driver status in a ica_z90_status struct
162 * This takes an ica_z90_status struct as its arg.
163 *
164 * NOTE: this ioctl() is deprecated, and has been replaced with
165 * single ioctl()s for each type of status being requested
166 *
167 * Z90STAT_PCIXCCCOUNT (deprecated)
168 * Return an integer count of all PCIXCCs (MCL2 + MCL3).
169 * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from
170 * MCL2 PCIXCCs.
171 *
172 * Z90QUIESCE (not recommended)
173 * Quiesce the driver. This is intended to stop all new
174 * requests from being processed. Its use is NOT recommended,
175 * except in circumstances where there is no other way to stop
176 * callers from accessing the driver. Its original use was to
177 * allow the driver to be "drained" of work in preparation for
178 * a system shutdown.
179 *
180 * NOTE: once issued, this ban on new work cannot be undone
181 * except by unloading and reloading the driver.
182 */
183
184/**
185 * Supported ioctl calls
186 */
187#define ICARSAMODEXPO _IOC(_IOC_READ|_IOC_WRITE, Z90_IOCTL_MAGIC, 0x05, 0)
188#define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, Z90_IOCTL_MAGIC, 0x06, 0)
189
190/* DEPRECATED status calls (bound for removal at some point) */
191#define ICAZ90STATUS _IOR(Z90_IOCTL_MAGIC, 0x10, struct ica_z90_status)
192#define Z90STAT_PCIXCCCOUNT _IOR(Z90_IOCTL_MAGIC, 0x43, int)
193
194/* unrelated to ICA callers */
195#define Z90QUIESCE _IO(Z90_IOCTL_MAGIC, 0x11)
196
197/* New status calls */
198#define Z90STAT_TOTALCOUNT _IOR(Z90_IOCTL_MAGIC, 0x40, int)
199#define Z90STAT_PCICACOUNT _IOR(Z90_IOCTL_MAGIC, 0x41, int)
200#define Z90STAT_PCICCCOUNT _IOR(Z90_IOCTL_MAGIC, 0x42, int)
201#define Z90STAT_PCIXCCMCL2COUNT _IOR(Z90_IOCTL_MAGIC, 0x4b, int)
202#define Z90STAT_PCIXCCMCL3COUNT _IOR(Z90_IOCTL_MAGIC, 0x4c, int)
203#define Z90STAT_CEX2CCOUNT _IOR(Z90_IOCTL_MAGIC, 0x4d, int)
204#define Z90STAT_CEX2ACOUNT _IOR(Z90_IOCTL_MAGIC, 0x4e, int)
205#define Z90STAT_REQUESTQ_COUNT _IOR(Z90_IOCTL_MAGIC, 0x44, int)
206#define Z90STAT_PENDINGQ_COUNT _IOR(Z90_IOCTL_MAGIC, 0x45, int)
207#define Z90STAT_TOTALOPEN_COUNT _IOR(Z90_IOCTL_MAGIC, 0x46, int)
208#define Z90STAT_DOMAIN_INDEX _IOR(Z90_IOCTL_MAGIC, 0x47, int)
209#define Z90STAT_STATUS_MASK _IOR(Z90_IOCTL_MAGIC, 0x48, char[64])
210#define Z90STAT_QDEPTH_MASK _IOR(Z90_IOCTL_MAGIC, 0x49, char[64])
211#define Z90STAT_PERDEV_REQCNT _IOR(Z90_IOCTL_MAGIC, 0x4a, int[64])
212 31
213/** 32/**
214 * local errno definitions 33 * local errno definitions
diff --git a/include/asm-s390/z90crypt.h b/include/asm-s390/z90crypt.h
new file mode 100644
index 000000000000..31a2439b07bd
--- /dev/null
+++ b/include/asm-s390/z90crypt.h
@@ -0,0 +1,212 @@
1/*
2 * include/asm-s390/z90crypt.h
3 *
4 * z90crypt 1.3.3 (user-visible header)
5 *
6 * Copyright (C) 2001, 2005 IBM Corporation
7 * Author(s): Robert Burroughs
8 * Eric Rossman (edrossma@us.ibm.com)
9 *
10 * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#ifndef __ASM_S390_Z90CRYPT_H
28#define __ASM_S390_Z90CRYPT_H
29#include <linux/ioctl.h>
30
31#define z90crypt_VERSION 1
32#define z90crypt_RELEASE 3 // 2 = PCIXCC, 3 = rewrite for coding standards
33#define z90crypt_VARIANT 3 // 3 = CEX2A support
34
35/**
36 * struct ica_rsa_modexpo
37 *
38 * Requirements:
39 * - outputdatalength is at least as large as inputdatalength.
40 * - All key parts are right justified in their fields, padded on
41 * the left with zeroes.
42 * - length(b_key) = inputdatalength
43 * - length(n_modulus) = inputdatalength
44 */
45struct ica_rsa_modexpo {
46 char __user * inputdata;
47 unsigned int inputdatalength;
48 char __user * outputdata;
49 unsigned int outputdatalength;
50 char __user * b_key;
51 char __user * n_modulus;
52};
53
54/**
55 * struct ica_rsa_modexpo_crt
56 *
57 * Requirements:
58 * - inputdatalength is even.
59 * - outputdatalength is at least as large as inputdatalength.
60 * - All key parts are right justified in their fields, padded on
61 * the left with zeroes.
62 * - length(bp_key) = inputdatalength/2 + 8
63 * - length(bq_key) = inputdatalength/2
64 * - length(np_key) = inputdatalength/2 + 8
65 * - length(nq_key) = inputdatalength/2
66 * - length(u_mult_inv) = inputdatalength/2 + 8
67 */
68struct ica_rsa_modexpo_crt {
69 char __user * inputdata;
70 unsigned int inputdatalength;
71 char __user * outputdata;
72 unsigned int outputdatalength;
73 char __user * bp_key;
74 char __user * bq_key;
75 char __user * np_prime;
76 char __user * nq_prime;
77 char __user * u_mult_inv;
78};
79
80#define Z90_IOCTL_MAGIC 'z' // NOTE: Need to allocate from linux folks
81
82/**
83 * Interface notes:
84 *
85 * The ioctl()s which are implemented (along with relevant details)
86 * are:
87 *
88 * ICARSAMODEXPO
89 * Perform an RSA operation using a Modulus-Exponent pair
90 * This takes an ica_rsa_modexpo struct as its arg.
91 *
92 * NOTE: please refer to the comments preceding this structure
93 * for the implementation details for the contents of the
94 * block
95 *
96 * ICARSACRT
97 * Perform an RSA operation using a Chinese-Remainder Theorem key
98 * This takes an ica_rsa_modexpo_crt struct as its arg.
99 *
100 * NOTE: please refer to the comments preceding this structure
101 * for the implementation details for the contents of the
102 * block
103 *
104 * Z90STAT_TOTALCOUNT
105 * Return an integer count of all device types together.
106 *
107 * Z90STAT_PCICACOUNT
108 * Return an integer count of all PCICAs.
109 *
110 * Z90STAT_PCICCCOUNT
111 * Return an integer count of all PCICCs.
112 *
113 * Z90STAT_PCIXCCMCL2COUNT
114 * Return an integer count of all MCL2 PCIXCCs.
115 *
116 * Z90STAT_PCIXCCMCL3COUNT
117 * Return an integer count of all MCL3 PCIXCCs.
118 *
119 * Z90STAT_CEX2CCOUNT
120 * Return an integer count of all CEX2Cs.
121 *
122 * Z90STAT_CEX2ACOUNT
123 * Return an integer count of all CEX2As.
124 *
125 * Z90STAT_REQUESTQ_COUNT
126 * Return an integer count of the number of entries waiting to be
127 * sent to a device.
128 *
129 * Z90STAT_PENDINGQ_COUNT
130 * Return an integer count of the number of entries sent to a
131 * device awaiting the reply.
132 *
133 * Z90STAT_TOTALOPEN_COUNT
134 * Return an integer count of the number of open file handles.
135 *
136 * Z90STAT_DOMAIN_INDEX
137 * Return the integer value of the Cryptographic Domain.
138 *
139 * Z90STAT_STATUS_MASK
140 * Return an 64 element array of unsigned chars for the status of
141 * all devices.
142 * 0x01: PCICA
143 * 0x02: PCICC
144 * 0x03: PCIXCC_MCL2
145 * 0x04: PCIXCC_MCL3
146 * 0x05: CEX2C
147 * 0x06: CEX2A
148 * 0x0d: device is disabled via the proc filesystem
149 *
150 * Z90STAT_QDEPTH_MASK
151 * Return an 64 element array of unsigned chars for the queue
152 * depth of all devices.
153 *
154 * Z90STAT_PERDEV_REQCNT
155 * Return an 64 element array of unsigned integers for the number
156 * of successfully completed requests per device since the device
157 * was detected and made available.
158 *
159 * ICAZ90STATUS (deprecated)
160 * Return some device driver status in a ica_z90_status struct
161 * This takes an ica_z90_status struct as its arg.
162 *
163 * NOTE: this ioctl() is deprecated, and has been replaced with
164 * single ioctl()s for each type of status being requested
165 *
166 * Z90STAT_PCIXCCCOUNT (deprecated)
167 * Return an integer count of all PCIXCCs (MCL2 + MCL3).
168 * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from
169 * MCL2 PCIXCCs.
170 *
171 * Z90QUIESCE (not recommended)
172 * Quiesce the driver. This is intended to stop all new
173 * requests from being processed. Its use is NOT recommended,
174 * except in circumstances where there is no other way to stop
175 * callers from accessing the driver. Its original use was to
176 * allow the driver to be "drained" of work in preparation for
177 * a system shutdown.
178 *
179 * NOTE: once issued, this ban on new work cannot be undone
180 * except by unloading and reloading the driver.
181 */
182
183/**
184 * Supported ioctl calls
185 */
186#define ICARSAMODEXPO _IOC(_IOC_READ|_IOC_WRITE, Z90_IOCTL_MAGIC, 0x05, 0)
187#define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, Z90_IOCTL_MAGIC, 0x06, 0)
188
189/* DEPRECATED status calls (bound for removal at some point) */
190#define ICAZ90STATUS _IOR(Z90_IOCTL_MAGIC, 0x10, struct ica_z90_status)
191#define Z90STAT_PCIXCCCOUNT _IOR(Z90_IOCTL_MAGIC, 0x43, int)
192
193/* unrelated to ICA callers */
194#define Z90QUIESCE _IO(Z90_IOCTL_MAGIC, 0x11)
195
196/* New status calls */
197#define Z90STAT_TOTALCOUNT _IOR(Z90_IOCTL_MAGIC, 0x40, int)
198#define Z90STAT_PCICACOUNT _IOR(Z90_IOCTL_MAGIC, 0x41, int)
199#define Z90STAT_PCICCCOUNT _IOR(Z90_IOCTL_MAGIC, 0x42, int)
200#define Z90STAT_PCIXCCMCL2COUNT _IOR(Z90_IOCTL_MAGIC, 0x4b, int)
201#define Z90STAT_PCIXCCMCL3COUNT _IOR(Z90_IOCTL_MAGIC, 0x4c, int)
202#define Z90STAT_CEX2CCOUNT _IOR(Z90_IOCTL_MAGIC, 0x4d, int)
203#define Z90STAT_CEX2ACOUNT _IOR(Z90_IOCTL_MAGIC, 0x4e, int)
204#define Z90STAT_REQUESTQ_COUNT _IOR(Z90_IOCTL_MAGIC, 0x44, int)
205#define Z90STAT_PENDINGQ_COUNT _IOR(Z90_IOCTL_MAGIC, 0x45, int)
206#define Z90STAT_TOTALOPEN_COUNT _IOR(Z90_IOCTL_MAGIC, 0x46, int)
207#define Z90STAT_DOMAIN_INDEX _IOR(Z90_IOCTL_MAGIC, 0x47, int)
208#define Z90STAT_STATUS_MASK _IOR(Z90_IOCTL_MAGIC, 0x48, char[64])
209#define Z90STAT_QDEPTH_MASK _IOR(Z90_IOCTL_MAGIC, 0x49, char[64])
210#define Z90STAT_PERDEV_REQCNT _IOR(Z90_IOCTL_MAGIC, 0x4a, int[64])
211
212#endif /* __ASM_S390_Z90CRYPT_H */