xref: /freebsd/contrib/bearssl/src/x509/skey_decoder.c (revision cc9e6590773dba57440750c124173ed531349a06)
1 /* Automatically generated code; do not modify directly. */
2 
3 #include <stddef.h>
4 #include <stdint.h>
5 
6 typedef struct {
7 	uint32_t *dp;
8 	uint32_t *rp;
9 	const unsigned char *ip;
10 } t0_context;
11 
12 static uint32_t
t0_parse7E_unsigned(const unsigned char ** p)13 t0_parse7E_unsigned(const unsigned char **p)
14 {
15 	uint32_t x;
16 
17 	x = 0;
18 	for (;;) {
19 		unsigned y;
20 
21 		y = *(*p) ++;
22 		x = (x << 7) | (uint32_t)(y & 0x7F);
23 		if (y < 0x80) {
24 			return x;
25 		}
26 	}
27 }
28 
29 static int32_t
t0_parse7E_signed(const unsigned char ** p)30 t0_parse7E_signed(const unsigned char **p)
31 {
32 	int neg;
33 	uint32_t x;
34 
35 	neg = ((**p) >> 6) & 1;
36 	x = (uint32_t)-neg;
37 	for (;;) {
38 		unsigned y;
39 
40 		y = *(*p) ++;
41 		x = (x << 7) | (uint32_t)(y & 0x7F);
42 		if (y < 0x80) {
43 			if (neg) {
44 				return -(int32_t)~x - 1;
45 			} else {
46 				return (int32_t)x;
47 			}
48 		}
49 	}
50 }
51 
52 #define T0_VBYTE(x, n)   (unsigned char)((((uint32_t)(x) >> (n)) & 0x7F) | 0x80)
53 #define T0_FBYTE(x, n)   (unsigned char)(((uint32_t)(x) >> (n)) & 0x7F)
54 #define T0_SBYTE(x)      (unsigned char)((((uint32_t)(x) >> 28) + 0xF8) ^ 0xF8)
55 #define T0_INT1(x)       T0_FBYTE(x, 0)
56 #define T0_INT2(x)       T0_VBYTE(x, 7), T0_FBYTE(x, 0)
57 #define T0_INT3(x)       T0_VBYTE(x, 14), T0_VBYTE(x, 7), T0_FBYTE(x, 0)
58 #define T0_INT4(x)       T0_VBYTE(x, 21), T0_VBYTE(x, 14), T0_VBYTE(x, 7), T0_FBYTE(x, 0)
59 #define T0_INT5(x)       T0_SBYTE(x), T0_VBYTE(x, 21), T0_VBYTE(x, 14), T0_VBYTE(x, 7), T0_FBYTE(x, 0)
60 
61 /* static const unsigned char t0_datablock[]; */
62 
63 
64 void br_skey_decoder_init_main(void *t0ctx);
65 
66 void br_skey_decoder_run(void *t0ctx);
67 
68 
69 
70 #include "inner.h"
71 
72 
73 
74 
75 
76 #include "inner.h"
77 
78 #define CTX   ((br_skey_decoder_context *)(void *)((unsigned char *)t0ctx - offsetof(br_skey_decoder_context, cpu)))
79 #define CONTEXT_NAME   br_skey_decoder_context
80 
81 /* see bearssl_x509.h */
82 void
br_skey_decoder_init(br_skey_decoder_context * ctx)83 br_skey_decoder_init(br_skey_decoder_context *ctx)
84 {
85 	memset(ctx, 0, sizeof *ctx);
86 	ctx->cpu.dp = &ctx->dp_stack[0];
87 	ctx->cpu.rp = &ctx->rp_stack[0];
88 	br_skey_decoder_init_main(&ctx->cpu);
89 	br_skey_decoder_run(&ctx->cpu);
90 }
91 
92 /* see bearssl_x509.h */
93 void
br_skey_decoder_push(br_skey_decoder_context * ctx,const void * data,size_t len)94 br_skey_decoder_push(br_skey_decoder_context *ctx,
95 	const void *data, size_t len)
96 {
97 	ctx->hbuf = data;
98 	ctx->hlen = len;
99 	br_skey_decoder_run(&ctx->cpu);
100 }
101 
102 
103 
104 static const unsigned char t0_datablock[] = {
105 	0x00, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x07,
106 	0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x08, 0x2A, 0x86, 0x48, 0xCE,
107 	0x3D, 0x03, 0x01, 0x07, 0x05, 0x2B, 0x81, 0x04, 0x00, 0x22, 0x05, 0x2B,
108 	0x81, 0x04, 0x00, 0x23
109 };
110 
111 static const unsigned char t0_codeblock[] = {
112 	0x00, 0x01, 0x01, 0x07, 0x00, 0x00, 0x01, 0x01, 0x08, 0x00, 0x00, 0x13,
113 	0x13, 0x00, 0x00, 0x01, T0_INT1(BR_ERR_X509_BAD_TAG_CLASS), 0x00, 0x00,
114 	0x01, T0_INT1(BR_ERR_X509_BAD_TAG_VALUE), 0x00, 0x00, 0x01,
115 	T0_INT1(BR_ERR_X509_EXTRA_ELEMENT), 0x00, 0x00, 0x01,
116 	T0_INT1(BR_ERR_X509_INDEFINITE_LENGTH), 0x00, 0x00, 0x01,
117 	T0_INT1(BR_ERR_X509_INNER_TRUNC), 0x00, 0x00, 0x01,
118 	T0_INT1(BR_ERR_X509_INVALID_VALUE), 0x00, 0x00, 0x01,
119 	T0_INT1(BR_ERR_X509_LIMIT_EXCEEDED), 0x00, 0x00, 0x01,
120 	T0_INT1(BR_ERR_X509_NOT_CONSTRUCTED), 0x00, 0x00, 0x01,
121 	T0_INT1(BR_ERR_X509_NOT_PRIMITIVE), 0x00, 0x00, 0x01,
122 	T0_INT1(BR_ERR_X509_OVERFLOW), 0x00, 0x00, 0x01,
123 	T0_INT1(BR_ERR_X509_UNEXPECTED), 0x00, 0x00, 0x01,
124 	T0_INT1(BR_ERR_X509_UNSUPPORTED), 0x00, 0x00, 0x01,
125 	T0_INT1(BR_KEYTYPE_EC), 0x00, 0x00, 0x01, T0_INT1(BR_KEYTYPE_RSA),
126 	0x00, 0x00, 0x01, T0_INT2(offsetof(CONTEXT_NAME, key_data)), 0x00,
127 	0x00, 0x01, T0_INT2(offsetof(CONTEXT_NAME, key_type)), 0x00, 0x00,
128 	0x33, 0x48, 0x00, 0x00, 0x01, T0_INT2(offsetof(CONTEXT_NAME, pad)),
129 	0x00, 0x00, 0x01, 0x13, 0x00, 0x00, 0x01, 0x1C, 0x00, 0x00, 0x01, 0x22,
130 	0x00, 0x00, 0x05, 0x02, 0x2C, 0x16, 0x00, 0x00, 0x06, 0x02, 0x2D, 0x16,
131 	0x00, 0x00, 0x01, 0x10, 0x3D, 0x00, 0x00, 0x0D, 0x05, 0x02, 0x2F, 0x16,
132 	0x3A, 0x00, 0x00, 0x0D, 0x05, 0x02, 0x2F, 0x16, 0x3B, 0x00, 0x00, 0x06,
133 	0x02, 0x27, 0x16, 0x00, 0x01, 0x03, 0x00, 0x54, 0x57, 0x01, 0x02, 0x3E,
134 	0x55, 0x23, 0x06, 0x02, 0x30, 0x16, 0x57, 0x01, 0x04, 0x3E, 0x02, 0x00,
135 	0x41, 0x3F, 0x00, 0x02, 0x03, 0x00, 0x53, 0x14, 0x14, 0x03, 0x01, 0x48,
136 	0x0E, 0x06, 0x02, 0x30, 0x16, 0x33, 0x4C, 0x58, 0x01, 0x7F, 0x19, 0x0D,
137 	0x06, 0x04, 0x13, 0x13, 0x04, 0x29, 0x01, 0x20, 0x19, 0x0D, 0x06, 0x16,
138 	0x13, 0x3A, 0x53, 0x4D, 0x02, 0x00, 0x06, 0x09, 0x02, 0x00, 0x0C, 0x06,
139 	0x02, 0x2A, 0x16, 0x04, 0x02, 0x03, 0x00, 0x3F, 0x04, 0x0D, 0x01, 0x21,
140 	0x19, 0x0D, 0x06, 0x04, 0x13, 0x3A, 0x04, 0x03, 0x30, 0x16, 0x13, 0x5D,
141 	0x02, 0x00, 0x05, 0x02, 0x30, 0x16, 0x02, 0x00, 0x02, 0x01, 0x1D, 0x00,
142 	0x02, 0x53, 0x4B, 0x05, 0x02, 0x30, 0x16, 0x5B, 0x15, 0x06, 0x07, 0x5D,
143 	0x01, 0x7F, 0x03, 0x01, 0x04, 0x16, 0x46, 0x15, 0x06, 0x10, 0x01, 0x00,
144 	0x03, 0x01, 0x14, 0x06, 0x03, 0x4D, 0x04, 0x02, 0x01, 0x00, 0x03, 0x00,
145 	0x04, 0x02, 0x30, 0x16, 0x3F, 0x57, 0x01, 0x04, 0x3E, 0x53, 0x02, 0x01,
146 	0x06, 0x03, 0x43, 0x04, 0x03, 0x02, 0x00, 0x40, 0x3F, 0x5D, 0x02, 0x01,
147 	0x06, 0x03, 0x32, 0x04, 0x01, 0x31, 0x00, 0x00, 0x54, 0x57, 0x01, 0x02,
148 	0x3E, 0x55, 0x06, 0x02, 0x30, 0x16, 0x57, 0x01, 0x02, 0x3E, 0x44, 0x3F,
149 	0x00, 0x07, 0x35, 0x50, 0x14, 0x05, 0x02, 0x2F, 0x16, 0x23, 0x01, 0x03,
150 	0x0B, 0x33, 0x17, 0x47, 0x07, 0x03, 0x00, 0x4F, 0x4F, 0x35, 0x4E, 0x14,
151 	0x14, 0x03, 0x01, 0x03, 0x02, 0x51, 0x14, 0x03, 0x03, 0x02, 0x02, 0x07,
152 	0x14, 0x03, 0x02, 0x51, 0x14, 0x03, 0x04, 0x02, 0x02, 0x07, 0x14, 0x03,
153 	0x02, 0x51, 0x14, 0x03, 0x05, 0x02, 0x02, 0x07, 0x14, 0x03, 0x02, 0x51,
154 	0x03, 0x06, 0x02, 0x00, 0x02, 0x01, 0x02, 0x03, 0x02, 0x04, 0x02, 0x05,
155 	0x02, 0x06, 0x1E, 0x00, 0x00, 0x19, 0x19, 0x00, 0x00, 0x01, 0x0B, 0x00,
156 	0x00, 0x01, 0x00, 0x20, 0x14, 0x06, 0x08, 0x01, 0x01, 0x21, 0x20, 0x22,
157 	0x20, 0x04, 0x75, 0x13, 0x00, 0x00, 0x01,
158 	T0_INT2(3 * BR_X509_BUFSIZE_SIG), 0x00, 0x01, 0x01, 0x87, 0xFF, 0xFF,
159 	0x7F, 0x54, 0x57, 0x01, 0x02, 0x3E, 0x55, 0x01, 0x01, 0x0E, 0x06, 0x02,
160 	0x30, 0x16, 0x57, 0x01, 0x02, 0x19, 0x0D, 0x06, 0x06, 0x13, 0x3B, 0x44,
161 	0x32, 0x04, 0x1C, 0x01, 0x04, 0x19, 0x0D, 0x06, 0x08, 0x13, 0x3B, 0x01,
162 	0x00, 0x41, 0x31, 0x04, 0x0E, 0x01, 0x10, 0x19, 0x0D, 0x06, 0x05, 0x13,
163 	0x3A, 0x42, 0x04, 0x03, 0x30, 0x16, 0x13, 0x03, 0x00, 0x3F, 0x02, 0x00,
164 	0x34, 0x1F, 0x5A, 0x27, 0x16, 0x00, 0x01, 0x45, 0x0A, 0x06, 0x02, 0x29,
165 	0x16, 0x14, 0x03, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x57, 0x01, 0x06,
166 	0x3E, 0x56, 0x00, 0x00, 0x20, 0x14, 0x06, 0x07, 0x1A, 0x14, 0x06, 0x01,
167 	0x12, 0x04, 0x76, 0x24, 0x00, 0x00, 0x4B, 0x05, 0x02, 0x30, 0x16, 0x37,
168 	0x15, 0x06, 0x04, 0x01, 0x17, 0x04, 0x12, 0x38, 0x15, 0x06, 0x04, 0x01,
169 	0x18, 0x04, 0x0A, 0x39, 0x15, 0x06, 0x04, 0x01, 0x19, 0x04, 0x02, 0x30,
170 	0x16, 0x00, 0x00, 0x1C, 0x57, 0x01, 0x02, 0x3E, 0x09, 0x50, 0x00, 0x00,
171 	0x35, 0x4E, 0x13, 0x00, 0x03, 0x14, 0x03, 0x00, 0x03, 0x01, 0x03, 0x02,
172 	0x53, 0x59, 0x14, 0x01, 0x81, 0x00, 0x0F, 0x06, 0x02, 0x2E, 0x16, 0x14,
173 	0x01, 0x00, 0x0D, 0x06, 0x0B, 0x13, 0x14, 0x05, 0x04, 0x13, 0x01, 0x00,
174 	0x00, 0x59, 0x04, 0x6F, 0x02, 0x01, 0x14, 0x05, 0x02, 0x2B, 0x16, 0x23,
175 	0x03, 0x01, 0x02, 0x02, 0x1F, 0x02, 0x02, 0x22, 0x03, 0x02, 0x14, 0x06,
176 	0x03, 0x59, 0x04, 0x68, 0x13, 0x02, 0x00, 0x02, 0x01, 0x08, 0x00, 0x00,
177 	0x14, 0x35, 0x1C, 0x08, 0x20, 0x1C, 0x07, 0x20, 0x4E, 0x00, 0x01, 0x59,
178 	0x14, 0x01, 0x81, 0x00, 0x0A, 0x06, 0x01, 0x00, 0x01, 0x81, 0x00, 0x08,
179 	0x14, 0x05, 0x02, 0x28, 0x16, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01,
180 	0x00, 0x0E, 0x06, 0x19, 0x02, 0x00, 0x23, 0x03, 0x00, 0x14, 0x01, 0x83,
181 	0xFF, 0xFF, 0x7F, 0x0E, 0x06, 0x02, 0x29, 0x16, 0x01, 0x08, 0x0B, 0x20,
182 	0x59, 0x1C, 0x07, 0x04, 0x60, 0x00, 0x00, 0x52, 0x4A, 0x00, 0x00, 0x57,
183 	0x3C, 0x53, 0x00, 0x01, 0x53, 0x14, 0x05, 0x02, 0x2E, 0x16, 0x59, 0x14,
184 	0x01, 0x81, 0x00, 0x0F, 0x06, 0x02, 0x2E, 0x16, 0x03, 0x00, 0x14, 0x06,
185 	0x16, 0x59, 0x02, 0x00, 0x14, 0x01, 0x87, 0xFF, 0xFF, 0x7F, 0x0F, 0x06,
186 	0x02, 0x2E, 0x16, 0x01, 0x08, 0x0B, 0x07, 0x03, 0x00, 0x04, 0x67, 0x13,
187 	0x02, 0x00, 0x00, 0x00, 0x53, 0x14, 0x01, 0x81, 0x7F, 0x0E, 0x06, 0x08,
188 	0x5C, 0x01, 0x00, 0x36, 0x1F, 0x01, 0x00, 0x00, 0x14, 0x36, 0x1F, 0x36,
189 	0x22, 0x4C, 0x01, 0x7F, 0x00, 0x01, 0x59, 0x03, 0x00, 0x02, 0x00, 0x01,
190 	0x05, 0x10, 0x01, 0x01, 0x11, 0x18, 0x02, 0x00, 0x01, 0x06, 0x10, 0x14,
191 	0x01, 0x01, 0x11, 0x06, 0x02, 0x25, 0x16, 0x01, 0x04, 0x0B, 0x02, 0x00,
192 	0x01, 0x1F, 0x11, 0x14, 0x01, 0x1F, 0x0D, 0x06, 0x02, 0x26, 0x16, 0x07,
193 	0x00, 0x00, 0x14, 0x05, 0x05, 0x01, 0x00, 0x01, 0x7F, 0x00, 0x57, 0x00,
194 	0x00, 0x14, 0x05, 0x02, 0x29, 0x16, 0x23, 0x5A, 0x00, 0x00, 0x1B, 0x14,
195 	0x01, 0x00, 0x0F, 0x06, 0x01, 0x00, 0x13, 0x12, 0x04, 0x74, 0x00, 0x01,
196 	0x01, 0x00, 0x00, 0x5D, 0x13, 0x00, 0x00, 0x14, 0x06, 0x07, 0x5E, 0x14,
197 	0x06, 0x01, 0x12, 0x04, 0x76, 0x00, 0x00, 0x01, 0x00, 0x19, 0x1A, 0x09,
198 	0x24, 0x00
199 };
200 
201 static const uint16_t t0_caddr[] = {
202 	0,
203 	5,
204 	10,
205 	14,
206 	18,
207 	22,
208 	26,
209 	30,
210 	34,
211 	38,
212 	42,
213 	46,
214 	50,
215 	54,
216 	58,
217 	62,
218 	66,
219 	70,
220 	75,
221 	80,
222 	84,
223 	89,
224 	93,
225 	97,
226 	101,
227 	107,
228 	113,
229 	118,
230 	126,
231 	134,
232 	140,
233 	163,
234 	244,
235 	311,
236 	329,
237 	404,
238 	408,
239 	412,
240 	429,
241 	434,
242 	505,
243 	519,
244 	526,
245 	540,
246 	573,
247 	582,
248 	587,
249 	654,
250 	665,
251 	721,
252 	725,
253 	730,
254 	778,
255 	804,
256 	848,
257 	859,
258 	868,
259 	881,
260 	885,
261 	889,
262 	901
263 };
264 
265 #define T0_INTERPRETED   34
266 
267 #define T0_ENTER(ip, rp, slot)   do { \
268 		const unsigned char *t0_newip; \
269 		uint32_t t0_lnum; \
270 		t0_newip = &t0_codeblock[t0_caddr[(slot) - T0_INTERPRETED]]; \
271 		t0_lnum = t0_parse7E_unsigned(&t0_newip); \
272 		(rp) += t0_lnum; \
273 		*((rp) ++) = (uint32_t)((ip) - &t0_codeblock[0]) + (t0_lnum << 16); \
274 		(ip) = t0_newip; \
275 	} while (0)
276 
277 #define T0_DEFENTRY(name, slot) \
278 void \
279 name(void *ctx) \
280 { \
281 	t0_context *t0ctx = ctx; \
282 	t0ctx->ip = &t0_codeblock[0]; \
283 	T0_ENTER(t0ctx->ip, t0ctx->rp, slot); \
284 }
285 
286 T0_DEFENTRY(br_skey_decoder_init_main, 73)
287 
288 #define T0_NEXT(t0ipp)   (*(*(t0ipp)) ++)
289 
290 void
br_skey_decoder_run(void * t0ctx)291 br_skey_decoder_run(void *t0ctx)
292 {
293 	uint32_t *dp, *rp;
294 	const unsigned char *ip;
295 
296 #define T0_LOCAL(x)    (*(rp - 2 - (x)))
297 #define T0_POP()       (*-- dp)
298 #define T0_POPi()      (*(int32_t *)(-- dp))
299 #define T0_PEEK(x)     (*(dp - 1 - (x)))
300 #define T0_PEEKi(x)    (*(int32_t *)(dp - 1 - (x)))
301 #define T0_PUSH(v)     do { *dp = (v); dp ++; } while (0)
302 #define T0_PUSHi(v)    do { *(int32_t *)dp = (v); dp ++; } while (0)
303 #define T0_RPOP()      (*-- rp)
304 #define T0_RPOPi()     (*(int32_t *)(-- rp))
305 #define T0_RPUSH(v)    do { *rp = (v); rp ++; } while (0)
306 #define T0_RPUSHi(v)   do { *(int32_t *)rp = (v); rp ++; } while (0)
307 #define T0_ROLL(x)     do { \
308 	size_t t0len = (size_t)(x); \
309 	uint32_t t0tmp = *(dp - 1 - t0len); \
310 	memmove(dp - t0len - 1, dp - t0len, t0len * sizeof *dp); \
311 	*(dp - 1) = t0tmp; \
312 } while (0)
313 #define T0_SWAP()      do { \
314 	uint32_t t0tmp = *(dp - 2); \
315 	*(dp - 2) = *(dp - 1); \
316 	*(dp - 1) = t0tmp; \
317 } while (0)
318 #define T0_ROT()       do { \
319 	uint32_t t0tmp = *(dp - 3); \
320 	*(dp - 3) = *(dp - 2); \
321 	*(dp - 2) = *(dp - 1); \
322 	*(dp - 1) = t0tmp; \
323 } while (0)
324 #define T0_NROT()       do { \
325 	uint32_t t0tmp = *(dp - 1); \
326 	*(dp - 1) = *(dp - 2); \
327 	*(dp - 2) = *(dp - 3); \
328 	*(dp - 3) = t0tmp; \
329 } while (0)
330 #define T0_PICK(x)      do { \
331 	uint32_t t0depth = (x); \
332 	T0_PUSH(T0_PEEK(t0depth)); \
333 } while (0)
334 #define T0_CO()         do { \
335 	goto t0_exit; \
336 } while (0)
337 #define T0_RET()        goto t0_next
338 
339 	dp = ((t0_context *)t0ctx)->dp;
340 	rp = ((t0_context *)t0ctx)->rp;
341 	ip = ((t0_context *)t0ctx)->ip;
342 	goto t0_next;
343 	for (;;) {
344 		uint32_t t0x;
345 
346 	t0_next:
347 		t0x = T0_NEXT(&ip);
348 		if (t0x < T0_INTERPRETED) {
349 			switch (t0x) {
350 				int32_t t0off;
351 
352 			case 0: /* ret */
353 				t0x = T0_RPOP();
354 				rp -= (t0x >> 16);
355 				t0x &= 0xFFFF;
356 				if (t0x == 0) {
357 					ip = NULL;
358 					goto t0_exit;
359 				}
360 				ip = &t0_codeblock[t0x];
361 				break;
362 			case 1: /* literal constant */
363 				T0_PUSHi(t0_parse7E_signed(&ip));
364 				break;
365 			case 2: /* read local */
366 				T0_PUSH(T0_LOCAL(t0_parse7E_unsigned(&ip)));
367 				break;
368 			case 3: /* write local */
369 				T0_LOCAL(t0_parse7E_unsigned(&ip)) = T0_POP();
370 				break;
371 			case 4: /* jump */
372 				t0off = t0_parse7E_signed(&ip);
373 				ip += t0off;
374 				break;
375 			case 5: /* jump if */
376 				t0off = t0_parse7E_signed(&ip);
377 				if (T0_POP()) {
378 					ip += t0off;
379 				}
380 				break;
381 			case 6: /* jump if not */
382 				t0off = t0_parse7E_signed(&ip);
383 				if (!T0_POP()) {
384 					ip += t0off;
385 				}
386 				break;
387 			case 7: {
388 				/* + */
389 
390 	uint32_t b = T0_POP();
391 	uint32_t a = T0_POP();
392 	T0_PUSH(a + b);
393 
394 				}
395 				break;
396 			case 8: {
397 				/* - */
398 
399 	uint32_t b = T0_POP();
400 	uint32_t a = T0_POP();
401 	T0_PUSH(a - b);
402 
403 				}
404 				break;
405 			case 9: {
406 				/* -rot */
407  T0_NROT();
408 				}
409 				break;
410 			case 10: {
411 				/* < */
412 
413 	int32_t b = T0_POPi();
414 	int32_t a = T0_POPi();
415 	T0_PUSH(-(uint32_t)(a < b));
416 
417 				}
418 				break;
419 			case 11: {
420 				/* << */
421 
422 	int c = (int)T0_POPi();
423 	uint32_t x = T0_POP();
424 	T0_PUSH(x << c);
425 
426 				}
427 				break;
428 			case 12: {
429 				/* <> */
430 
431 	uint32_t b = T0_POP();
432 	uint32_t a = T0_POP();
433 	T0_PUSH(-(uint32_t)(a != b));
434 
435 				}
436 				break;
437 			case 13: {
438 				/* = */
439 
440 	uint32_t b = T0_POP();
441 	uint32_t a = T0_POP();
442 	T0_PUSH(-(uint32_t)(a == b));
443 
444 				}
445 				break;
446 			case 14: {
447 				/* > */
448 
449 	int32_t b = T0_POPi();
450 	int32_t a = T0_POPi();
451 	T0_PUSH(-(uint32_t)(a > b));
452 
453 				}
454 				break;
455 			case 15: {
456 				/* >= */
457 
458 	int32_t b = T0_POPi();
459 	int32_t a = T0_POPi();
460 	T0_PUSH(-(uint32_t)(a >= b));
461 
462 				}
463 				break;
464 			case 16: {
465 				/* >> */
466 
467 	int c = (int)T0_POPi();
468 	int32_t x = T0_POPi();
469 	T0_PUSHi(x >> c);
470 
471 				}
472 				break;
473 			case 17: {
474 				/* and */
475 
476 	uint32_t b = T0_POP();
477 	uint32_t a = T0_POP();
478 	T0_PUSH(a & b);
479 
480 				}
481 				break;
482 			case 18: {
483 				/* co */
484  T0_CO();
485 				}
486 				break;
487 			case 19: {
488 				/* drop */
489  (void)T0_POP();
490 				}
491 				break;
492 			case 20: {
493 				/* dup */
494  T0_PUSH(T0_PEEK(0));
495 				}
496 				break;
497 			case 21: {
498 				/* eqOID */
499 
500 	const unsigned char *a2 = &t0_datablock[T0_POP()];
501 	const unsigned char *a1 = &CTX->pad[0];
502 	size_t len = a1[0];
503 	int x;
504 	if (len == a2[0]) {
505 		x = -(memcmp(a1 + 1, a2 + 1, len) == 0);
506 	} else {
507 		x = 0;
508 	}
509 	T0_PUSH((uint32_t)x);
510 
511 				}
512 				break;
513 			case 22: {
514 				/* fail */
515 
516 	CTX->err = T0_POPi();
517 	T0_CO();
518 
519 				}
520 				break;
521 			case 23: {
522 				/* get8 */
523 
524 	uint32_t addr = T0_POP();
525 	T0_PUSH(*((unsigned char *)CTX + addr));
526 
527 				}
528 				break;
529 			case 24: {
530 				/* neg */
531 
532 	uint32_t a = T0_POP();
533 	T0_PUSH(-a);
534 
535 				}
536 				break;
537 			case 25: {
538 				/* over */
539  T0_PUSH(T0_PEEK(1));
540 				}
541 				break;
542 			case 26: {
543 				/* read-blob-inner */
544 
545 	uint32_t len = T0_POP();
546 	uint32_t addr = T0_POP();
547 	size_t clen = CTX->hlen;
548 	if (clen > len) {
549 		clen = (size_t)len;
550 	}
551 	if (addr != 0) {
552 		memcpy((unsigned char *)CTX + addr, CTX->hbuf, clen);
553 	}
554 	CTX->hbuf += clen;
555 	CTX->hlen -= clen;
556 	T0_PUSH(addr + clen);
557 	T0_PUSH(len - clen);
558 
559 				}
560 				break;
561 			case 27: {
562 				/* read8-low */
563 
564 	if (CTX->hlen == 0) {
565 		T0_PUSHi(-1);
566 	} else {
567 		CTX->hlen --;
568 		T0_PUSH(*CTX->hbuf ++);
569 	}
570 
571 				}
572 				break;
573 			case 28: {
574 				/* rot */
575  T0_ROT();
576 				}
577 				break;
578 			case 29: {
579 				/* set-ec-key */
580 
581 	size_t xlen = T0_POP();
582 	uint32_t curve = T0_POP();
583 	CTX->key.ec.curve = curve;
584 	CTX->key.ec.x = CTX->key_data;
585 	CTX->key.ec.xlen = xlen;
586 
587 				}
588 				break;
589 			case 30: {
590 				/* set-rsa-key */
591 
592 	size_t iqlen = T0_POP();
593 	size_t dqlen = T0_POP();
594 	size_t dplen = T0_POP();
595 	size_t qlen = T0_POP();
596 	size_t plen = T0_POP();
597 	uint32_t n_bitlen = T0_POP();
598 	size_t off;
599 
600 	CTX->key.rsa.n_bitlen = n_bitlen;
601 	CTX->key.rsa.p = CTX->key_data;
602 	CTX->key.rsa.plen = plen;
603 	off = plen;
604 	CTX->key.rsa.q = CTX->key_data + off;
605 	CTX->key.rsa.qlen = qlen;
606 	off += qlen;
607 	CTX->key.rsa.dp = CTX->key_data + off;
608 	CTX->key.rsa.dplen = dplen;
609 	off += dplen;
610 	CTX->key.rsa.dq = CTX->key_data + off;
611 	CTX->key.rsa.dqlen = dqlen;
612 	off += dqlen;
613 	CTX->key.rsa.iq = CTX->key_data + off;
614 	CTX->key.rsa.iqlen = iqlen;
615 
616 				}
617 				break;
618 			case 31: {
619 				/* set8 */
620 
621 	uint32_t addr = T0_POP();
622 	*((unsigned char *)CTX + addr) = (unsigned char)T0_POP();
623 
624 				}
625 				break;
626 			case 32: {
627 				/* swap */
628  T0_SWAP();
629 				}
630 				break;
631 			case 33: {
632 				/* u>> */
633 
634 	int c = (int)T0_POPi();
635 	uint32_t x = T0_POP();
636 	T0_PUSH(x >> c);
637 
638 				}
639 				break;
640 			}
641 
642 		} else {
643 			T0_ENTER(ip, rp, t0x);
644 		}
645 	}
646 t0_exit:
647 	((t0_context *)t0ctx)->dp = dp;
648 	((t0_context *)t0ctx)->rp = rp;
649 	((t0_context *)t0ctx)->ip = ip;
650 }
651