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