zcrypt_pcica.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * linux/drivers/s390/crypto/zcrypt_pcica.h
  3. *
  4. * zcrypt 2.1.0
  5. *
  6. * Copyright (C) 2001, 2006 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. * Major cleanup & driver split: Martin Schwidefsky <schwidefsky@de.ibm.com>
  12. *
  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.
  17. *
  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.
  22. *
  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.
  26. */
  27. #ifndef _ZCRYPT_PCICA_H_
  28. #define _ZCRYPT_PCICA_H_
  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. */
  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));
  47. #define TYPE4_TYPE_CODE 0x04
  48. #define TYPE4_REQU_CODE 0x40
  49. #define TYPE4_SME_FMT 0x00
  50. #define TYPE4_LME_FMT 0x10
  51. #define TYPE4_SCR_FMT 0x40
  52. #define TYPE4_LCR_FMT 0x50
  53. /* Mod-Exp, with a small modulus */
  54. struct type4_sme {
  55. struct type4_hdr header;
  56. unsigned char message[128];
  57. unsigned char exponent[128];
  58. unsigned char modulus[128];
  59. } __attribute__((packed));
  60. /* Mod-Exp, with a large modulus */
  61. struct type4_lme {
  62. struct type4_hdr header;
  63. unsigned char message[256];
  64. unsigned char exponent[256];
  65. unsigned char modulus[256];
  66. } __attribute__((packed));
  67. /* CRT, with a small modulus */
  68. struct type4_scr {
  69. struct type4_hdr header;
  70. unsigned char message[128];
  71. unsigned char dp[72];
  72. unsigned char dq[64];
  73. unsigned char p[72];
  74. unsigned char q[64];
  75. unsigned char u[72];
  76. } __attribute__((packed));
  77. /* CRT, with a large modulus */
  78. struct type4_lcr {
  79. struct type4_hdr header;
  80. unsigned char message[256];
  81. unsigned char dp[136];
  82. unsigned char dq[128];
  83. unsigned char p[136];
  84. unsigned char q[128];
  85. unsigned char u[136];
  86. } __attribute__((packed));
  87. /**
  88. * The type 84 response family is associated with a PCICA card.
  89. *
  90. * Note that all unsigned char arrays are right-justified and left-padded
  91. * with zeroes.
  92. *
  93. * Note that all reserved fields must be zeroes.
  94. */
  95. struct type84_hdr {
  96. unsigned char reserved1;
  97. unsigned char code;
  98. unsigned short len;
  99. unsigned char reserved2[4];
  100. } __attribute__((packed));
  101. #define TYPE84_RSP_CODE 0x84
  102. int zcrypt_pcica_init(void);
  103. void zcrypt_pcica_exit(void);
  104. #endif /* _ZCRYPT_PCICA_H_ */