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