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