xref: /netbsd-src/crypto/external/bsd/openssl.old/lib/libcrypto/arch/mips/aes-mips.S (revision 4724848cf0da353df257f730694b7882798e5daf)
1#include "mips_arch.h"
2
3.text
4#if !defined(__mips_eabi) && (!defined(__vxworks) || defined(__pic__))
5.option	pic2
6#endif
7.set	noat
8.align	5
9.ent	_mips_AES_encrypt
10_mips_AES_encrypt:
11	.frame	$29,0,$31
12	.set	reorder
13	lw	$12,0($6)
14	lw	$13,4($6)
15	lw	$14,8($6)
16	lw	$15,12($6)
17	lw	$30,240($6)
18	addu $3,$6,16
19
20	xor	$8,$12
21	xor	$9,$13
22	xor	$10,$14
23	xor	$11,$15
24
25	subu	$30,1
26#if defined(__mips_smartmips)
27	ext	$1,$9,8,8
28.Loop_enc:
29	ext	$2,$10,8,8
30	ext	$24,$11,8,8
31	ext	$25,$8,8,8
32	lwxs	$12,$1($7)		# Te1[s1>>16]
33	ext	$1,$10,16,8
34	lwxs	$13,$2($7)		# Te1[s2>>16]
35	ext	$2,$11,16,8
36	lwxs	$14,$24($7)		# Te1[s3>>16]
37	ext	$24,$8,16,8
38	lwxs	$15,$25($7)		# Te1[s0>>16]
39	ext	$25,$9,16,8
40
41	lwxs	$16,$1($7)		# Te2[s2>>8]
42	ext	$1,$11,24,8
43	lwxs	$17,$2($7)		# Te2[s3>>8]
44	ext	$2,$8,24,8
45	lwxs	$18,$24($7)		# Te2[s0>>8]
46	ext	$24,$9,24,8
47	lwxs	$19,$25($7)		# Te2[s1>>8]
48	ext	$25,$10,24,8
49
50	lwxs	$20,$1($7)		# Te3[s3]
51	ext	$1,$8,0,8
52	lwxs	$21,$2($7)		# Te3[s0]
53	ext	$2,$9,0,8
54	lwxs	$22,$24($7)		# Te3[s1]
55	ext	$24,$10,0,8
56	lwxs	$23,$25($7)		# Te3[s2]
57	ext	$25,$11,0,8
58
59	rotr	$12,$12,24
60	rotr	$13,$13,24
61	rotr	$14,$14,24
62	rotr	$15,$15,24
63
64	rotr	$16,$16,16
65	rotr	$17,$17,16
66	rotr	$18,$18,16
67	rotr	$19,$19,16
68
69	xor	$12,$16
70	lwxs	$16,$1($7)		# Te0[s0>>24]
71	xor	$13,$17
72	lwxs	$17,$2($7)		# Te0[s1>>24]
73	xor	$14,$18
74	lwxs	$18,$24($7)		# Te0[s2>>24]
75	xor	$15,$19
76	lwxs	$19,$25($7)		# Te0[s3>>24]
77
78	rotr	$20,$20,8
79	lw	$8,0($3)
80	rotr	$21,$21,8
81	lw	$9,4($3)
82	rotr	$22,$22,8
83	lw	$10,8($3)
84	rotr	$23,$23,8
85	lw	$11,12($3)
86
87	xor	$12,$20
88	xor	$13,$21
89	xor	$14,$22
90	xor	$15,$23
91
92	xor	$12,$16
93	xor	$13,$17
94	xor	$14,$18
95	xor	$15,$19
96
97	subu	$30,1
98	addu $3,16
99	xor	$8,$12
100	xor	$9,$13
101	xor	$10,$14
102	xor	$11,$15
103	.set	noreorder
104	bnez	$30,.Loop_enc
105	ext	$1,$9,8,8
106
107	srl	$1,$9,6
108#else
109	srl	$1,$9,6
110.Loop_enc:
111	srl	$2,$10,6
112	srl	$24,$11,6
113	srl	$25,$8,6
114	and	$1,0x3fc
115	and	$2,0x3fc
116	and	$24,0x3fc
117	and	$25,0x3fc
118	addu $1,$7
119	addu $2,$7
120	addu $24,$7
121	addu $25,$7
122#if defined(_MIPS_ARCH_MIPS32R2) || defined(_MIPS_ARCH_MIPS64R2)
123	lw	$12,0($1)		# Te1[s1>>16]
124	srl	$1,$10,14
125	lw	$13,0($2)		# Te1[s2>>16]
126	srl	$2,$11,14
127	lw	$14,0($24)		# Te1[s3>>16]
128	srl	$24,$8,14
129	lw	$15,0($25)		# Te1[s0>>16]
130	srl	$25,$9,14
131#else
132	lwl	$12,2($1)		# Te1[s1>>16]
133	lwl	$13,2($2)		# Te1[s2>>16]
134	lwl	$14,2($24)		# Te1[s3>>16]
135	lwl	$15,2($25)		# Te1[s0>>16]
136	lwr	$12,3($1)		# Te1[s1>>16]
137	srl	$1,$10,14
138	lwr	$13,3($2)		# Te1[s2>>16]
139	srl	$2,$11,14
140	lwr	$14,3($24)		# Te1[s3>>16]
141	srl	$24,$8,14
142	lwr	$15,3($25)		# Te1[s0>>16]
143	srl	$25,$9,14
144#endif
145	and	$1,0x3fc
146	and	$2,0x3fc
147	and	$24,0x3fc
148	and	$25,0x3fc
149	addu $1,$7
150	addu $2,$7
151	addu $24,$7
152	addu $25,$7
153#if defined(_MIPS_ARCH_MIPS32R2) || defined(_MIPS_ARCH_MIPS64R2)
154	rotr	$12,$12,24
155	rotr	$13,$13,24
156	rotr	$14,$14,24
157	rotr	$15,$15,24
158# if defined(_MIPSEL)
159	lw	$16,0($1)		# Te2[s2>>8]
160	srl	$1,$11,22
161	lw	$17,0($2)		# Te2[s3>>8]
162	srl	$2,$8,22
163	lw	$18,0($24)		# Te2[s0>>8]
164	srl	$24,$9,22
165	lw	$19,0($25)		# Te2[s1>>8]
166	srl	$25,$10,22
167
168	and	$1,0x3fc
169	and	$2,0x3fc
170	and	$24,0x3fc
171	and	$25,0x3fc
172	addu $1,$7
173	addu $2,$7
174	addu $24,$7
175	addu $25,$7
176	lw	$20,0($1)		# Te3[s3]
177	ins $1,$8,2,8
178	lw	$21,0($2)		# Te3[s0]
179	ins $2,$9,2,8
180	lw	$22,0($24)		# Te3[s1]
181	ins $24,$10,2,8
182	lw	$23,0($25)		# Te3[s2]
183	ins $25,$11,2,8
184# else
185	lw	$16,0($1)		# Te2[s2>>8]
186	ins $1,$11,2,8
187	lw	$17,0($2)		# Te2[s3>>8]
188	ins $2,$8,2,8
189	lw	$18,0($24)		# Te2[s0>>8]
190	ins $24,$9,2,8
191	lw	$19,0($25)		# Te2[s1>>8]
192	ins $25,$10,2,8
193
194	lw	$20,0($1)		# Te3[s3]
195	sll	$1,$8,2
196	lw	$21,0($2)		# Te3[s0]
197	sll	$2,$9,2
198	lw	$22,0($24)		# Te3[s1]
199	sll	$24,$10,2
200	lw	$23,0($25)		# Te3[s2]
201	sll	$25,$11,2
202
203	and	$1,0x3fc
204	and	$2,0x3fc
205	and	$24,0x3fc
206	and	$25,0x3fc
207	addu $1,$7
208	addu $2,$7
209	addu $24,$7
210	addu $25,$7
211# endif
212	rotr	$16,$16,16
213	rotr	$17,$17,16
214	rotr	$18,$18,16
215	rotr	$19,$19,16
216
217	rotr	$20,$20,8
218	rotr	$21,$21,8
219	rotr	$22,$22,8
220	rotr	$23,$23,8
221#else
222	lwl	$16,1($1)		# Te2[s2>>8]
223	lwl	$17,1($2)		# Te2[s3>>8]
224	lwl	$18,1($24)		# Te2[s0>>8]
225	lwl	$19,1($25)		# Te2[s1>>8]
226	lwr	$16,2($1)		# Te2[s2>>8]
227	srl	$1,$11,22
228	lwr	$17,2($2)		# Te2[s3>>8]
229	srl	$2,$8,22
230	lwr	$18,2($24)		# Te2[s0>>8]
231	srl	$24,$9,22
232	lwr	$19,2($25)		# Te2[s1>>8]
233	srl	$25,$10,22
234
235	and	$1,0x3fc
236	and	$2,0x3fc
237	and	$24,0x3fc
238	and	$25,0x3fc
239	addu $1,$7
240	addu $2,$7
241	addu $24,$7
242	addu $25,$7
243	lwl	$20,0($1)		# Te3[s3]
244	lwl	$21,0($2)		# Te3[s0]
245	lwl	$22,0($24)		# Te3[s1]
246	lwl	$23,0($25)		# Te3[s2]
247	lwr	$20,1($1)		# Te3[s3]
248	sll	$1,$8,2
249	lwr	$21,1($2)		# Te3[s0]
250	sll	$2,$9,2
251	lwr	$22,1($24)		# Te3[s1]
252	sll	$24,$10,2
253	lwr	$23,1($25)		# Te3[s2]
254	sll	$25,$11,2
255
256	and	$1,0x3fc
257	and	$2,0x3fc
258	and	$24,0x3fc
259	and	$25,0x3fc
260	addu $1,$7
261	addu $2,$7
262	addu $24,$7
263	addu $25,$7
264#endif
265	xor	$12,$16
266	lw	$16,0($1)		# Te0[s0>>24]
267	xor	$13,$17
268	lw	$17,0($2)		# Te0[s1>>24]
269	xor	$14,$18
270	lw	$18,0($24)		# Te0[s2>>24]
271	xor	$15,$19
272	lw	$19,0($25)		# Te0[s3>>24]
273
274	xor	$12,$20
275	lw	$8,0($3)
276	xor	$13,$21
277	lw	$9,4($3)
278	xor	$14,$22
279	lw	$10,8($3)
280	xor	$15,$23
281	lw	$11,12($3)
282
283	xor	$12,$16
284	xor	$13,$17
285	xor	$14,$18
286	xor	$15,$19
287
288	subu	$30,1
289	addu $3,16
290	xor	$8,$12
291	xor	$9,$13
292	xor	$10,$14
293	xor	$11,$15
294	.set	noreorder
295	bnez	$30,.Loop_enc
296	srl	$1,$9,6
297#endif
298
299	.set	reorder
300	srl	$2,$10,6
301	srl	$24,$11,6
302	srl	$25,$8,6
303	and	$1,0x3fc
304	and	$2,0x3fc
305	and	$24,0x3fc
306	and	$25,0x3fc
307	addu $1,$7
308	addu $2,$7
309	addu $24,$7
310	addu $25,$7
311	lbu	$12,2($1)		# Te4[s1>>16]
312	srl	$1,$10,14
313	lbu	$13,2($2)		# Te4[s2>>16]
314	srl	$2,$11,14
315	lbu	$14,2($24)		# Te4[s3>>16]
316	srl	$24,$8,14
317	lbu	$15,2($25)		# Te4[s0>>16]
318	srl	$25,$9,14
319
320	and	$1,0x3fc
321	and	$2,0x3fc
322	and	$24,0x3fc
323	and	$25,0x3fc
324	addu $1,$7
325	addu $2,$7
326	addu $24,$7
327	addu $25,$7
328#if defined(_MIPS_ARCH_MIPS32R2) || defined(_MIPS_ARCH_MIPS64R2)
329# if defined(_MIPSEL)
330	lbu	$16,2($1)		# Te4[s2>>8]
331	ins $1,$8,2,8
332	lbu	$17,2($2)		# Te4[s3>>8]
333	ins $2,$9,2,8
334	lbu	$18,2($24)		# Te4[s0>>8]
335	ins $24,$10,2,8
336	lbu	$19,2($25)		# Te4[s1>>8]
337	ins $25,$11,2,8
338
339	lbu	$20,2($1)		# Te4[s0>>24]
340	srl	$1,$11,22
341	lbu	$21,2($2)		# Te4[s1>>24]
342	srl	$2,$8,22
343	lbu	$22,2($24)		# Te4[s2>>24]
344	srl	$24,$9,22
345	lbu	$23,2($25)		# Te4[s3>>24]
346	srl	$25,$10,22
347
348	and	$1,0x3fc
349	and	$2,0x3fc
350	and	$24,0x3fc
351	and	$25,0x3fc
352	addu $1,$7
353	addu $2,$7
354	addu $24,$7
355	addu $25,$7
356# else
357	lbu	$16,2($1)		# Te4[s2>>8]
358	sll	$1,$8,2
359	lbu	$17,2($2)		# Te4[s3>>8]
360	sll	$2,$9,2
361	lbu	$18,2($24)		# Te4[s0>>8]
362	sll	$24,$10,2
363	lbu	$19,2($25)		# Te4[s1>>8]
364	sll	$25,$11,2
365
366	and	$1,0x3fc
367	and	$2,0x3fc
368	and	$24,0x3fc
369	and	$25,0x3fc
370	addu $1,$7
371	addu $2,$7
372	addu $24,$7
373	addu $25,$7
374	lbu	$20,2($1)		# Te4[s0>>24]
375	ins $1,$11,2,8
376	lbu	$21,2($2)		# Te4[s1>>24]
377	ins $2,$8,2,8
378	lbu	$22,2($24)		# Te4[s2>>24]
379	ins $24,$9,2,8
380	lbu	$23,2($25)		# Te4[s3>>24]
381	ins $25,$10,2,8
382# endif
383	sll	$12,$12,8
384	sll	$13,$13,8
385	sll	$14,$14,8
386	sll	$15,$15,8
387
388	ins	$12,$16,16,8
389	lbu	$16,2($1)		# Te4[s3]
390	ins	$13,$17,16,8
391	lbu	$17,2($2)		# Te4[s0]
392	ins	$14,$18,16,8
393	lbu	$18,2($24)		# Te4[s1]
394	ins	$15,$19,16,8
395	lbu	$19,2($25)		# Te4[s2]
396
397	ins	$12,$20,0,8
398	lw	$8,0($3)
399	ins	$13,$21,0,8
400	lw	$9,4($3)
401	ins	$14,$22,0,8
402	lw	$10,8($3)
403	ins	$15,$23,0,8
404	lw	$11,12($3)
405
406	ins	$12,$16,24,8
407	ins	$13,$17,24,8
408	ins	$14,$18,24,8
409	ins	$15,$19,24,8
410#else
411	lbu	$16,2($1)		# Te4[s2>>8]
412	sll	$1,$8,2
413	lbu	$17,2($2)		# Te4[s3>>8]
414	sll	$2,$9,2
415	lbu	$18,2($24)		# Te4[s0>>8]
416	sll	$24,$10,2
417	lbu	$19,2($25)		# Te4[s1>>8]
418	sll	$25,$11,2
419
420	and	$1,0x3fc
421	and	$2,0x3fc
422	and	$24,0x3fc
423	and	$25,0x3fc
424	addu $1,$7
425	addu $2,$7
426	addu $24,$7
427	addu $25,$7
428	lbu	$20,2($1)		# Te4[s0>>24]
429	srl	$1,$11,22
430	lbu	$21,2($2)		# Te4[s1>>24]
431	srl	$2,$8,22
432	lbu	$22,2($24)		# Te4[s2>>24]
433	srl	$24,$9,22
434	lbu	$23,2($25)		# Te4[s3>>24]
435	srl	$25,$10,22
436
437	and	$1,0x3fc
438	and	$2,0x3fc
439	and	$24,0x3fc
440	and	$25,0x3fc
441	addu $1,$7
442	addu $2,$7
443	addu $24,$7
444	addu $25,$7
445
446	sll	$12,$12,8
447	sll	$13,$13,8
448	sll	$14,$14,8
449	sll	$15,$15,8
450
451	sll	$16,$16,16
452	sll	$17,$17,16
453	sll	$18,$18,16
454	sll	$19,$19,16
455
456	xor	$12,$16
457	lbu	$16,2($1)		# Te4[s3]
458	xor	$13,$17
459	lbu	$17,2($2)		# Te4[s0]
460	xor	$14,$18
461	lbu	$18,2($24)		# Te4[s1]
462	xor	$15,$19
463	lbu	$19,2($25)		# Te4[s2]
464
465	#sll	$20,$20,0
466	lw	$8,0($3)
467	#sll	$21,$21,0
468	lw	$9,4($3)
469	#sll	$22,$22,0
470	lw	$10,8($3)
471	#sll	$23,$23,0
472	lw	$11,12($3)
473
474	xor	$12,$20
475	xor	$13,$21
476	xor	$14,$22
477	xor	$15,$23
478
479	sll	$16,$16,24
480	sll	$17,$17,24
481	sll	$18,$18,24
482	sll	$19,$19,24
483
484	xor	$12,$16
485	xor	$13,$17
486	xor	$14,$18
487	xor	$15,$19
488#endif
489	xor	$8,$12
490	xor	$9,$13
491	xor	$10,$14
492	xor	$11,$15
493
494	jr	$31
495.end	_mips_AES_encrypt
496
497.align	5
498.globl	AES_encrypt
499.ent	AES_encrypt
500AES_encrypt:
501	.frame	$29,64,$31
502	.mask	0xc0ff0000,-4
503	.set	noreorder
504	.cpload	$25
505	subu $29,64
506	sw	$31,64-1*4($29)
507	sw	$30,64-2*4($29)
508	sw	$23,64-3*4($29)
509	sw	$22,64-4*4($29)
510	sw	$21,64-5*4($29)
511	sw	$20,64-6*4($29)
512	sw	$19,64-7*4($29)
513	sw	$18,64-8*4($29)
514	sw	$17,64-9*4($29)
515	sw	$16,64-10*4($29)
516	.set	reorder
517	la	$7,AES_Te		# PIC-ified 'load address'
518
519#if defined(_MIPS_ARCH_MIPS32R6) || defined(_MIPS_ARCH_MIPS64R6)
520	lw	$8,0($4)
521	lw	$9,4($4)
522	lw	$10,8($4)
523	lw	$11,12($4)
524#else
525	lwl	$8,0+3($4)
526	lwl	$9,4+3($4)
527	lwl	$10,8+3($4)
528	lwl	$11,12+3($4)
529	lwr	$8,0+0($4)
530	lwr	$9,4+0($4)
531	lwr	$10,8+0($4)
532	lwr	$11,12+0($4)
533#endif
534
535	bal	_mips_AES_encrypt
536
537#if defined(_MIPS_ARCH_MIPS32R6) || defined(_MIPS_ARCH_MIPS64R6)
538	sw	$8,0($5)
539	sw	$9,4($5)
540	sw	$10,8($5)
541	sw	$11,12($5)
542#else
543	swr	$8,0+0($5)
544	swr	$9,4+0($5)
545	swr	$10,8+0($5)
546	swr	$11,12+0($5)
547	swl	$8,0+3($5)
548	swl	$9,4+3($5)
549	swl	$10,8+3($5)
550	swl	$11,12+3($5)
551#endif
552
553	.set	noreorder
554	lw	$31,64-1*4($29)
555	lw	$30,64-2*4($29)
556	lw	$23,64-3*4($29)
557	lw	$22,64-4*4($29)
558	lw	$21,64-5*4($29)
559	lw	$20,64-6*4($29)
560	lw	$19,64-7*4($29)
561	lw	$18,64-8*4($29)
562	lw	$17,64-9*4($29)
563	lw	$16,64-10*4($29)
564	jr	$31
565	addu $29,64
566.end	AES_encrypt
567.align	5
568.ent	_mips_AES_decrypt
569_mips_AES_decrypt:
570	.frame	$29,0,$31
571	.set	reorder
572	lw	$12,0($6)
573	lw	$13,4($6)
574	lw	$14,8($6)
575	lw	$15,12($6)
576	lw	$30,240($6)
577	addu $3,$6,16
578
579	xor	$8,$12
580	xor	$9,$13
581	xor	$10,$14
582	xor	$11,$15
583
584	subu	$30,1
585#if defined(__mips_smartmips)
586	ext	$1,$11,8,8
587.Loop_dec:
588	ext	$2,$8,8,8
589	ext	$24,$9,8,8
590	ext	$25,$10,8,8
591	lwxs	$12,$1($7)		# Td1[s3>>16]
592	ext	$1,$10,16,8
593	lwxs	$13,$2($7)		# Td1[s0>>16]
594	ext	$2,$11,16,8
595	lwxs	$14,$24($7)		# Td1[s1>>16]
596	ext	$24,$8,16,8
597	lwxs	$15,$25($7)		# Td1[s2>>16]
598	ext	$25,$9,16,8
599
600	lwxs	$16,$1($7)		# Td2[s2>>8]
601	ext	$1,$9,24,8
602	lwxs	$17,$2($7)		# Td2[s3>>8]
603	ext	$2,$10,24,8
604	lwxs	$18,$24($7)		# Td2[s0>>8]
605	ext	$24,$11,24,8
606	lwxs	$19,$25($7)		# Td2[s1>>8]
607	ext	$25,$8,24,8
608
609	lwxs	$20,$1($7)		# Td3[s1]
610	ext	$1,$8,0,8
611	lwxs	$21,$2($7)		# Td3[s2]
612	ext	$2,$9,0,8
613	lwxs	$22,$24($7)		# Td3[s3]
614	ext	$24,$10,0,8
615	lwxs	$23,$25($7)		# Td3[s0]
616	ext	$25,$11,0,8
617
618	rotr	$12,$12,24
619	rotr	$13,$13,24
620	rotr	$14,$14,24
621	rotr	$15,$15,24
622
623	rotr	$16,$16,16
624	rotr	$17,$17,16
625	rotr	$18,$18,16
626	rotr	$19,$19,16
627
628	xor	$12,$16
629	lwxs	$16,$1($7)		# Td0[s0>>24]
630	xor	$13,$17
631	lwxs	$17,$2($7)		# Td0[s1>>24]
632	xor	$14,$18
633	lwxs	$18,$24($7)		# Td0[s2>>24]
634	xor	$15,$19
635	lwxs	$19,$25($7)		# Td0[s3>>24]
636
637	rotr	$20,$20,8
638	lw	$8,0($3)
639	rotr	$21,$21,8
640	lw	$9,4($3)
641	rotr	$22,$22,8
642	lw	$10,8($3)
643	rotr	$23,$23,8
644	lw	$11,12($3)
645
646	xor	$12,$20
647	xor	$13,$21
648	xor	$14,$22
649	xor	$15,$23
650
651	xor	$12,$16
652	xor	$13,$17
653	xor	$14,$18
654	xor	$15,$19
655
656	subu	$30,1
657	addu $3,16
658	xor	$8,$12
659	xor	$9,$13
660	xor	$10,$14
661	xor	$11,$15
662	.set	noreorder
663	bnez	$30,.Loop_dec
664	ext	$1,$11,8,8
665
666	srl	$1,$11,6
667#else
668	srl	$1,$11,6
669.Loop_dec:
670	srl	$2,$8,6
671	srl	$24,$9,6
672	srl	$25,$10,6
673	and	$1,0x3fc
674	and	$2,0x3fc
675	and	$24,0x3fc
676	and	$25,0x3fc
677	addu $1,$7
678	addu $2,$7
679	addu $24,$7
680	addu $25,$7
681#if defined(_MIPS_ARCH_MIPS32R2) || defined(_MIPS_ARCH_MIPS64R2)
682	lw	$12,0($1)		# Td1[s3>>16]
683	srl	$1,$10,14
684	lw	$13,0($2)		# Td1[s0>>16]
685	srl	$2,$11,14
686	lw	$14,0($24)		# Td1[s1>>16]
687	srl	$24,$8,14
688	lw	$15,0($25)		# Td1[s2>>16]
689	srl	$25,$9,14
690#else
691	lwl	$12,2($1)		# Td1[s3>>16]
692	lwl	$13,2($2)		# Td1[s0>>16]
693	lwl	$14,2($24)		# Td1[s1>>16]
694	lwl	$15,2($25)		# Td1[s2>>16]
695	lwr	$12,3($1)		# Td1[s3>>16]
696	srl	$1,$10,14
697	lwr	$13,3($2)		# Td1[s0>>16]
698	srl	$2,$11,14
699	lwr	$14,3($24)		# Td1[s1>>16]
700	srl	$24,$8,14
701	lwr	$15,3($25)		# Td1[s2>>16]
702	srl	$25,$9,14
703#endif
704
705	and	$1,0x3fc
706	and	$2,0x3fc
707	and	$24,0x3fc
708	and	$25,0x3fc
709	addu $1,$7
710	addu $2,$7
711	addu $24,$7
712	addu $25,$7
713#if defined(_MIPS_ARCH_MIPS32R2) || defined(_MIPS_ARCH_MIPS64R2)
714	rotr	$12,$12,24
715	rotr	$13,$13,24
716	rotr	$14,$14,24
717	rotr	$15,$15,24
718# if defined(_MIPSEL)
719	lw	$16,0($1)		# Td2[s2>>8]
720	srl	$1,$9,22
721	lw	$17,0($2)		# Td2[s3>>8]
722	srl	$2,$10,22
723	lw	$18,0($24)		# Td2[s0>>8]
724	srl	$24,$11,22
725	lw	$19,0($25)		# Td2[s1>>8]
726	srl	$25,$8,22
727
728	and	$1,0x3fc
729	and	$2,0x3fc
730	and	$24,0x3fc
731	and	$25,0x3fc
732	addu $1,$7
733	addu $2,$7
734	addu $24,$7
735	addu $25,$7
736	lw	$20,0($1)		# Td3[s1]
737	ins $1,$8,2,8
738	lw	$21,0($2)		# Td3[s2]
739	ins $2,$9,2,8
740	lw	$22,0($24)		# Td3[s3]
741	ins $24,$10,2,8
742	lw	$23,0($25)		# Td3[s0]
743	ins $25,$11,2,8
744#else
745	lw	$16,0($1)		# Td2[s2>>8]
746	ins $1,$9,2,8
747	lw	$17,0($2)		# Td2[s3>>8]
748	ins $2,$10,2,8
749	lw	$18,0($24)		# Td2[s0>>8]
750	ins $24,$11,2,8
751	lw	$19,0($25)		# Td2[s1>>8]
752	ins $25,$8,2,8
753
754	lw	$20,0($1)		# Td3[s1]
755	sll	$1,$8,2
756	lw	$21,0($2)		# Td3[s2]
757	sll	$2,$9,2
758	lw	$22,0($24)		# Td3[s3]
759	sll	$24,$10,2
760	lw	$23,0($25)		# Td3[s0]
761	sll	$25,$11,2
762
763	and	$1,0x3fc
764	and	$2,0x3fc
765	and	$24,0x3fc
766	and	$25,0x3fc
767	addu $1,$7
768	addu $2,$7
769	addu $24,$7
770	addu $25,$7
771#endif
772	rotr	$16,$16,16
773	rotr	$17,$17,16
774	rotr	$18,$18,16
775	rotr	$19,$19,16
776
777	rotr	$20,$20,8
778	rotr	$21,$21,8
779	rotr	$22,$22,8
780	rotr	$23,$23,8
781#else
782	lwl	$16,1($1)		# Td2[s2>>8]
783	lwl	$17,1($2)		# Td2[s3>>8]
784	lwl	$18,1($24)		# Td2[s0>>8]
785	lwl	$19,1($25)		# Td2[s1>>8]
786	lwr	$16,2($1)		# Td2[s2>>8]
787	srl	$1,$9,22
788	lwr	$17,2($2)		# Td2[s3>>8]
789	srl	$2,$10,22
790	lwr	$18,2($24)		# Td2[s0>>8]
791	srl	$24,$11,22
792	lwr	$19,2($25)		# Td2[s1>>8]
793	srl	$25,$8,22
794
795	and	$1,0x3fc
796	and	$2,0x3fc
797	and	$24,0x3fc
798	and	$25,0x3fc
799	addu $1,$7
800	addu $2,$7
801	addu $24,$7
802	addu $25,$7
803	lwl	$20,0($1)		# Td3[s1]
804	lwl	$21,0($2)		# Td3[s2]
805	lwl	$22,0($24)		# Td3[s3]
806	lwl	$23,0($25)		# Td3[s0]
807	lwr	$20,1($1)		# Td3[s1]
808	sll	$1,$8,2
809	lwr	$21,1($2)		# Td3[s2]
810	sll	$2,$9,2
811	lwr	$22,1($24)		# Td3[s3]
812	sll	$24,$10,2
813	lwr	$23,1($25)		# Td3[s0]
814	sll	$25,$11,2
815
816	and	$1,0x3fc
817	and	$2,0x3fc
818	and	$24,0x3fc
819	and	$25,0x3fc
820	addu $1,$7
821	addu $2,$7
822	addu $24,$7
823	addu $25,$7
824#endif
825
826	xor	$12,$16
827	lw	$16,0($1)		# Td0[s0>>24]
828	xor	$13,$17
829	lw	$17,0($2)		# Td0[s1>>24]
830	xor	$14,$18
831	lw	$18,0($24)		# Td0[s2>>24]
832	xor	$15,$19
833	lw	$19,0($25)		# Td0[s3>>24]
834
835	xor	$12,$20
836	lw	$8,0($3)
837	xor	$13,$21
838	lw	$9,4($3)
839	xor	$14,$22
840	lw	$10,8($3)
841	xor	$15,$23
842	lw	$11,12($3)
843
844	xor	$12,$16
845	xor	$13,$17
846	xor	$14,$18
847	xor	$15,$19
848
849	subu	$30,1
850	addu $3,16
851	xor	$8,$12
852	xor	$9,$13
853	xor	$10,$14
854	xor	$11,$15
855	.set	noreorder
856	bnez	$30,.Loop_dec
857	srl	$1,$11,6
858#endif
859
860	.set	reorder
861	lw	$16,1024($7)		# prefetch Td4
862	srl	$1,$11,8
863	lw	$17,1024+32($7)
864	srl	$2,$8,8
865	lw	$18,1024+64($7)
866	srl	$24,$9,8
867	lw	$19,1024+96($7)
868	srl	$25,$10,8
869	lw	$20,1024+128($7)
870	and	$1,0xff
871	lw	$21,1024+160($7)
872	and	$2,0xff
873	lw	$22,1024+192($7)
874	and	$24,0xff
875	lw	$23,1024+224($7)
876	and	$25,0xff
877
878	addu $1,$7
879	addu $2,$7
880	addu $24,$7
881	addu $25,$7
882	lbu	$12,1024($1)		# Td4[s3>>16]
883	srl	$1,$10,16
884	lbu	$13,1024($2)		# Td4[s0>>16]
885	srl	$2,$11,16
886	lbu	$14,1024($24)		# Td4[s1>>16]
887	srl	$24,$8,16
888	lbu	$15,1024($25)		# Td4[s2>>16]
889	srl	$25,$9,16
890
891	and	$1,0xff
892	and	$2,0xff
893	and	$24,0xff
894	and	$25,0xff
895	addu $1,$7
896	addu $2,$7
897	addu $24,$7
898	addu $25,$7
899#if defined(_MIPS_ARCH_MIPS32R2) || defined(_MIPS_ARCH_MIPS64R2)
900# if defined(_MIPSEL)
901	lbu	$16,1024($1)		# Td4[s2>>8]
902	ins $1,$8,0,8
903	lbu	$17,1024($2)		# Td4[s3>>8]
904	ins $2,$9,0,8
905	lbu	$18,1024($24)		# Td4[s0>>8]
906	ins $24,$10,0,8
907	lbu	$19,1024($25)		# Td4[s1>>8]
908	ins $25,$11,0,8
909
910	lbu	$20,1024($1)		# Td4[s0>>24]
911	srl	$1,$9,24
912	lbu	$21,1024($2)		# Td4[s1>>24]
913	srl	$2,$10,24
914	lbu	$22,1024($24)		# Td4[s2>>24]
915	srl	$24,$11,24
916	lbu	$23,1024($25)		# Td4[s3>>24]
917	srl	$25,$8,24
918
919	addu $1,$7
920	addu $2,$7
921	addu $24,$7
922	addu $25,$7
923# else
924	lbu	$16,1024($1)		# Td4[s2>>8]
925	and	$1,$8,0xff
926	lbu	$17,1024($2)		# Td4[s3>>8]
927	and	$2,$9,0xff
928	lbu	$18,1024($24)		# Td4[s0>>8]
929	and	$24,$10,0xff
930	lbu	$19,1024($25)		# Td4[s1>>8]
931	and	$25,$11,0xff
932
933	addu $1,$7
934	addu $2,$7
935	addu $24,$7
936	addu $25,$7
937	lbu	$20,1024($1)		# Td4[s0>>24]
938	ins $1,$9,0,8
939	lbu	$21,1024($2)		# Td4[s1>>24]
940	ins $2,$10,0,8
941	lbu	$22,1024($24)		# Td4[s2>>24]
942	ins $24,$11,0,8
943	lbu	$23,1024($25)		# Td4[s3>>24]
944	ins $25,$8,0,8
945# endif
946	sll	$12,$12,8
947	sll	$13,$13,8
948	sll	$14,$14,8
949	sll	$15,$15,8
950
951	ins	$12,$16,16,8
952	lbu	$16,1024($1)		# Td4[s1]
953	ins	$13,$17,16,8
954	lbu	$17,1024($2)		# Td4[s2]
955	ins	$14,$18,16,8
956	lbu	$18,1024($24)		# Td4[s3]
957	ins	$15,$19,16,8
958	lbu	$19,1024($25)		# Td4[s0]
959
960	ins	$12,$20,0,8
961	lw	$8,0($3)
962	ins	$13,$21,0,8
963	lw	$9,4($3)
964	ins	$14,$22,0,8
965	lw	$10,8($3)
966	ins	$15,$23,0,8
967	lw	$11,12($3)
968
969	ins	$12,$16,24,8
970	ins	$13,$17,24,8
971	ins	$14,$18,24,8
972	ins	$15,$19,24,8
973#else
974	lbu	$16,1024($1)		# Td4[s2>>8]
975	and	$1,$8,0xff
976	lbu	$17,1024($2)		# Td4[s3>>8]
977	and	$2,$9,0xff
978	lbu	$18,1024($24)		# Td4[s0>>8]
979	and	$24,$10,0xff
980	lbu	$19,1024($25)		# Td4[s1>>8]
981	and	$25,$11,0xff
982
983	addu $1,$7
984	addu $2,$7
985	addu $24,$7
986	addu $25,$7
987	lbu	$20,1024($1)		# Td4[s0>>24]
988	srl	$1,$9,24
989	lbu	$21,1024($2)		# Td4[s1>>24]
990	srl	$2,$10,24
991	lbu	$22,1024($24)		# Td4[s2>>24]
992	srl	$24,$11,24
993	lbu	$23,1024($25)		# Td4[s3>>24]
994	srl	$25,$8,24
995
996	addu $1,$7
997	addu $2,$7
998	addu $24,$7
999	addu $25,$7
1000
1001	sll	$12,$12,8
1002	sll	$13,$13,8
1003	sll	$14,$14,8
1004	sll	$15,$15,8
1005
1006	sll	$16,$16,16
1007	sll	$17,$17,16
1008	sll	$18,$18,16
1009	sll	$19,$19,16
1010
1011	xor	$12,$16
1012	lbu	$16,1024($1)		# Td4[s1]
1013	xor	$13,$17
1014	lbu	$17,1024($2)		# Td4[s2]
1015	xor	$14,$18
1016	lbu	$18,1024($24)		# Td4[s3]
1017	xor	$15,$19
1018	lbu	$19,1024($25)		# Td4[s0]
1019
1020	#sll	$20,$20,0
1021	lw	$8,0($3)
1022	#sll	$21,$21,0
1023	lw	$9,4($3)
1024	#sll	$22,$22,0
1025	lw	$10,8($3)
1026	#sll	$23,$23,0
1027	lw	$11,12($3)
1028
1029	xor	$12,$20
1030	xor	$13,$21
1031	xor	$14,$22
1032	xor	$15,$23
1033
1034	sll	$16,$16,24
1035	sll	$17,$17,24
1036	sll	$18,$18,24
1037	sll	$19,$19,24
1038
1039	xor	$12,$16
1040	xor	$13,$17
1041	xor	$14,$18
1042	xor	$15,$19
1043#endif
1044
1045	xor	$8,$12
1046	xor	$9,$13
1047	xor	$10,$14
1048	xor	$11,$15
1049
1050	jr	$31
1051.end	_mips_AES_decrypt
1052
1053.align	5
1054.globl	AES_decrypt
1055.ent	AES_decrypt
1056AES_decrypt:
1057	.frame	$29,64,$31
1058	.mask	0xc0ff0000,-4
1059	.set	noreorder
1060	.cpload	$25
1061	subu $29,64
1062	sw	$31,64-1*4($29)
1063	sw	$30,64-2*4($29)
1064	sw	$23,64-3*4($29)
1065	sw	$22,64-4*4($29)
1066	sw	$21,64-5*4($29)
1067	sw	$20,64-6*4($29)
1068	sw	$19,64-7*4($29)
1069	sw	$18,64-8*4($29)
1070	sw	$17,64-9*4($29)
1071	sw	$16,64-10*4($29)
1072	.set	reorder
1073	la	$7,AES_Td		# PIC-ified 'load address'
1074
1075#if defined(_MIPS_ARCH_MIPS32R6) || defined(_MIPS_ARCH_MIPS64R6)
1076	lw	$8,0($4)
1077	lw	$9,4($4)
1078	lw	$10,8($4)
1079	lw	$11,12($4)
1080#else
1081	lwl	$8,0+3($4)
1082	lwl	$9,4+3($4)
1083	lwl	$10,8+3($4)
1084	lwl	$11,12+3($4)
1085	lwr	$8,0+0($4)
1086	lwr	$9,4+0($4)
1087	lwr	$10,8+0($4)
1088	lwr	$11,12+0($4)
1089#endif
1090
1091	bal	_mips_AES_decrypt
1092
1093#if defined(_MIPS_ARCH_MIPS32R6) || defined(_MIPS_ARCH_MIPS64R6)
1094	sw	$8,0($5)
1095	sw	$9,4($5)
1096	sw	$10,8($5)
1097	sw	$11,12($5)
1098#else
1099	swr	$8,0+0($5)
1100	swr	$9,4+0($5)
1101	swr	$10,8+0($5)
1102	swr	$11,12+0($5)
1103	swl	$8,0+3($5)
1104	swl	$9,4+3($5)
1105	swl	$10,8+3($5)
1106	swl	$11,12+3($5)
1107#endif
1108
1109	.set	noreorder
1110	lw	$31,64-1*4($29)
1111	lw	$30,64-2*4($29)
1112	lw	$23,64-3*4($29)
1113	lw	$22,64-4*4($29)
1114	lw	$21,64-5*4($29)
1115	lw	$20,64-6*4($29)
1116	lw	$19,64-7*4($29)
1117	lw	$18,64-8*4($29)
1118	lw	$17,64-9*4($29)
1119	lw	$16,64-10*4($29)
1120	jr	$31
1121	addu $29,64
1122.end	AES_decrypt
1123.align	5
1124.ent	_mips_AES_set_encrypt_key
1125_mips_AES_set_encrypt_key:
1126	.frame	$29,0,$31
1127	.set	noreorder
1128	beqz	$4,.Lekey_done
1129	li	$2,-1
1130	beqz	$6,.Lekey_done
1131	addu $3,$7,256
1132
1133	.set	reorder
1134#if defined(_MIPS_ARCH_MIPS32R6) || defined(_MIPS_ARCH_MIPS64R6)
1135	lw	$8,0($4)		# load 128 bits
1136	lw	$9,4($4)
1137	lw	$10,8($4)
1138	lw	$11,12($4)
1139#else
1140	lwl	$8,0+3($4)	# load 128 bits
1141	lwl	$9,4+3($4)
1142	lwl	$10,8+3($4)
1143	lwl	$11,12+3($4)
1144	lwr	$8,0+0($4)
1145	lwr	$9,4+0($4)
1146	lwr	$10,8+0($4)
1147	lwr	$11,12+0($4)
1148#endif
1149	li	$1,128
1150	.set	noreorder
1151	beq	$5,$1,.L128bits
1152	li	$30,10
1153
1154	.set	reorder
1155#if defined(_MIPS_ARCH_MIPS32R6) || defined(_MIPS_ARCH_MIPS64R6)
1156	lw	$12,16($4)		# load 192 bits
1157	lw	$13,20($4)
1158#else
1159	lwl	$12,16+3($4)	# load 192 bits
1160	lwl	$13,20+3($4)
1161	lwr	$12,16+0($4)
1162	lwr	$13,20+0($4)
1163#endif
1164	li	$1,192
1165	.set	noreorder
1166	beq	$5,$1,.L192bits
1167	li	$30,8
1168
1169	.set	reorder
1170#if defined(_MIPS_ARCH_MIPS32R6) || defined(_MIPS_ARCH_MIPS64R6)
1171	lw	$14,24($4)		# load 256 bits
1172	lw	$15,28($4)
1173#else
1174	lwl	$14,24+3($4)	# load 256 bits
1175	lwl	$15,28+3($4)
1176	lwr	$14,24+0($4)
1177	lwr	$15,28+0($4)
1178#endif
1179	li	$1,256
1180	.set	noreorder
1181	beq	$5,$1,.L256bits
1182	li	$30,7
1183
1184	b	.Lekey_done
1185	li	$2,-2
1186
1187.align	4
1188.L128bits:
1189	.set	reorder
1190	srl	$1,$11,16
1191	srl	$2,$11,8
1192	and	$1,0xff
1193	and	$2,0xff
1194	and	$24,$11,0xff
1195	srl	$25,$11,24
1196	addu $1,$7
1197	addu $2,$7
1198	addu $24,$7
1199	addu $25,$7
1200	lbu	$1,0($1)
1201	lbu	$2,0($2)
1202	lbu	$24,0($24)
1203	lbu	$25,0($25)
1204
1205	sw	$8,0($6)
1206	sw	$9,4($6)
1207	sw	$10,8($6)
1208	sw	$11,12($6)
1209	subu	$30,1
1210	addu $6,16
1211
1212	sll	$1,$1,8
1213	#sll	$2,$2,0
1214	sll	$24,$24,24
1215	sll	$25,$25,16
1216
1217	xor	$8,$1
1218	lw	$1,0($3)
1219	xor	$8,$2
1220	xor	$8,$24
1221	xor	$8,$25
1222	xor	$8,$1
1223
1224	xor	$9,$8
1225	xor	$10,$9
1226	xor	$11,$10
1227
1228	.set	noreorder
1229	bnez	$30,.L128bits
1230	addu $3,4
1231
1232	sw	$8,0($6)
1233	sw	$9,4($6)
1234	sw	$10,8($6)
1235	li	$30,10
1236	sw	$11,12($6)
1237	li	$2,0
1238	sw	$30,80($6)
1239	b	.Lekey_done
1240	subu $6,10*16
1241
1242.align	4
1243.L192bits:
1244	.set	reorder
1245	srl	$1,$13,16
1246	srl	$2,$13,8
1247	and	$1,0xff
1248	and	$2,0xff
1249	and	$24,$13,0xff
1250	srl	$25,$13,24
1251	addu $1,$7
1252	addu $2,$7
1253	addu $24,$7
1254	addu $25,$7
1255	lbu	$1,0($1)
1256	lbu	$2,0($2)
1257	lbu	$24,0($24)
1258	lbu	$25,0($25)
1259
1260	sw	$8,0($6)
1261	sw	$9,4($6)
1262	sw	$10,8($6)
1263	sw	$11,12($6)
1264	sw	$12,16($6)
1265	sw	$13,20($6)
1266	subu	$30,1
1267	addu $6,24
1268
1269	sll	$1,$1,8
1270	#sll	$2,$2,0
1271	sll	$24,$24,24
1272	sll	$25,$25,16
1273
1274	xor	$8,$1
1275	lw	$1,0($3)
1276	xor	$8,$2
1277	xor	$8,$24
1278	xor	$8,$25
1279	xor	$8,$1
1280
1281	xor	$9,$8
1282	xor	$10,$9
1283	xor	$11,$10
1284	xor	$12,$11
1285	xor	$13,$12
1286
1287	.set	noreorder
1288	bnez	$30,.L192bits
1289	addu $3,4
1290
1291	sw	$8,0($6)
1292	sw	$9,4($6)
1293	sw	$10,8($6)
1294	li	$30,12
1295	sw	$11,12($6)
1296	li	$2,0
1297	sw	$30,48($6)
1298	b	.Lekey_done
1299	subu $6,12*16
1300
1301.align	4
1302.L256bits:
1303	.set	reorder
1304	srl	$1,$15,16
1305	srl	$2,$15,8
1306	and	$1,0xff
1307	and	$2,0xff
1308	and	$24,$15,0xff
1309	srl	$25,$15,24
1310	addu $1,$7
1311	addu $2,$7
1312	addu $24,$7
1313	addu $25,$7
1314	lbu	$1,0($1)
1315	lbu	$2,0($2)
1316	lbu	$24,0($24)
1317	lbu	$25,0($25)
1318
1319	sw	$8,0($6)
1320	sw	$9,4($6)
1321	sw	$10,8($6)
1322	sw	$11,12($6)
1323	sw	$12,16($6)
1324	sw	$13,20($6)
1325	sw	$14,24($6)
1326	sw	$15,28($6)
1327	subu	$30,1
1328
1329	sll	$1,$1,8
1330	#sll	$2,$2,0
1331	sll	$24,$24,24
1332	sll	$25,$25,16
1333
1334	xor	$8,$1
1335	lw	$1,0($3)
1336	xor	$8,$2
1337	xor	$8,$24
1338	xor	$8,$25
1339	xor	$8,$1
1340
1341	xor	$9,$8
1342	xor	$10,$9
1343	xor	$11,$10
1344	beqz	$30,.L256bits_done
1345
1346	srl	$1,$11,24
1347	srl	$2,$11,16
1348	srl	$24,$11,8
1349	and	$25,$11,0xff
1350	and	$2,0xff
1351	and	$24,0xff
1352	addu $1,$7
1353	addu $2,$7
1354	addu $24,$7
1355	addu $25,$7
1356	lbu	$1,0($1)
1357	lbu	$2,0($2)
1358	lbu	$24,0($24)
1359	lbu	$25,0($25)
1360	sll	$1,24
1361	sll	$2,16
1362	sll	$24,8
1363
1364	xor	$12,$1
1365	xor	$12,$2
1366	xor	$12,$24
1367	xor	$12,$25
1368
1369	xor	$13,$12
1370	xor	$14,$13
1371	xor	$15,$14
1372
1373	addu $6,32
1374	.set	noreorder
1375	b	.L256bits
1376	addu $3,4
1377
1378.L256bits_done:
1379	sw	$8,32($6)
1380	sw	$9,36($6)
1381	sw	$10,40($6)
1382	li	$30,14
1383	sw	$11,44($6)
1384	li	$2,0
1385	sw	$30,48($6)
1386	subu $6,12*16
1387
1388.Lekey_done:
1389	jr	$31
1390	nop
1391.end	_mips_AES_set_encrypt_key
1392
1393.globl	AES_set_encrypt_key
1394.ent	AES_set_encrypt_key
1395AES_set_encrypt_key:
1396	.frame	$29,32,$31
1397	.mask	0xc0000000,-4
1398	.set	noreorder
1399	.cpload	$25
1400	subu $29,32
1401	sw	$31,32-1*4($29)
1402	sw	$30,32-2*4($29)
1403	.set	reorder
1404	la	$7,AES_Te4		# PIC-ified 'load address'
1405
1406	bal	_mips_AES_set_encrypt_key
1407
1408	.set	noreorder
1409	move	$4,$2
1410	lw	$31,32-1*4($29)
1411	lw	$30,32-2*4($29)
1412	jr	$31
1413	addu $29,32
1414.end	AES_set_encrypt_key
1415.align	5
1416.globl	AES_set_decrypt_key
1417.ent	AES_set_decrypt_key
1418AES_set_decrypt_key:
1419	.frame	$29,32,$31
1420	.mask	0xc0000000,-4
1421	.set	noreorder
1422	.cpload	$25
1423	subu $29,32
1424	sw	$31,32-1*4($29)
1425	sw	$30,32-2*4($29)
1426	.set	reorder
1427	la	$7,AES_Te4		# PIC-ified 'load address'
1428
1429	bal	_mips_AES_set_encrypt_key
1430
1431	bltz	$2,.Ldkey_done
1432
1433	sll	$1,$30,4
1434	addu $4,$6,0
1435	addu $5,$6,$1
1436.align	4
1437.Lswap:
1438	lw	$8,0($4)
1439	lw	$9,4($4)
1440	lw	$10,8($4)
1441	lw	$11,12($4)
1442	lw	$12,0($5)
1443	lw	$13,4($5)
1444	lw	$14,8($5)
1445	lw	$15,12($5)
1446	sw	$8,0($5)
1447	sw	$9,4($5)
1448	sw	$10,8($5)
1449	sw	$11,12($5)
1450	addu $4,16
1451	subu $5,16
1452	sw	$12,-16($4)
1453	sw	$13,-12($4)
1454	sw	$14,-8($4)
1455	sw	$15,-4($4)
1456	bne	$4,$5,.Lswap
1457
1458	lw	$8,16($6)		# modulo-scheduled
1459	lui	$2,0x8080
1460	subu	$30,1
1461	or	$2,0x8080
1462	sll	$30,2
1463	addu $6,16
1464	lui	$25,0x1b1b
1465	nor	$24,$0,$2
1466	or	$25,0x1b1b
1467.align	4
1468.Lmix:
1469	and	$1,$8,$2
1470	and	$9,$8,$24
1471	srl	$10,$1,7
1472	addu	$9,$9		# tp2<<1
1473	subu	$1,$10
1474	and	$1,$25
1475	xor	$9,$1
1476
1477	and	$1,$9,$2
1478	and	$10,$9,$24
1479	srl	$11,$1,7
1480	addu	$10,$10		# tp4<<1
1481	subu	$1,$11
1482	and	$1,$25
1483	xor	$10,$1
1484
1485	and	$1,$10,$2
1486	and	$11,$10,$24
1487	srl	$12,$1,7
1488	addu	$11,$11		# tp8<<1
1489	subu	$1,$12
1490	and	$1,$25
1491	xor	$11,$1
1492
1493	xor	$12,$11,$8
1494	xor	$15,$11,$10
1495	xor	$13,$12,$9
1496	xor	$14,$12,$10
1497
1498#if defined(_MIPS_ARCH_MIPS32R2) || defined(_MIPS_ARCH_MIPS64R2)
1499	rotr	$8,$14,16
1500	 xor	$15,$9
1501	rotr	$9,$12,24
1502	xor	$15,$8
1503	rotr	$10,$13,8
1504	xor	$15,$9
1505	lw	$8,4($6)		# modulo-scheduled
1506	xor	$15,$10
1507#else
1508	sll	$8,$14,16
1509	 xor	$15,$9
1510	srl	$9,$14,16
1511	xor	$15,$8
1512	sll	$8,$12,8
1513	xor	$15,$9
1514	srl	$9,$12,24
1515	xor	$15,$8
1516	sll	$8,$13,24
1517	xor	$15,$9
1518	srl	$9,$13,8
1519	xor	$15,$8
1520	lw	$8,4($6)		# modulo-scheduled
1521	xor	$15,$9
1522#endif
1523	subu	$30,1
1524	sw	$15,0($6)
1525	addu $6,4
1526	bnez	$30,.Lmix
1527
1528	li	$2,0
1529.Ldkey_done:
1530	.set	noreorder
1531	move	$4,$2
1532	lw	$31,32-1*4($29)
1533	lw	$30,32-2*4($29)
1534	jr	$31
1535	addu $29,32
1536.end	AES_set_decrypt_key
1537.rdata
1538.align	10
1539AES_Te:
1540.byte	0xc6,0x63,0x63,0xa5,	0xf8,0x7c,0x7c,0x84	# Te0
1541.byte	0xee,0x77,0x77,0x99,	0xf6,0x7b,0x7b,0x8d
1542.byte	0xff,0xf2,0xf2,0x0d,	0xd6,0x6b,0x6b,0xbd
1543.byte	0xde,0x6f,0x6f,0xb1,	0x91,0xc5,0xc5,0x54
1544.byte	0x60,0x30,0x30,0x50,	0x02,0x01,0x01,0x03
1545.byte	0xce,0x67,0x67,0xa9,	0x56,0x2b,0x2b,0x7d
1546.byte	0xe7,0xfe,0xfe,0x19,	0xb5,0xd7,0xd7,0x62
1547.byte	0x4d,0xab,0xab,0xe6,	0xec,0x76,0x76,0x9a
1548.byte	0x8f,0xca,0xca,0x45,	0x1f,0x82,0x82,0x9d
1549.byte	0x89,0xc9,0xc9,0x40,	0xfa,0x7d,0x7d,0x87
1550.byte	0xef,0xfa,0xfa,0x15,	0xb2,0x59,0x59,0xeb
1551.byte	0x8e,0x47,0x47,0xc9,	0xfb,0xf0,0xf0,0x0b
1552.byte	0x41,0xad,0xad,0xec,	0xb3,0xd4,0xd4,0x67
1553.byte	0x5f,0xa2,0xa2,0xfd,	0x45,0xaf,0xaf,0xea
1554.byte	0x23,0x9c,0x9c,0xbf,	0x53,0xa4,0xa4,0xf7
1555.byte	0xe4,0x72,0x72,0x96,	0x9b,0xc0,0xc0,0x5b
1556.byte	0x75,0xb7,0xb7,0xc2,	0xe1,0xfd,0xfd,0x1c
1557.byte	0x3d,0x93,0x93,0xae,	0x4c,0x26,0x26,0x6a
1558.byte	0x6c,0x36,0x36,0x5a,	0x7e,0x3f,0x3f,0x41
1559.byte	0xf5,0xf7,0xf7,0x02,	0x83,0xcc,0xcc,0x4f
1560.byte	0x68,0x34,0x34,0x5c,	0x51,0xa5,0xa5,0xf4
1561.byte	0xd1,0xe5,0xe5,0x34,	0xf9,0xf1,0xf1,0x08
1562.byte	0xe2,0x71,0x71,0x93,	0xab,0xd8,0xd8,0x73
1563.byte	0x62,0x31,0x31,0x53,	0x2a,0x15,0x15,0x3f
1564.byte	0x08,0x04,0x04,0x0c,	0x95,0xc7,0xc7,0x52
1565.byte	0x46,0x23,0x23,0x65,	0x9d,0xc3,0xc3,0x5e
1566.byte	0x30,0x18,0x18,0x28,	0x37,0x96,0x96,0xa1
1567.byte	0x0a,0x05,0x05,0x0f,	0x2f,0x9a,0x9a,0xb5
1568.byte	0x0e,0x07,0x07,0x09,	0x24,0x12,0x12,0x36
1569.byte	0x1b,0x80,0x80,0x9b,	0xdf,0xe2,0xe2,0x3d
1570.byte	0xcd,0xeb,0xeb,0x26,	0x4e,0x27,0x27,0x69
1571.byte	0x7f,0xb2,0xb2,0xcd,	0xea,0x75,0x75,0x9f
1572.byte	0x12,0x09,0x09,0x1b,	0x1d,0x83,0x83,0x9e
1573.byte	0x58,0x2c,0x2c,0x74,	0x34,0x1a,0x1a,0x2e
1574.byte	0x36,0x1b,0x1b,0x2d,	0xdc,0x6e,0x6e,0xb2
1575.byte	0xb4,0x5a,0x5a,0xee,	0x5b,0xa0,0xa0,0xfb
1576.byte	0xa4,0x52,0x52,0xf6,	0x76,0x3b,0x3b,0x4d
1577.byte	0xb7,0xd6,0xd6,0x61,	0x7d,0xb3,0xb3,0xce
1578.byte	0x52,0x29,0x29,0x7b,	0xdd,0xe3,0xe3,0x3e
1579.byte	0x5e,0x2f,0x2f,0x71,	0x13,0x84,0x84,0x97
1580.byte	0xa6,0x53,0x53,0xf5,	0xb9,0xd1,0xd1,0x68
1581.byte	0x00,0x00,0x00,0x00,	0xc1,0xed,0xed,0x2c
1582.byte	0x40,0x20,0x20,0x60,	0xe3,0xfc,0xfc,0x1f
1583.byte	0x79,0xb1,0xb1,0xc8,	0xb6,0x5b,0x5b,0xed
1584.byte	0xd4,0x6a,0x6a,0xbe,	0x8d,0xcb,0xcb,0x46
1585.byte	0x67,0xbe,0xbe,0xd9,	0x72,0x39,0x39,0x4b
1586.byte	0x94,0x4a,0x4a,0xde,	0x98,0x4c,0x4c,0xd4
1587.byte	0xb0,0x58,0x58,0xe8,	0x85,0xcf,0xcf,0x4a
1588.byte	0xbb,0xd0,0xd0,0x6b,	0xc5,0xef,0xef,0x2a
1589.byte	0x4f,0xaa,0xaa,0xe5,	0xed,0xfb,0xfb,0x16
1590.byte	0x86,0x43,0x43,0xc5,	0x9a,0x4d,0x4d,0xd7
1591.byte	0x66,0x33,0x33,0x55,	0x11,0x85,0x85,0x94
1592.byte	0x8a,0x45,0x45,0xcf,	0xe9,0xf9,0xf9,0x10
1593.byte	0x04,0x02,0x02,0x06,	0xfe,0x7f,0x7f,0x81
1594.byte	0xa0,0x50,0x50,0xf0,	0x78,0x3c,0x3c,0x44
1595.byte	0x25,0x9f,0x9f,0xba,	0x4b,0xa8,0xa8,0xe3
1596.byte	0xa2,0x51,0x51,0xf3,	0x5d,0xa3,0xa3,0xfe
1597.byte	0x80,0x40,0x40,0xc0,	0x05,0x8f,0x8f,0x8a
1598.byte	0x3f,0x92,0x92,0xad,	0x21,0x9d,0x9d,0xbc
1599.byte	0x70,0x38,0x38,0x48,	0xf1,0xf5,0xf5,0x04
1600.byte	0x63,0xbc,0xbc,0xdf,	0x77,0xb6,0xb6,0xc1
1601.byte	0xaf,0xda,0xda,0x75,	0x42,0x21,0x21,0x63
1602.byte	0x20,0x10,0x10,0x30,	0xe5,0xff,0xff,0x1a
1603.byte	0xfd,0xf3,0xf3,0x0e,	0xbf,0xd2,0xd2,0x6d
1604.byte	0x81,0xcd,0xcd,0x4c,	0x18,0x0c,0x0c,0x14
1605.byte	0x26,0x13,0x13,0x35,	0xc3,0xec,0xec,0x2f
1606.byte	0xbe,0x5f,0x5f,0xe1,	0x35,0x97,0x97,0xa2
1607.byte	0x88,0x44,0x44,0xcc,	0x2e,0x17,0x17,0x39
1608.byte	0x93,0xc4,0xc4,0x57,	0x55,0xa7,0xa7,0xf2
1609.byte	0xfc,0x7e,0x7e,0x82,	0x7a,0x3d,0x3d,0x47
1610.byte	0xc8,0x64,0x64,0xac,	0xba,0x5d,0x5d,0xe7
1611.byte	0x32,0x19,0x19,0x2b,	0xe6,0x73,0x73,0x95
1612.byte	0xc0,0x60,0x60,0xa0,	0x19,0x81,0x81,0x98
1613.byte	0x9e,0x4f,0x4f,0xd1,	0xa3,0xdc,0xdc,0x7f
1614.byte	0x44,0x22,0x22,0x66,	0x54,0x2a,0x2a,0x7e
1615.byte	0x3b,0x90,0x90,0xab,	0x0b,0x88,0x88,0x83
1616.byte	0x8c,0x46,0x46,0xca,	0xc7,0xee,0xee,0x29
1617.byte	0x6b,0xb8,0xb8,0xd3,	0x28,0x14,0x14,0x3c
1618.byte	0xa7,0xde,0xde,0x79,	0xbc,0x5e,0x5e,0xe2
1619.byte	0x16,0x0b,0x0b,0x1d,	0xad,0xdb,0xdb,0x76
1620.byte	0xdb,0xe0,0xe0,0x3b,	0x64,0x32,0x32,0x56
1621.byte	0x74,0x3a,0x3a,0x4e,	0x14,0x0a,0x0a,0x1e
1622.byte	0x92,0x49,0x49,0xdb,	0x0c,0x06,0x06,0x0a
1623.byte	0x48,0x24,0x24,0x6c,	0xb8,0x5c,0x5c,0xe4
1624.byte	0x9f,0xc2,0xc2,0x5d,	0xbd,0xd3,0xd3,0x6e
1625.byte	0x43,0xac,0xac,0xef,	0xc4,0x62,0x62,0xa6
1626.byte	0x39,0x91,0x91,0xa8,	0x31,0x95,0x95,0xa4
1627.byte	0xd3,0xe4,0xe4,0x37,	0xf2,0x79,0x79,0x8b
1628.byte	0xd5,0xe7,0xe7,0x32,	0x8b,0xc8,0xc8,0x43
1629.byte	0x6e,0x37,0x37,0x59,	0xda,0x6d,0x6d,0xb7
1630.byte	0x01,0x8d,0x8d,0x8c,	0xb1,0xd5,0xd5,0x64
1631.byte	0x9c,0x4e,0x4e,0xd2,	0x49,0xa9,0xa9,0xe0
1632.byte	0xd8,0x6c,0x6c,0xb4,	0xac,0x56,0x56,0xfa
1633.byte	0xf3,0xf4,0xf4,0x07,	0xcf,0xea,0xea,0x25
1634.byte	0xca,0x65,0x65,0xaf,	0xf4,0x7a,0x7a,0x8e
1635.byte	0x47,0xae,0xae,0xe9,	0x10,0x08,0x08,0x18
1636.byte	0x6f,0xba,0xba,0xd5,	0xf0,0x78,0x78,0x88
1637.byte	0x4a,0x25,0x25,0x6f,	0x5c,0x2e,0x2e,0x72
1638.byte	0x38,0x1c,0x1c,0x24,	0x57,0xa6,0xa6,0xf1
1639.byte	0x73,0xb4,0xb4,0xc7,	0x97,0xc6,0xc6,0x51
1640.byte	0xcb,0xe8,0xe8,0x23,	0xa1,0xdd,0xdd,0x7c
1641.byte	0xe8,0x74,0x74,0x9c,	0x3e,0x1f,0x1f,0x21
1642.byte	0x96,0x4b,0x4b,0xdd,	0x61,0xbd,0xbd,0xdc
1643.byte	0x0d,0x8b,0x8b,0x86,	0x0f,0x8a,0x8a,0x85
1644.byte	0xe0,0x70,0x70,0x90,	0x7c,0x3e,0x3e,0x42
1645.byte	0x71,0xb5,0xb5,0xc4,	0xcc,0x66,0x66,0xaa
1646.byte	0x90,0x48,0x48,0xd8,	0x06,0x03,0x03,0x05
1647.byte	0xf7,0xf6,0xf6,0x01,	0x1c,0x0e,0x0e,0x12
1648.byte	0xc2,0x61,0x61,0xa3,	0x6a,0x35,0x35,0x5f
1649.byte	0xae,0x57,0x57,0xf9,	0x69,0xb9,0xb9,0xd0
1650.byte	0x17,0x86,0x86,0x91,	0x99,0xc1,0xc1,0x58
1651.byte	0x3a,0x1d,0x1d,0x27,	0x27,0x9e,0x9e,0xb9
1652.byte	0xd9,0xe1,0xe1,0x38,	0xeb,0xf8,0xf8,0x13
1653.byte	0x2b,0x98,0x98,0xb3,	0x22,0x11,0x11,0x33
1654.byte	0xd2,0x69,0x69,0xbb,	0xa9,0xd9,0xd9,0x70
1655.byte	0x07,0x8e,0x8e,0x89,	0x33,0x94,0x94,0xa7
1656.byte	0x2d,0x9b,0x9b,0xb6,	0x3c,0x1e,0x1e,0x22
1657.byte	0x15,0x87,0x87,0x92,	0xc9,0xe9,0xe9,0x20
1658.byte	0x87,0xce,0xce,0x49,	0xaa,0x55,0x55,0xff
1659.byte	0x50,0x28,0x28,0x78,	0xa5,0xdf,0xdf,0x7a
1660.byte	0x03,0x8c,0x8c,0x8f,	0x59,0xa1,0xa1,0xf8
1661.byte	0x09,0x89,0x89,0x80,	0x1a,0x0d,0x0d,0x17
1662.byte	0x65,0xbf,0xbf,0xda,	0xd7,0xe6,0xe6,0x31
1663.byte	0x84,0x42,0x42,0xc6,	0xd0,0x68,0x68,0xb8
1664.byte	0x82,0x41,0x41,0xc3,	0x29,0x99,0x99,0xb0
1665.byte	0x5a,0x2d,0x2d,0x77,	0x1e,0x0f,0x0f,0x11
1666.byte	0x7b,0xb0,0xb0,0xcb,	0xa8,0x54,0x54,0xfc
1667.byte	0x6d,0xbb,0xbb,0xd6,	0x2c,0x16,0x16,0x3a
1668
1669AES_Td:
1670.byte	0x51,0xf4,0xa7,0x50,	0x7e,0x41,0x65,0x53	# Td0
1671.byte	0x1a,0x17,0xa4,0xc3,	0x3a,0x27,0x5e,0x96
1672.byte	0x3b,0xab,0x6b,0xcb,	0x1f,0x9d,0x45,0xf1
1673.byte	0xac,0xfa,0x58,0xab,	0x4b,0xe3,0x03,0x93
1674.byte	0x20,0x30,0xfa,0x55,	0xad,0x76,0x6d,0xf6
1675.byte	0x88,0xcc,0x76,0x91,	0xf5,0x02,0x4c,0x25
1676.byte	0x4f,0xe5,0xd7,0xfc,	0xc5,0x2a,0xcb,0xd7
1677.byte	0x26,0x35,0x44,0x80,	0xb5,0x62,0xa3,0x8f
1678.byte	0xde,0xb1,0x5a,0x49,	0x25,0xba,0x1b,0x67
1679.byte	0x45,0xea,0x0e,0x98,	0x5d,0xfe,0xc0,0xe1
1680.byte	0xc3,0x2f,0x75,0x02,	0x81,0x4c,0xf0,0x12
1681.byte	0x8d,0x46,0x97,0xa3,	0x6b,0xd3,0xf9,0xc6
1682.byte	0x03,0x8f,0x5f,0xe7,	0x15,0x92,0x9c,0x95
1683.byte	0xbf,0x6d,0x7a,0xeb,	0x95,0x52,0x59,0xda
1684.byte	0xd4,0xbe,0x83,0x2d,	0x58,0x74,0x21,0xd3
1685.byte	0x49,0xe0,0x69,0x29,	0x8e,0xc9,0xc8,0x44
1686.byte	0x75,0xc2,0x89,0x6a,	0xf4,0x8e,0x79,0x78
1687.byte	0x99,0x58,0x3e,0x6b,	0x27,0xb9,0x71,0xdd
1688.byte	0xbe,0xe1,0x4f,0xb6,	0xf0,0x88,0xad,0x17
1689.byte	0xc9,0x20,0xac,0x66,	0x7d,0xce,0x3a,0xb4
1690.byte	0x63,0xdf,0x4a,0x18,	0xe5,0x1a,0x31,0x82
1691.byte	0x97,0x51,0x33,0x60,	0x62,0x53,0x7f,0x45
1692.byte	0xb1,0x64,0x77,0xe0,	0xbb,0x6b,0xae,0x84
1693.byte	0xfe,0x81,0xa0,0x1c,	0xf9,0x08,0x2b,0x94
1694.byte	0x70,0x48,0x68,0x58,	0x8f,0x45,0xfd,0x19
1695.byte	0x94,0xde,0x6c,0x87,	0x52,0x7b,0xf8,0xb7
1696.byte	0xab,0x73,0xd3,0x23,	0x72,0x4b,0x02,0xe2
1697.byte	0xe3,0x1f,0x8f,0x57,	0x66,0x55,0xab,0x2a
1698.byte	0xb2,0xeb,0x28,0x07,	0x2f,0xb5,0xc2,0x03
1699.byte	0x86,0xc5,0x7b,0x9a,	0xd3,0x37,0x08,0xa5
1700.byte	0x30,0x28,0x87,0xf2,	0x23,0xbf,0xa5,0xb2
1701.byte	0x02,0x03,0x6a,0xba,	0xed,0x16,0x82,0x5c
1702.byte	0x8a,0xcf,0x1c,0x2b,	0xa7,0x79,0xb4,0x92
1703.byte	0xf3,0x07,0xf2,0xf0,	0x4e,0x69,0xe2,0xa1
1704.byte	0x65,0xda,0xf4,0xcd,	0x06,0x05,0xbe,0xd5
1705.byte	0xd1,0x34,0x62,0x1f,	0xc4,0xa6,0xfe,0x8a
1706.byte	0x34,0x2e,0x53,0x9d,	0xa2,0xf3,0x55,0xa0
1707.byte	0x05,0x8a,0xe1,0x32,	0xa4,0xf6,0xeb,0x75
1708.byte	0x0b,0x83,0xec,0x39,	0x40,0x60,0xef,0xaa
1709.byte	0x5e,0x71,0x9f,0x06,	0xbd,0x6e,0x10,0x51
1710.byte	0x3e,0x21,0x8a,0xf9,	0x96,0xdd,0x06,0x3d
1711.byte	0xdd,0x3e,0x05,0xae,	0x4d,0xe6,0xbd,0x46
1712.byte	0x91,0x54,0x8d,0xb5,	0x71,0xc4,0x5d,0x05
1713.byte	0x04,0x06,0xd4,0x6f,	0x60,0x50,0x15,0xff
1714.byte	0x19,0x98,0xfb,0x24,	0xd6,0xbd,0xe9,0x97
1715.byte	0x89,0x40,0x43,0xcc,	0x67,0xd9,0x9e,0x77
1716.byte	0xb0,0xe8,0x42,0xbd,	0x07,0x89,0x8b,0x88
1717.byte	0xe7,0x19,0x5b,0x38,	0x79,0xc8,0xee,0xdb
1718.byte	0xa1,0x7c,0x0a,0x47,	0x7c,0x42,0x0f,0xe9
1719.byte	0xf8,0x84,0x1e,0xc9,	0x00,0x00,0x00,0x00
1720.byte	0x09,0x80,0x86,0x83,	0x32,0x2b,0xed,0x48
1721.byte	0x1e,0x11,0x70,0xac,	0x6c,0x5a,0x72,0x4e
1722.byte	0xfd,0x0e,0xff,0xfb,	0x0f,0x85,0x38,0x56
1723.byte	0x3d,0xae,0xd5,0x1e,	0x36,0x2d,0x39,0x27
1724.byte	0x0a,0x0f,0xd9,0x64,	0x68,0x5c,0xa6,0x21
1725.byte	0x9b,0x5b,0x54,0xd1,	0x24,0x36,0x2e,0x3a
1726.byte	0x0c,0x0a,0x67,0xb1,	0x93,0x57,0xe7,0x0f
1727.byte	0xb4,0xee,0x96,0xd2,	0x1b,0x9b,0x91,0x9e
1728.byte	0x80,0xc0,0xc5,0x4f,	0x61,0xdc,0x20,0xa2
1729.byte	0x5a,0x77,0x4b,0x69,	0x1c,0x12,0x1a,0x16
1730.byte	0xe2,0x93,0xba,0x0a,	0xc0,0xa0,0x2a,0xe5
1731.byte	0x3c,0x22,0xe0,0x43,	0x12,0x1b,0x17,0x1d
1732.byte	0x0e,0x09,0x0d,0x0b,	0xf2,0x8b,0xc7,0xad
1733.byte	0x2d,0xb6,0xa8,0xb9,	0x14,0x1e,0xa9,0xc8
1734.byte	0x57,0xf1,0x19,0x85,	0xaf,0x75,0x07,0x4c
1735.byte	0xee,0x99,0xdd,0xbb,	0xa3,0x7f,0x60,0xfd
1736.byte	0xf7,0x01,0x26,0x9f,	0x5c,0x72,0xf5,0xbc
1737.byte	0x44,0x66,0x3b,0xc5,	0x5b,0xfb,0x7e,0x34
1738.byte	0x8b,0x43,0x29,0x76,	0xcb,0x23,0xc6,0xdc
1739.byte	0xb6,0xed,0xfc,0x68,	0xb8,0xe4,0xf1,0x63
1740.byte	0xd7,0x31,0xdc,0xca,	0x42,0x63,0x85,0x10
1741.byte	0x13,0x97,0x22,0x40,	0x84,0xc6,0x11,0x20
1742.byte	0x85,0x4a,0x24,0x7d,	0xd2,0xbb,0x3d,0xf8
1743.byte	0xae,0xf9,0x32,0x11,	0xc7,0x29,0xa1,0x6d
1744.byte	0x1d,0x9e,0x2f,0x4b,	0xdc,0xb2,0x30,0xf3
1745.byte	0x0d,0x86,0x52,0xec,	0x77,0xc1,0xe3,0xd0
1746.byte	0x2b,0xb3,0x16,0x6c,	0xa9,0x70,0xb9,0x99
1747.byte	0x11,0x94,0x48,0xfa,	0x47,0xe9,0x64,0x22
1748.byte	0xa8,0xfc,0x8c,0xc4,	0xa0,0xf0,0x3f,0x1a
1749.byte	0x56,0x7d,0x2c,0xd8,	0x22,0x33,0x90,0xef
1750.byte	0x87,0x49,0x4e,0xc7,	0xd9,0x38,0xd1,0xc1
1751.byte	0x8c,0xca,0xa2,0xfe,	0x98,0xd4,0x0b,0x36
1752.byte	0xa6,0xf5,0x81,0xcf,	0xa5,0x7a,0xde,0x28
1753.byte	0xda,0xb7,0x8e,0x26,	0x3f,0xad,0xbf,0xa4
1754.byte	0x2c,0x3a,0x9d,0xe4,	0x50,0x78,0x92,0x0d
1755.byte	0x6a,0x5f,0xcc,0x9b,	0x54,0x7e,0x46,0x62
1756.byte	0xf6,0x8d,0x13,0xc2,	0x90,0xd8,0xb8,0xe8
1757.byte	0x2e,0x39,0xf7,0x5e,	0x82,0xc3,0xaf,0xf5
1758.byte	0x9f,0x5d,0x80,0xbe,	0x69,0xd0,0x93,0x7c
1759.byte	0x6f,0xd5,0x2d,0xa9,	0xcf,0x25,0x12,0xb3
1760.byte	0xc8,0xac,0x99,0x3b,	0x10,0x18,0x7d,0xa7
1761.byte	0xe8,0x9c,0x63,0x6e,	0xdb,0x3b,0xbb,0x7b
1762.byte	0xcd,0x26,0x78,0x09,	0x6e,0x59,0x18,0xf4
1763.byte	0xec,0x9a,0xb7,0x01,	0x83,0x4f,0x9a,0xa8
1764.byte	0xe6,0x95,0x6e,0x65,	0xaa,0xff,0xe6,0x7e
1765.byte	0x21,0xbc,0xcf,0x08,	0xef,0x15,0xe8,0xe6
1766.byte	0xba,0xe7,0x9b,0xd9,	0x4a,0x6f,0x36,0xce
1767.byte	0xea,0x9f,0x09,0xd4,	0x29,0xb0,0x7c,0xd6
1768.byte	0x31,0xa4,0xb2,0xaf,	0x2a,0x3f,0x23,0x31
1769.byte	0xc6,0xa5,0x94,0x30,	0x35,0xa2,0x66,0xc0
1770.byte	0x74,0x4e,0xbc,0x37,	0xfc,0x82,0xca,0xa6
1771.byte	0xe0,0x90,0xd0,0xb0,	0x33,0xa7,0xd8,0x15
1772.byte	0xf1,0x04,0x98,0x4a,	0x41,0xec,0xda,0xf7
1773.byte	0x7f,0xcd,0x50,0x0e,	0x17,0x91,0xf6,0x2f
1774.byte	0x76,0x4d,0xd6,0x8d,	0x43,0xef,0xb0,0x4d
1775.byte	0xcc,0xaa,0x4d,0x54,	0xe4,0x96,0x04,0xdf
1776.byte	0x9e,0xd1,0xb5,0xe3,	0x4c,0x6a,0x88,0x1b
1777.byte	0xc1,0x2c,0x1f,0xb8,	0x46,0x65,0x51,0x7f
1778.byte	0x9d,0x5e,0xea,0x04,	0x01,0x8c,0x35,0x5d
1779.byte	0xfa,0x87,0x74,0x73,	0xfb,0x0b,0x41,0x2e
1780.byte	0xb3,0x67,0x1d,0x5a,	0x92,0xdb,0xd2,0x52
1781.byte	0xe9,0x10,0x56,0x33,	0x6d,0xd6,0x47,0x13
1782.byte	0x9a,0xd7,0x61,0x8c,	0x37,0xa1,0x0c,0x7a
1783.byte	0x59,0xf8,0x14,0x8e,	0xeb,0x13,0x3c,0x89
1784.byte	0xce,0xa9,0x27,0xee,	0xb7,0x61,0xc9,0x35
1785.byte	0xe1,0x1c,0xe5,0xed,	0x7a,0x47,0xb1,0x3c
1786.byte	0x9c,0xd2,0xdf,0x59,	0x55,0xf2,0x73,0x3f
1787.byte	0x18,0x14,0xce,0x79,	0x73,0xc7,0x37,0xbf
1788.byte	0x53,0xf7,0xcd,0xea,	0x5f,0xfd,0xaa,0x5b
1789.byte	0xdf,0x3d,0x6f,0x14,	0x78,0x44,0xdb,0x86
1790.byte	0xca,0xaf,0xf3,0x81,	0xb9,0x68,0xc4,0x3e
1791.byte	0x38,0x24,0x34,0x2c,	0xc2,0xa3,0x40,0x5f
1792.byte	0x16,0x1d,0xc3,0x72,	0xbc,0xe2,0x25,0x0c
1793.byte	0x28,0x3c,0x49,0x8b,	0xff,0x0d,0x95,0x41
1794.byte	0x39,0xa8,0x01,0x71,	0x08,0x0c,0xb3,0xde
1795.byte	0xd8,0xb4,0xe4,0x9c,	0x64,0x56,0xc1,0x90
1796.byte	0x7b,0xcb,0x84,0x61,	0xd5,0x32,0xb6,0x70
1797.byte	0x48,0x6c,0x5c,0x74,	0xd0,0xb8,0x57,0x42
1798
1799.byte	0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38	# Td4
1800.byte	0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb
1801.byte	0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87
1802.byte	0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb
1803.byte	0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d
1804.byte	0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e
1805.byte	0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2
1806.byte	0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25
1807.byte	0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16
1808.byte	0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92
1809.byte	0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda
1810.byte	0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84
1811.byte	0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a
1812.byte	0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06
1813.byte	0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02
1814.byte	0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b
1815.byte	0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea
1816.byte	0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73
1817.byte	0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85
1818.byte	0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e
1819.byte	0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89
1820.byte	0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b
1821.byte	0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20
1822.byte	0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4
1823.byte	0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31
1824.byte	0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f
1825.byte	0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d
1826.byte	0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef
1827.byte	0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0
1828.byte	0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61
1829.byte	0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26
1830.byte	0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
1831
1832AES_Te4:
1833.byte	0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5	# Te4
1834.byte	0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76
1835.byte	0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0
1836.byte	0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0
1837.byte	0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc
1838.byte	0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15
1839.byte	0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a
1840.byte	0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75
1841.byte	0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0
1842.byte	0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84
1843.byte	0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b
1844.byte	0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf
1845.byte	0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85
1846.byte	0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8
1847.byte	0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5
1848.byte	0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2
1849.byte	0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17
1850.byte	0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73
1851.byte	0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88
1852.byte	0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb
1853.byte	0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c
1854.byte	0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79
1855.byte	0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9
1856.byte	0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08
1857.byte	0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6
1858.byte	0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a
1859.byte	0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e
1860.byte	0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e
1861.byte	0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94
1862.byte	0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf
1863.byte	0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68
1864.byte	0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
1865
1866.byte	0x01,0x00,0x00,0x00,	0x02,0x00,0x00,0x00	# rcon
1867.byte	0x04,0x00,0x00,0x00,	0x08,0x00,0x00,0x00
1868.byte	0x10,0x00,0x00,0x00,	0x20,0x00,0x00,0x00
1869.byte	0x40,0x00,0x00,0x00,	0x80,0x00,0x00,0x00
1870.byte	0x1B,0x00,0x00,0x00,	0x36,0x00,0x00,0x00
1871