zcrypt_pcica.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. #ifndef _ZCRYPT_PCICA_H_
  26. #define _ZCRYPT_PCICA_H_
  27. /**
  28. * The type 4 message family is associated with a PCICA card.
  29. *
  30. * The four members of the family are described below.
  31. *
  32. * Note that all unsigned char arrays are right-justified and left-padded
  33. * with zeroes.
  34. *
  35. * Note that all reserved fields must be zeroes.
  36. */
  37. struct type4_hdr {
  38. unsigned char reserved1;
  39. unsigned char msg_type_code; /* 0x04 */
  40. unsigned short msg_len;
  41. unsigned char request_code; /* 0x40 */
  42. unsigned char msg_fmt;
  43. unsigned short reserved2;
  44. } __attribute__((packed));
  45. #define TYPE4_TYPE_CODE 0x04
  46. #define TYPE4_REQU_CODE 0x40
  47. #define TYPE4_SME_FMT 0x00
  48. #define TYPE4_LME_FMT 0x10
  49. #define TYPE4_SCR_FMT 0x40
  50. #define TYPE4_LCR_FMT 0x50
  51. /* Mod-Exp, with a small modulus */
  52. struct type4_sme {
  53. struct type4_hdr header;
  54. unsigned char message[128];
  55. unsigned char exponent[128];
  56. unsigned char modulus[128];
  57. } __attribute__((packed));
  58. /* Mod-Exp, with a large modulus */
  59. struct type4_lme {
  60. struct type4_hdr header;
  61. unsigned char message[256];
  62. unsigned char exponent[256];
  63. unsigned char modulus[256];
  64. } __attribute__((packed));
  65. /* CRT, with a small modulus */
  66. struct type4_scr {
  67. struct type4_hdr header;
  68. unsigned char message[128];
  69. unsigned char dp[72];
  70. unsigned char dq[64];
  71. unsigned char p[72];
  72. unsigned char q[64];
  73. unsigned char u[72];
  74. } __attribute__((packed));
  75. /* CRT, with a large modulus */
  76. struct type4_lcr {
  77. struct type4_hdr header;
  78. unsigned char message[256];
  79. unsigned char dp[136];
  80. unsigned char dq[128];
  81. unsigned char p[136];
  82. unsigned char q[128];
  83. unsigned char u[136];
  84. } __attribute__((packed));
  85. /**
  86. * The type 84 response family is associated with a PCICA card.
  87. *
  88. * Note that all unsigned char arrays are right-justified and left-padded
  89. * with zeroes.
  90. *
  91. * Note that all reserved fields must be zeroes.
  92. */
  93. struct type84_hdr {
  94. unsigned char reserved1;
  95. unsigned char code;
  96. unsigned short len;
  97. unsigned char reserved2[4];
  98. } __attribute__((packed));
  99. #define TYPE84_RSP_CODE 0x84
  100. int zcrypt_pcica_init(void);
  101. void zcrypt_pcica_exit(void);
  102. #endif /* _ZCRYPT_PCICA_H_ */