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