serpent-sse2-i586-asm_32.S 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Serpent Cipher 4-way parallel algorithm (i586/SSE2)
  4. *
  5. * Copyright (C) 2011 Jussi Kivilinna <[email protected]>
  6. *
  7. * Based on crypto/serpent.c by
  8. * Copyright (C) 2002 Dag Arne Osvik <[email protected]>
  9. * 2003 Herbert Valerio Riedel <[email protected]>
  10. */
  11. #include <linux/linkage.h>
  12. .file "serpent-sse2-i586-asm_32.S"
  13. .text
  14. #define arg_ctx 4
  15. #define arg_dst 8
  16. #define arg_src 12
  17. #define arg_xor 16
  18. /**********************************************************************
  19. 4-way SSE2 serpent
  20. **********************************************************************/
  21. #define CTX %edx
  22. #define RA %xmm0
  23. #define RB %xmm1
  24. #define RC %xmm2
  25. #define RD %xmm3
  26. #define RE %xmm4
  27. #define RT0 %xmm5
  28. #define RT1 %xmm6
  29. #define RNOT %xmm7
  30. #define get_key(i, j, t) \
  31. movd (4*(i)+(j))*4(CTX), t; \
  32. pshufd $0, t, t;
  33. #define K(x0, x1, x2, x3, x4, i) \
  34. get_key(i, 0, x4); \
  35. get_key(i, 1, RT0); \
  36. get_key(i, 2, RT1); \
  37. pxor x4, x0; \
  38. pxor RT0, x1; \
  39. pxor RT1, x2; \
  40. get_key(i, 3, x4); \
  41. pxor x4, x3;
  42. #define LK(x0, x1, x2, x3, x4, i) \
  43. movdqa x0, x4; \
  44. pslld $13, x0; \
  45. psrld $(32 - 13), x4; \
  46. por x4, x0; \
  47. pxor x0, x1; \
  48. movdqa x2, x4; \
  49. pslld $3, x2; \
  50. psrld $(32 - 3), x4; \
  51. por x4, x2; \
  52. pxor x2, x1; \
  53. movdqa x1, x4; \
  54. pslld $1, x1; \
  55. psrld $(32 - 1), x4; \
  56. por x4, x1; \
  57. movdqa x0, x4; \
  58. pslld $3, x4; \
  59. pxor x2, x3; \
  60. pxor x4, x3; \
  61. movdqa x3, x4; \
  62. pslld $7, x3; \
  63. psrld $(32 - 7), x4; \
  64. por x4, x3; \
  65. movdqa x1, x4; \
  66. pslld $7, x4; \
  67. pxor x1, x0; \
  68. pxor x3, x0; \
  69. pxor x3, x2; \
  70. pxor x4, x2; \
  71. movdqa x0, x4; \
  72. get_key(i, 1, RT0); \
  73. pxor RT0, x1; \
  74. get_key(i, 3, RT0); \
  75. pxor RT0, x3; \
  76. pslld $5, x0; \
  77. psrld $(32 - 5), x4; \
  78. por x4, x0; \
  79. movdqa x2, x4; \
  80. pslld $22, x2; \
  81. psrld $(32 - 22), x4; \
  82. por x4, x2; \
  83. get_key(i, 0, RT0); \
  84. pxor RT0, x0; \
  85. get_key(i, 2, RT0); \
  86. pxor RT0, x2;
  87. #define KL(x0, x1, x2, x3, x4, i) \
  88. K(x0, x1, x2, x3, x4, i); \
  89. movdqa x0, x4; \
  90. psrld $5, x0; \
  91. pslld $(32 - 5), x4; \
  92. por x4, x0; \
  93. movdqa x2, x4; \
  94. psrld $22, x2; \
  95. pslld $(32 - 22), x4; \
  96. por x4, x2; \
  97. pxor x3, x2; \
  98. pxor x3, x0; \
  99. movdqa x1, x4; \
  100. pslld $7, x4; \
  101. pxor x1, x0; \
  102. pxor x4, x2; \
  103. movdqa x1, x4; \
  104. psrld $1, x1; \
  105. pslld $(32 - 1), x4; \
  106. por x4, x1; \
  107. movdqa x3, x4; \
  108. psrld $7, x3; \
  109. pslld $(32 - 7), x4; \
  110. por x4, x3; \
  111. pxor x0, x1; \
  112. movdqa x0, x4; \
  113. pslld $3, x4; \
  114. pxor x4, x3; \
  115. movdqa x0, x4; \
  116. psrld $13, x0; \
  117. pslld $(32 - 13), x4; \
  118. por x4, x0; \
  119. pxor x2, x1; \
  120. pxor x2, x3; \
  121. movdqa x2, x4; \
  122. psrld $3, x2; \
  123. pslld $(32 - 3), x4; \
  124. por x4, x2;
  125. #define S0(x0, x1, x2, x3, x4) \
  126. movdqa x3, x4; \
  127. por x0, x3; \
  128. pxor x4, x0; \
  129. pxor x2, x4; \
  130. pxor RNOT, x4; \
  131. pxor x1, x3; \
  132. pand x0, x1; \
  133. pxor x4, x1; \
  134. pxor x0, x2; \
  135. pxor x3, x0; \
  136. por x0, x4; \
  137. pxor x2, x0; \
  138. pand x1, x2; \
  139. pxor x2, x3; \
  140. pxor RNOT, x1; \
  141. pxor x4, x2; \
  142. pxor x2, x1;
  143. #define S1(x0, x1, x2, x3, x4) \
  144. movdqa x1, x4; \
  145. pxor x0, x1; \
  146. pxor x3, x0; \
  147. pxor RNOT, x3; \
  148. pand x1, x4; \
  149. por x1, x0; \
  150. pxor x2, x3; \
  151. pxor x3, x0; \
  152. pxor x3, x1; \
  153. pxor x4, x3; \
  154. por x4, x1; \
  155. pxor x2, x4; \
  156. pand x0, x2; \
  157. pxor x1, x2; \
  158. por x0, x1; \
  159. pxor RNOT, x0; \
  160. pxor x2, x0; \
  161. pxor x1, x4;
  162. #define S2(x0, x1, x2, x3, x4) \
  163. pxor RNOT, x3; \
  164. pxor x0, x1; \
  165. movdqa x0, x4; \
  166. pand x2, x0; \
  167. pxor x3, x0; \
  168. por x4, x3; \
  169. pxor x1, x2; \
  170. pxor x1, x3; \
  171. pand x0, x1; \
  172. pxor x2, x0; \
  173. pand x3, x2; \
  174. por x1, x3; \
  175. pxor RNOT, x0; \
  176. pxor x0, x3; \
  177. pxor x0, x4; \
  178. pxor x2, x0; \
  179. por x2, x1;
  180. #define S3(x0, x1, x2, x3, x4) \
  181. movdqa x1, x4; \
  182. pxor x3, x1; \
  183. por x0, x3; \
  184. pand x0, x4; \
  185. pxor x2, x0; \
  186. pxor x1, x2; \
  187. pand x3, x1; \
  188. pxor x3, x2; \
  189. por x4, x0; \
  190. pxor x3, x4; \
  191. pxor x0, x1; \
  192. pand x3, x0; \
  193. pand x4, x3; \
  194. pxor x2, x3; \
  195. por x1, x4; \
  196. pand x1, x2; \
  197. pxor x3, x4; \
  198. pxor x3, x0; \
  199. pxor x2, x3;
  200. #define S4(x0, x1, x2, x3, x4) \
  201. movdqa x3, x4; \
  202. pand x0, x3; \
  203. pxor x4, x0; \
  204. pxor x2, x3; \
  205. por x4, x2; \
  206. pxor x1, x0; \
  207. pxor x3, x4; \
  208. por x0, x2; \
  209. pxor x1, x2; \
  210. pand x0, x1; \
  211. pxor x4, x1; \
  212. pand x2, x4; \
  213. pxor x3, x2; \
  214. pxor x0, x4; \
  215. por x1, x3; \
  216. pxor RNOT, x1; \
  217. pxor x0, x3;
  218. #define S5(x0, x1, x2, x3, x4) \
  219. movdqa x1, x4; \
  220. por x0, x1; \
  221. pxor x1, x2; \
  222. pxor RNOT, x3; \
  223. pxor x0, x4; \
  224. pxor x2, x0; \
  225. pand x4, x1; \
  226. por x3, x4; \
  227. pxor x0, x4; \
  228. pand x3, x0; \
  229. pxor x3, x1; \
  230. pxor x2, x3; \
  231. pxor x1, x0; \
  232. pand x4, x2; \
  233. pxor x2, x1; \
  234. pand x0, x2; \
  235. pxor x2, x3;
  236. #define S6(x0, x1, x2, x3, x4) \
  237. movdqa x1, x4; \
  238. pxor x0, x3; \
  239. pxor x2, x1; \
  240. pxor x0, x2; \
  241. pand x3, x0; \
  242. por x3, x1; \
  243. pxor RNOT, x4; \
  244. pxor x1, x0; \
  245. pxor x2, x1; \
  246. pxor x4, x3; \
  247. pxor x0, x4; \
  248. pand x0, x2; \
  249. pxor x1, x4; \
  250. pxor x3, x2; \
  251. pand x1, x3; \
  252. pxor x0, x3; \
  253. pxor x2, x1;
  254. #define S7(x0, x1, x2, x3, x4) \
  255. pxor RNOT, x1; \
  256. movdqa x1, x4; \
  257. pxor RNOT, x0; \
  258. pand x2, x1; \
  259. pxor x3, x1; \
  260. por x4, x3; \
  261. pxor x2, x4; \
  262. pxor x3, x2; \
  263. pxor x0, x3; \
  264. por x1, x0; \
  265. pand x0, x2; \
  266. pxor x4, x0; \
  267. pxor x3, x4; \
  268. pand x0, x3; \
  269. pxor x1, x4; \
  270. pxor x4, x2; \
  271. pxor x1, x3; \
  272. por x0, x4; \
  273. pxor x1, x4;
  274. #define SI0(x0, x1, x2, x3, x4) \
  275. movdqa x3, x4; \
  276. pxor x0, x1; \
  277. por x1, x3; \
  278. pxor x1, x4; \
  279. pxor RNOT, x0; \
  280. pxor x3, x2; \
  281. pxor x0, x3; \
  282. pand x1, x0; \
  283. pxor x2, x0; \
  284. pand x3, x2; \
  285. pxor x4, x3; \
  286. pxor x3, x2; \
  287. pxor x3, x1; \
  288. pand x0, x3; \
  289. pxor x0, x1; \
  290. pxor x2, x0; \
  291. pxor x3, x4;
  292. #define SI1(x0, x1, x2, x3, x4) \
  293. pxor x3, x1; \
  294. movdqa x0, x4; \
  295. pxor x2, x0; \
  296. pxor RNOT, x2; \
  297. por x1, x4; \
  298. pxor x3, x4; \
  299. pand x1, x3; \
  300. pxor x2, x1; \
  301. pand x4, x2; \
  302. pxor x1, x4; \
  303. por x3, x1; \
  304. pxor x0, x3; \
  305. pxor x0, x2; \
  306. por x4, x0; \
  307. pxor x4, x2; \
  308. pxor x0, x1; \
  309. pxor x1, x4;
  310. #define SI2(x0, x1, x2, x3, x4) \
  311. pxor x1, x2; \
  312. movdqa x3, x4; \
  313. pxor RNOT, x3; \
  314. por x2, x3; \
  315. pxor x4, x2; \
  316. pxor x0, x4; \
  317. pxor x1, x3; \
  318. por x2, x1; \
  319. pxor x0, x2; \
  320. pxor x4, x1; \
  321. por x3, x4; \
  322. pxor x3, x2; \
  323. pxor x2, x4; \
  324. pand x1, x2; \
  325. pxor x3, x2; \
  326. pxor x4, x3; \
  327. pxor x0, x4;
  328. #define SI3(x0, x1, x2, x3, x4) \
  329. pxor x1, x2; \
  330. movdqa x1, x4; \
  331. pand x2, x1; \
  332. pxor x0, x1; \
  333. por x4, x0; \
  334. pxor x3, x4; \
  335. pxor x3, x0; \
  336. por x1, x3; \
  337. pxor x2, x1; \
  338. pxor x3, x1; \
  339. pxor x2, x0; \
  340. pxor x3, x2; \
  341. pand x1, x3; \
  342. pxor x0, x1; \
  343. pand x2, x0; \
  344. pxor x3, x4; \
  345. pxor x0, x3; \
  346. pxor x1, x0;
  347. #define SI4(x0, x1, x2, x3, x4) \
  348. pxor x3, x2; \
  349. movdqa x0, x4; \
  350. pand x1, x0; \
  351. pxor x2, x0; \
  352. por x3, x2; \
  353. pxor RNOT, x4; \
  354. pxor x0, x1; \
  355. pxor x2, x0; \
  356. pand x4, x2; \
  357. pxor x0, x2; \
  358. por x4, x0; \
  359. pxor x3, x0; \
  360. pand x2, x3; \
  361. pxor x3, x4; \
  362. pxor x1, x3; \
  363. pand x0, x1; \
  364. pxor x1, x4; \
  365. pxor x3, x0;
  366. #define SI5(x0, x1, x2, x3, x4) \
  367. movdqa x1, x4; \
  368. por x2, x1; \
  369. pxor x4, x2; \
  370. pxor x3, x1; \
  371. pand x4, x3; \
  372. pxor x3, x2; \
  373. por x0, x3; \
  374. pxor RNOT, x0; \
  375. pxor x2, x3; \
  376. por x0, x2; \
  377. pxor x1, x4; \
  378. pxor x4, x2; \
  379. pand x0, x4; \
  380. pxor x1, x0; \
  381. pxor x3, x1; \
  382. pand x2, x0; \
  383. pxor x3, x2; \
  384. pxor x2, x0; \
  385. pxor x4, x2; \
  386. pxor x3, x4;
  387. #define SI6(x0, x1, x2, x3, x4) \
  388. pxor x2, x0; \
  389. movdqa x0, x4; \
  390. pand x3, x0; \
  391. pxor x3, x2; \
  392. pxor x2, x0; \
  393. pxor x1, x3; \
  394. por x4, x2; \
  395. pxor x3, x2; \
  396. pand x0, x3; \
  397. pxor RNOT, x0; \
  398. pxor x1, x3; \
  399. pand x2, x1; \
  400. pxor x0, x4; \
  401. pxor x4, x3; \
  402. pxor x2, x4; \
  403. pxor x1, x0; \
  404. pxor x0, x2;
  405. #define SI7(x0, x1, x2, x3, x4) \
  406. movdqa x3, x4; \
  407. pand x0, x3; \
  408. pxor x2, x0; \
  409. por x4, x2; \
  410. pxor x1, x4; \
  411. pxor RNOT, x0; \
  412. por x3, x1; \
  413. pxor x0, x4; \
  414. pand x2, x0; \
  415. pxor x1, x0; \
  416. pand x2, x1; \
  417. pxor x2, x3; \
  418. pxor x3, x4; \
  419. pand x3, x2; \
  420. por x0, x3; \
  421. pxor x4, x1; \
  422. pxor x4, x3; \
  423. pand x0, x4; \
  424. pxor x2, x4;
  425. #define transpose_4x4(x0, x1, x2, x3, t0, t1, t2) \
  426. movdqa x0, t2; \
  427. punpckldq x1, x0; \
  428. punpckhdq x1, t2; \
  429. movdqa x2, t1; \
  430. punpckhdq x3, x2; \
  431. punpckldq x3, t1; \
  432. movdqa x0, x1; \
  433. punpcklqdq t1, x0; \
  434. punpckhqdq t1, x1; \
  435. movdqa t2, x3; \
  436. punpcklqdq x2, t2; \
  437. punpckhqdq x2, x3; \
  438. movdqa t2, x2;
  439. #define read_blocks(in, x0, x1, x2, x3, t0, t1, t2) \
  440. movdqu (0*4*4)(in), x0; \
  441. movdqu (1*4*4)(in), x1; \
  442. movdqu (2*4*4)(in), x2; \
  443. movdqu (3*4*4)(in), x3; \
  444. \
  445. transpose_4x4(x0, x1, x2, x3, t0, t1, t2)
  446. #define write_blocks(out, x0, x1, x2, x3, t0, t1, t2) \
  447. transpose_4x4(x0, x1, x2, x3, t0, t1, t2) \
  448. \
  449. movdqu x0, (0*4*4)(out); \
  450. movdqu x1, (1*4*4)(out); \
  451. movdqu x2, (2*4*4)(out); \
  452. movdqu x3, (3*4*4)(out);
  453. #define xor_blocks(out, x0, x1, x2, x3, t0, t1, t2) \
  454. transpose_4x4(x0, x1, x2, x3, t0, t1, t2) \
  455. \
  456. movdqu (0*4*4)(out), t0; \
  457. pxor t0, x0; \
  458. movdqu x0, (0*4*4)(out); \
  459. movdqu (1*4*4)(out), t0; \
  460. pxor t0, x1; \
  461. movdqu x1, (1*4*4)(out); \
  462. movdqu (2*4*4)(out), t0; \
  463. pxor t0, x2; \
  464. movdqu x2, (2*4*4)(out); \
  465. movdqu (3*4*4)(out), t0; \
  466. pxor t0, x3; \
  467. movdqu x3, (3*4*4)(out);
  468. SYM_FUNC_START(__serpent_enc_blk_4way)
  469. /* input:
  470. * arg_ctx(%esp): ctx, CTX
  471. * arg_dst(%esp): dst
  472. * arg_src(%esp): src
  473. * arg_xor(%esp): bool, if true: xor output
  474. */
  475. pcmpeqd RNOT, RNOT;
  476. movl arg_ctx(%esp), CTX;
  477. movl arg_src(%esp), %eax;
  478. read_blocks(%eax, RA, RB, RC, RD, RT0, RT1, RE);
  479. K(RA, RB, RC, RD, RE, 0);
  480. S0(RA, RB, RC, RD, RE); LK(RC, RB, RD, RA, RE, 1);
  481. S1(RC, RB, RD, RA, RE); LK(RE, RD, RA, RC, RB, 2);
  482. S2(RE, RD, RA, RC, RB); LK(RB, RD, RE, RC, RA, 3);
  483. S3(RB, RD, RE, RC, RA); LK(RC, RA, RD, RB, RE, 4);
  484. S4(RC, RA, RD, RB, RE); LK(RA, RD, RB, RE, RC, 5);
  485. S5(RA, RD, RB, RE, RC); LK(RC, RA, RD, RE, RB, 6);
  486. S6(RC, RA, RD, RE, RB); LK(RD, RB, RA, RE, RC, 7);
  487. S7(RD, RB, RA, RE, RC); LK(RC, RA, RE, RD, RB, 8);
  488. S0(RC, RA, RE, RD, RB); LK(RE, RA, RD, RC, RB, 9);
  489. S1(RE, RA, RD, RC, RB); LK(RB, RD, RC, RE, RA, 10);
  490. S2(RB, RD, RC, RE, RA); LK(RA, RD, RB, RE, RC, 11);
  491. S3(RA, RD, RB, RE, RC); LK(RE, RC, RD, RA, RB, 12);
  492. S4(RE, RC, RD, RA, RB); LK(RC, RD, RA, RB, RE, 13);
  493. S5(RC, RD, RA, RB, RE); LK(RE, RC, RD, RB, RA, 14);
  494. S6(RE, RC, RD, RB, RA); LK(RD, RA, RC, RB, RE, 15);
  495. S7(RD, RA, RC, RB, RE); LK(RE, RC, RB, RD, RA, 16);
  496. S0(RE, RC, RB, RD, RA); LK(RB, RC, RD, RE, RA, 17);
  497. S1(RB, RC, RD, RE, RA); LK(RA, RD, RE, RB, RC, 18);
  498. S2(RA, RD, RE, RB, RC); LK(RC, RD, RA, RB, RE, 19);
  499. S3(RC, RD, RA, RB, RE); LK(RB, RE, RD, RC, RA, 20);
  500. S4(RB, RE, RD, RC, RA); LK(RE, RD, RC, RA, RB, 21);
  501. S5(RE, RD, RC, RA, RB); LK(RB, RE, RD, RA, RC, 22);
  502. S6(RB, RE, RD, RA, RC); LK(RD, RC, RE, RA, RB, 23);
  503. S7(RD, RC, RE, RA, RB); LK(RB, RE, RA, RD, RC, 24);
  504. S0(RB, RE, RA, RD, RC); LK(RA, RE, RD, RB, RC, 25);
  505. S1(RA, RE, RD, RB, RC); LK(RC, RD, RB, RA, RE, 26);
  506. S2(RC, RD, RB, RA, RE); LK(RE, RD, RC, RA, RB, 27);
  507. S3(RE, RD, RC, RA, RB); LK(RA, RB, RD, RE, RC, 28);
  508. S4(RA, RB, RD, RE, RC); LK(RB, RD, RE, RC, RA, 29);
  509. S5(RB, RD, RE, RC, RA); LK(RA, RB, RD, RC, RE, 30);
  510. S6(RA, RB, RD, RC, RE); LK(RD, RE, RB, RC, RA, 31);
  511. S7(RD, RE, RB, RC, RA); K(RA, RB, RC, RD, RE, 32);
  512. movl arg_dst(%esp), %eax;
  513. cmpb $0, arg_xor(%esp);
  514. jnz .L__enc_xor4;
  515. write_blocks(%eax, RA, RB, RC, RD, RT0, RT1, RE);
  516. RET;
  517. .L__enc_xor4:
  518. xor_blocks(%eax, RA, RB, RC, RD, RT0, RT1, RE);
  519. RET;
  520. SYM_FUNC_END(__serpent_enc_blk_4way)
  521. SYM_FUNC_START(serpent_dec_blk_4way)
  522. /* input:
  523. * arg_ctx(%esp): ctx, CTX
  524. * arg_dst(%esp): dst
  525. * arg_src(%esp): src
  526. */
  527. pcmpeqd RNOT, RNOT;
  528. movl arg_ctx(%esp), CTX;
  529. movl arg_src(%esp), %eax;
  530. read_blocks(%eax, RA, RB, RC, RD, RT0, RT1, RE);
  531. K(RA, RB, RC, RD, RE, 32);
  532. SI7(RA, RB, RC, RD, RE); KL(RB, RD, RA, RE, RC, 31);
  533. SI6(RB, RD, RA, RE, RC); KL(RA, RC, RE, RB, RD, 30);
  534. SI5(RA, RC, RE, RB, RD); KL(RC, RD, RA, RE, RB, 29);
  535. SI4(RC, RD, RA, RE, RB); KL(RC, RA, RB, RE, RD, 28);
  536. SI3(RC, RA, RB, RE, RD); KL(RB, RC, RD, RE, RA, 27);
  537. SI2(RB, RC, RD, RE, RA); KL(RC, RA, RE, RD, RB, 26);
  538. SI1(RC, RA, RE, RD, RB); KL(RB, RA, RE, RD, RC, 25);
  539. SI0(RB, RA, RE, RD, RC); KL(RE, RC, RA, RB, RD, 24);
  540. SI7(RE, RC, RA, RB, RD); KL(RC, RB, RE, RD, RA, 23);
  541. SI6(RC, RB, RE, RD, RA); KL(RE, RA, RD, RC, RB, 22);
  542. SI5(RE, RA, RD, RC, RB); KL(RA, RB, RE, RD, RC, 21);
  543. SI4(RA, RB, RE, RD, RC); KL(RA, RE, RC, RD, RB, 20);
  544. SI3(RA, RE, RC, RD, RB); KL(RC, RA, RB, RD, RE, 19);
  545. SI2(RC, RA, RB, RD, RE); KL(RA, RE, RD, RB, RC, 18);
  546. SI1(RA, RE, RD, RB, RC); KL(RC, RE, RD, RB, RA, 17);
  547. SI0(RC, RE, RD, RB, RA); KL(RD, RA, RE, RC, RB, 16);
  548. SI7(RD, RA, RE, RC, RB); KL(RA, RC, RD, RB, RE, 15);
  549. SI6(RA, RC, RD, RB, RE); KL(RD, RE, RB, RA, RC, 14);
  550. SI5(RD, RE, RB, RA, RC); KL(RE, RC, RD, RB, RA, 13);
  551. SI4(RE, RC, RD, RB, RA); KL(RE, RD, RA, RB, RC, 12);
  552. SI3(RE, RD, RA, RB, RC); KL(RA, RE, RC, RB, RD, 11);
  553. SI2(RA, RE, RC, RB, RD); KL(RE, RD, RB, RC, RA, 10);
  554. SI1(RE, RD, RB, RC, RA); KL(RA, RD, RB, RC, RE, 9);
  555. SI0(RA, RD, RB, RC, RE); KL(RB, RE, RD, RA, RC, 8);
  556. SI7(RB, RE, RD, RA, RC); KL(RE, RA, RB, RC, RD, 7);
  557. SI6(RE, RA, RB, RC, RD); KL(RB, RD, RC, RE, RA, 6);
  558. SI5(RB, RD, RC, RE, RA); KL(RD, RA, RB, RC, RE, 5);
  559. SI4(RD, RA, RB, RC, RE); KL(RD, RB, RE, RC, RA, 4);
  560. SI3(RD, RB, RE, RC, RA); KL(RE, RD, RA, RC, RB, 3);
  561. SI2(RE, RD, RA, RC, RB); KL(RD, RB, RC, RA, RE, 2);
  562. SI1(RD, RB, RC, RA, RE); KL(RE, RB, RC, RA, RD, 1);
  563. SI0(RE, RB, RC, RA, RD); K(RC, RD, RB, RE, RA, 0);
  564. movl arg_dst(%esp), %eax;
  565. write_blocks(%eax, RC, RD, RB, RE, RT0, RT1, RA);
  566. RET;
  567. SYM_FUNC_END(serpent_dec_blk_4way)