1
2
3
4
5
6
7
8
9
10
11 #ifndef _ZCRYPT_CEX2A_H_
12 #define _ZCRYPT_CEX2A_H_
13
14
15
16
17
18
19
20
21
22
23
24 struct type50_hdr {
25 unsigned char reserved1;
26 unsigned char msg_type_code;
27 unsigned short msg_len;
28 unsigned char reserved2;
29 unsigned char ignored;
30 unsigned short reserved3;
31 } __packed;
32
33 #define TYPE50_TYPE_CODE 0x50
34
35 #define TYPE50_MEB1_FMT 0x0001
36 #define TYPE50_MEB2_FMT 0x0002
37 #define TYPE50_MEB3_FMT 0x0003
38 #define TYPE50_CRB1_FMT 0x0011
39 #define TYPE50_CRB2_FMT 0x0012
40 #define TYPE50_CRB3_FMT 0x0013
41
42
43 struct type50_meb1_msg {
44 struct type50_hdr header;
45 unsigned short keyblock_type;
46 unsigned char reserved[6];
47 unsigned char exponent[128];
48 unsigned char modulus[128];
49 unsigned char message[128];
50 } __packed;
51
52
53 struct type50_meb2_msg {
54 struct type50_hdr header;
55 unsigned short keyblock_type;
56 unsigned char reserved[6];
57 unsigned char exponent[256];
58 unsigned char modulus[256];
59 unsigned char message[256];
60 } __packed;
61
62
63 struct type50_meb3_msg {
64 struct type50_hdr header;
65 unsigned short keyblock_type;
66 unsigned char reserved[6];
67 unsigned char exponent[512];
68 unsigned char modulus[512];
69 unsigned char message[512];
70 } __packed;
71
72
73 struct type50_crb1_msg {
74 struct type50_hdr header;
75 unsigned short keyblock_type;
76 unsigned char reserved[6];
77 unsigned char p[64];
78 unsigned char q[64];
79 unsigned char dp[64];
80 unsigned char dq[64];
81 unsigned char u[64];
82 unsigned char message[128];
83 } __packed;
84
85
86 struct type50_crb2_msg {
87 struct type50_hdr header;
88 unsigned short keyblock_type;
89 unsigned char reserved[6];
90 unsigned char p[128];
91 unsigned char q[128];
92 unsigned char dp[128];
93 unsigned char dq[128];
94 unsigned char u[128];
95 unsigned char message[256];
96 } __packed;
97
98
99 struct type50_crb3_msg {
100 struct type50_hdr header;
101 unsigned short keyblock_type;
102 unsigned char reserved[6];
103 unsigned char p[256];
104 unsigned char q[256];
105 unsigned char dp[256];
106 unsigned char dq[256];
107 unsigned char u[256];
108 unsigned char message[512];
109 } __packed;
110
111
112
113
114
115
116
117
118
119
120 #define TYPE80_RSP_CODE 0x80
121
122 struct type80_hdr {
123 unsigned char reserved1;
124 unsigned char type;
125 unsigned short len;
126 unsigned char code;
127 unsigned char reserved2[3];
128 unsigned char reserved3[8];
129 } __packed;
130
131 int zcrypt_cex2a_init(void);
132 void zcrypt_cex2a_exit(void);
133
134 #endif