2 * include/asm-s390/zcrypt.h
4 * zcrypt 2.0.0 (user-visible header)
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)
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)
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.
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.
27 #ifndef __ASM_S390_ZCRYPT_H
28 #define __ASM_S390_ZCRYPT_H
30 #define ZCRYPT_VERSION 2
31 #define ZCRYPT_RELEASE 1
32 #define ZCRYPT_VARIANT 0
34 #include <linux/ioctl.h>
35 #include <linux/compiler.h>
38 * struct ica_rsa_modexpo
41 * - outputdatalength is at least as large as inputdatalength.
42 * - All key parts are right justified in their fields, padded on
43 * the left with zeroes.
44 * - length(b_key) = inputdatalength
45 * - length(n_modulus) = inputdatalength
47 struct ica_rsa_modexpo {
48 char __user * inputdata;
49 unsigned int inputdatalength;
50 char __user * outputdata;
51 unsigned int outputdatalength;
53 char __user * n_modulus;
57 * struct ica_rsa_modexpo_crt
60 * - inputdatalength is even.
61 * - outputdatalength is at least as large as inputdatalength.
62 * - All key parts are right justified in their fields, padded on
63 * the left with zeroes.
64 * - length(bp_key) = inputdatalength/2 + 8
65 * - length(bq_key) = inputdatalength/2
66 * - length(np_key) = inputdatalength/2 + 8
67 * - length(nq_key) = inputdatalength/2
68 * - length(u_mult_inv) = inputdatalength/2 + 8
70 struct ica_rsa_modexpo_crt {
71 char __user * inputdata;
72 unsigned int inputdatalength;
73 char __user * outputdata;
74 unsigned int outputdatalength;
77 char __user * np_prime;
78 char __user * nq_prime;
79 char __user * u_mult_inv;
82 #define ZCRYPT_IOCTL_MAGIC 'z'
87 * The ioctl()s which are implemented (along with relevant details)
91 * Perform an RSA operation using a Modulus-Exponent pair
92 * This takes an ica_rsa_modexpo struct as its arg.
94 * NOTE: please refer to the comments preceding this structure
95 * for the implementation details for the contents of the
99 * Perform an RSA operation using a Chinese-Remainder Theorem key
100 * This takes an ica_rsa_modexpo_crt struct as its arg.
102 * NOTE: please refer to the comments preceding this structure
103 * for the implementation details for the contents of the
107 * Return an integer count of all device types together.
110 * Return an integer count of all PCICAs.
113 * Return an integer count of all PCICCs.
115 * Z90STAT_PCIXCCMCL2COUNT
116 * Return an integer count of all MCL2 PCIXCCs.
118 * Z90STAT_PCIXCCMCL3COUNT
119 * Return an integer count of all MCL3 PCIXCCs.
122 * Return an integer count of all CEX2Cs.
125 * Return an integer count of all CEX2As.
127 * Z90STAT_REQUESTQ_COUNT
128 * Return an integer count of the number of entries waiting to be
131 * Z90STAT_PENDINGQ_COUNT
132 * Return an integer count of the number of entries sent to a
133 * device awaiting the reply.
135 * Z90STAT_TOTALOPEN_COUNT
136 * Return an integer count of the number of open file handles.
138 * Z90STAT_DOMAIN_INDEX
139 * Return the integer value of the Cryptographic Domain.
141 * Z90STAT_STATUS_MASK
142 * Return an 64 element array of unsigned chars for the status of
150 * 0x0d: device is disabled via the proc filesystem
152 * Z90STAT_QDEPTH_MASK
153 * Return an 64 element array of unsigned chars for the queue
154 * depth of all devices.
156 * Z90STAT_PERDEV_REQCNT
157 * Return an 64 element array of unsigned integers for the number
158 * of successfully completed requests per device since the device
159 * was detected and made available.
161 * ICAZ90STATUS (deprecated)
162 * Return some device driver status in a ica_z90_status struct
163 * This takes an ica_z90_status struct as its arg.
165 * NOTE: this ioctl() is deprecated, and has been replaced with
166 * single ioctl()s for each type of status being requested
168 * Z90STAT_PCIXCCCOUNT (deprecated)
169 * Return an integer count of all PCIXCCs (MCL2 + MCL3).
170 * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from
173 * Z90QUIESCE (not recommended)
174 * Quiesce the driver. This is intended to stop all new
175 * requests from being processed. Its use is NOT recommended,
176 * except in circumstances where there is no other way to stop
177 * callers from accessing the driver. Its original use was to
178 * allow the driver to be "drained" of work in preparation for
181 * NOTE: once issued, this ban on new work cannot be undone
182 * except by unloading and reloading the driver.
186 * Supported ioctl calls
188 #define ICARSAMODEXPO _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x05, 0)
189 #define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x06, 0)
191 /* New status calls */
192 #define Z90STAT_TOTALCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x40, int)
193 #define Z90STAT_PCICACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x41, int)
194 #define Z90STAT_PCICCCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x42, int)
195 #define Z90STAT_PCIXCCMCL2COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4b, int)
196 #define Z90STAT_PCIXCCMCL3COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4c, int)
197 #define Z90STAT_CEX2CCOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4d, int)
198 #define Z90STAT_CEX2ACOUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4e, int)
199 #define Z90STAT_REQUESTQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x44, int)
200 #define Z90STAT_PENDINGQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x45, int)
201 #define Z90STAT_TOTALOPEN_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x46, int)
202 #define Z90STAT_DOMAIN_INDEX _IOR(ZCRYPT_IOCTL_MAGIC, 0x47, int)
203 #define Z90STAT_STATUS_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x48, char[64])
204 #define Z90STAT_QDEPTH_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x49, char[64])
205 #define Z90STAT_PERDEV_REQCNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4a, int[64])
207 #endif /* __ASM_S390_ZCRYPT_H */