1/* 2 * zcrypt 2.1.0 3 * 4 * Copyright IBM Corp. 2001, 2006 5 * Author(s): Robert Burroughs 6 * Eric Rossman (edrossma@us.ibm.com) 7 * 8 * Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com) 9 * Major cleanup & driver split: Martin Schwidefsky <schwidefsky@de.ibm.com> 10 * 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. 15 * 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. 20 * 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. 24 */ 25 26#ifndef _ZCRYPT_PCICA_H_ 27#define _ZCRYPT_PCICA_H_ 28 29/** 30 * The type 4 message family is associated with a PCICA card. 31 * 32 * The four members of the family are described below. 33 * 34 * Note that all unsigned char arrays are right-justified and left-padded 35 * with zeroes. 36 * 37 * Note that all reserved fields must be zeroes. 38 */ 39struct 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)); 47 48#define TYPE4_TYPE_CODE 0x04 49#define TYPE4_REQU_CODE 0x40 50 51#define TYPE4_SME_FMT 0x00 52#define TYPE4_LME_FMT 0x10 53#define TYPE4_SCR_FMT 0x40 54#define TYPE4_LCR_FMT 0x50 55 56/* Mod-Exp, with a small modulus */ 57struct 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)); 63 64/* Mod-Exp, with a large modulus */ 65struct 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)); 71 72/* CRT, with a small modulus */ 73struct 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)); 82 83/* CRT, with a large modulus */ 84struct 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)); 93 94/** 95 * The type 84 response family is associated with a PCICA card. 96 * 97 * Note that all unsigned char arrays are right-justified and left-padded 98 * with zeroes. 99 * 100 * Note that all reserved fields must be zeroes. 101 */ 102 103struct type84_hdr { 104 unsigned char reserved1; 105 unsigned char code; 106 unsigned short len; 107 unsigned char reserved2[4]; 108} __attribute__((packed)); 109 110#define TYPE84_RSP_CODE 0x84 111 112int zcrypt_pcica_init(void); 113void zcrypt_pcica_exit(void); 114 115#endif /* _ZCRYPT_PCICA_H_ */ 116