MIPS: Yosemite, Emma: Fix off-by-two in arcs_cmdline buffer size check
[linux-2.6/linux-mips.git] / drivers / s390 / crypto / zcrypt_pcica.h
blob3be11187f6df35feda6c095802ddf38ffc6cc8e4
1 /*
2 * linux/drivers/s390/crypto/zcrypt_pcica.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_PCICA_H_
29 #define _ZCRYPT_PCICA_H_
31 /**
32 * The type 4 message family is associated with a PCICA 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 type4_hdr {
42 unsigned char reserved1;
43 unsigned char msg_type_code; /* 0x04 */
44 unsigned short msg_len;
45 unsigned char request_code; /* 0x40 */
46 unsigned char msg_fmt;
47 unsigned short reserved2;
48 } __attribute__((packed));
50 #define TYPE4_TYPE_CODE 0x04
51 #define TYPE4_REQU_CODE 0x40
53 #define TYPE4_SME_FMT 0x00
54 #define TYPE4_LME_FMT 0x10
55 #define TYPE4_SCR_FMT 0x40
56 #define TYPE4_LCR_FMT 0x50
58 /* Mod-Exp, with a small modulus */
59 struct type4_sme {
60 struct type4_hdr header;
61 unsigned char message[128];
62 unsigned char exponent[128];
63 unsigned char modulus[128];
64 } __attribute__((packed));
66 /* Mod-Exp, with a large modulus */
67 struct type4_lme {
68 struct type4_hdr header;
69 unsigned char message[256];
70 unsigned char exponent[256];
71 unsigned char modulus[256];
72 } __attribute__((packed));
74 /* CRT, with a small modulus */
75 struct type4_scr {
76 struct type4_hdr header;
77 unsigned char message[128];
78 unsigned char dp[72];
79 unsigned char dq[64];
80 unsigned char p[72];
81 unsigned char q[64];
82 unsigned char u[72];
83 } __attribute__((packed));
85 /* CRT, with a large modulus */
86 struct type4_lcr {
87 struct type4_hdr header;
88 unsigned char message[256];
89 unsigned char dp[136];
90 unsigned char dq[128];
91 unsigned char p[136];
92 unsigned char q[128];
93 unsigned char u[136];
94 } __attribute__((packed));
96 /**
97 * The type 84 response family is associated with a PCICA card.
99 * Note that all unsigned char arrays are right-justified and left-padded
100 * with zeroes.
102 * Note that all reserved fields must be zeroes.
105 struct type84_hdr {
106 unsigned char reserved1;
107 unsigned char code;
108 unsigned short len;
109 unsigned char reserved2[4];
110 } __attribute__((packed));
112 #define TYPE84_RSP_CODE 0x84
114 int zcrypt_pcica_init(void);
115 void zcrypt_pcica_exit(void);
117 #endif /* _ZCRYPT_PCICA_H_ */