mips_be.S 38 KB

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