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