keccak1600-x86_64.s 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. .text
  2. .type __KeccakF1600,@function
  3. .align 32
  4. __KeccakF1600:
  5. .cfi_startproc
  6. movq 60(%rdi),%rax
  7. movq 68(%rdi),%rbx
  8. movq 76(%rdi),%rcx
  9. movq 84(%rdi),%rdx
  10. movq 92(%rdi),%rbp
  11. jmp .Loop
  12. .align 32
  13. .Loop:
  14. movq -100(%rdi),%r8
  15. movq -52(%rdi),%r9
  16. movq -4(%rdi),%r10
  17. movq 44(%rdi),%r11
  18. xorq -84(%rdi),%rcx
  19. xorq -76(%rdi),%rdx
  20. xorq %r8,%rax
  21. xorq -92(%rdi),%rbx
  22. xorq -44(%rdi),%rcx
  23. xorq -60(%rdi),%rax
  24. movq %rbp,%r12
  25. xorq -68(%rdi),%rbp
  26. xorq %r10,%rcx
  27. xorq -20(%rdi),%rax
  28. xorq -36(%rdi),%rdx
  29. xorq %r9,%rbx
  30. xorq -28(%rdi),%rbp
  31. xorq 36(%rdi),%rcx
  32. xorq 20(%rdi),%rax
  33. xorq 4(%rdi),%rdx
  34. xorq -12(%rdi),%rbx
  35. xorq 12(%rdi),%rbp
  36. movq %rcx,%r13
  37. rolq $1,%rcx
  38. xorq %rax,%rcx
  39. xorq %r11,%rdx
  40. rolq $1,%rax
  41. xorq %rdx,%rax
  42. xorq 28(%rdi),%rbx
  43. rolq $1,%rdx
  44. xorq %rbx,%rdx
  45. xorq 52(%rdi),%rbp
  46. rolq $1,%rbx
  47. xorq %rbp,%rbx
  48. rolq $1,%rbp
  49. xorq %r13,%rbp
  50. xorq %rcx,%r9
  51. xorq %rdx,%r10
  52. rolq $44,%r9
  53. xorq %rbp,%r11
  54. xorq %rax,%r12
  55. rolq $43,%r10
  56. xorq %rbx,%r8
  57. movq %r9,%r13
  58. rolq $21,%r11
  59. orq %r10,%r9
  60. xorq %r8,%r9
  61. rolq $14,%r12
  62. xorq (%r15),%r9
  63. leaq 8(%r15),%r15
  64. movq %r12,%r14
  65. andq %r11,%r12
  66. movq %r9,-100(%rsi)
  67. xorq %r10,%r12
  68. notq %r10
  69. movq %r12,-84(%rsi)
  70. orq %r11,%r10
  71. movq 76(%rdi),%r12
  72. xorq %r13,%r10
  73. movq %r10,-92(%rsi)
  74. andq %r8,%r13
  75. movq -28(%rdi),%r9
  76. xorq %r14,%r13
  77. movq -20(%rdi),%r10
  78. movq %r13,-68(%rsi)
  79. orq %r8,%r14
  80. movq -76(%rdi),%r8
  81. xorq %r11,%r14
  82. movq 28(%rdi),%r11
  83. movq %r14,-76(%rsi)
  84. xorq %rbp,%r8
  85. xorq %rdx,%r12
  86. rolq $28,%r8
  87. xorq %rcx,%r11
  88. xorq %rax,%r9
  89. rolq $61,%r12
  90. rolq $45,%r11
  91. xorq %rbx,%r10
  92. rolq $20,%r9
  93. movq %r8,%r13
  94. orq %r12,%r8
  95. rolq $3,%r10
  96. xorq %r11,%r8
  97. movq %r8,-36(%rsi)
  98. movq %r9,%r14
  99. andq %r13,%r9
  100. movq -92(%rdi),%r8
  101. xorq %r12,%r9
  102. notq %r12
  103. movq %r9,-28(%rsi)
  104. orq %r11,%r12
  105. movq -44(%rdi),%r9
  106. xorq %r10,%r12
  107. movq %r12,-44(%rsi)
  108. andq %r10,%r11
  109. movq 60(%rdi),%r12
  110. xorq %r14,%r11
  111. movq %r11,-52(%rsi)
  112. orq %r10,%r14
  113. movq 4(%rdi),%r10
  114. xorq %r13,%r14
  115. movq 52(%rdi),%r11
  116. movq %r14,-60(%rsi)
  117. xorq %rbp,%r10
  118. xorq %rax,%r11
  119. rolq $25,%r10
  120. xorq %rdx,%r9
  121. rolq $8,%r11
  122. xorq %rbx,%r12
  123. rolq $6,%r9
  124. xorq %rcx,%r8
  125. rolq $18,%r12
  126. movq %r10,%r13
  127. andq %r11,%r10
  128. rolq $1,%r8
  129. notq %r11
  130. xorq %r9,%r10
  131. movq %r10,-12(%rsi)
  132. movq %r12,%r14
  133. andq %r11,%r12
  134. movq -12(%rdi),%r10
  135. xorq %r13,%r12
  136. movq %r12,-4(%rsi)
  137. orq %r9,%r13
  138. movq 84(%rdi),%r12
  139. xorq %r8,%r13
  140. movq %r13,-20(%rsi)
  141. andq %r8,%r9
  142. xorq %r14,%r9
  143. movq %r9,12(%rsi)
  144. orq %r8,%r14
  145. movq -60(%rdi),%r9
  146. xorq %r11,%r14
  147. movq 36(%rdi),%r11
  148. movq %r14,4(%rsi)
  149. movq -68(%rdi),%r8
  150. xorq %rcx,%r10
  151. xorq %rdx,%r11
  152. rolq $10,%r10
  153. xorq %rbx,%r9
  154. rolq $15,%r11
  155. xorq %rbp,%r12
  156. rolq $36,%r9
  157. xorq %rax,%r8
  158. rolq $56,%r12
  159. movq %r10,%r13
  160. orq %r11,%r10
  161. rolq $27,%r8
  162. notq %r11
  163. xorq %r9,%r10
  164. movq %r10,28(%rsi)
  165. movq %r12,%r14
  166. orq %r11,%r12
  167. xorq %r13,%r12
  168. movq %r12,36(%rsi)
  169. andq %r9,%r13
  170. xorq %r8,%r13
  171. movq %r13,20(%rsi)
  172. orq %r8,%r9
  173. xorq %r14,%r9
  174. movq %r9,52(%rsi)
  175. andq %r14,%r8
  176. xorq %r11,%r8
  177. movq %r8,44(%rsi)
  178. xorq -84(%rdi),%rdx
  179. xorq -36(%rdi),%rbp
  180. rolq $62,%rdx
  181. xorq 68(%rdi),%rcx
  182. rolq $55,%rbp
  183. xorq 12(%rdi),%rax
  184. rolq $2,%rcx
  185. xorq 20(%rdi),%rbx
  186. xchgq %rsi,%rdi
  187. rolq $39,%rax
  188. rolq $41,%rbx
  189. movq %rdx,%r13
  190. andq %rbp,%rdx
  191. notq %rbp
  192. xorq %rcx,%rdx
  193. movq %rdx,92(%rdi)
  194. movq %rax,%r14
  195. andq %rbp,%rax
  196. xorq %r13,%rax
  197. movq %rax,60(%rdi)
  198. orq %rcx,%r13
  199. xorq %rbx,%r13
  200. movq %r13,84(%rdi)
  201. andq %rbx,%rcx
  202. xorq %r14,%rcx
  203. movq %rcx,76(%rdi)
  204. orq %r14,%rbx
  205. xorq %rbp,%rbx
  206. movq %rbx,68(%rdi)
  207. movq %rdx,%rbp
  208. movq %r13,%rdx
  209. testq $255,%r15
  210. jnz .Loop
  211. leaq -192(%r15),%r15
  212. .byte 0xf3,0xc3
  213. .cfi_endproc
  214. .size __KeccakF1600,.-__KeccakF1600
  215. .type KeccakF1600,@function
  216. .align 32
  217. KeccakF1600:
  218. .cfi_startproc
  219. pushq %rbx
  220. .cfi_adjust_cfa_offset 8
  221. .cfi_offset %rbx,-16
  222. pushq %rbp
  223. .cfi_adjust_cfa_offset 8
  224. .cfi_offset %rbp,-24
  225. pushq %r12
  226. .cfi_adjust_cfa_offset 8
  227. .cfi_offset %r12,-32
  228. pushq %r13
  229. .cfi_adjust_cfa_offset 8
  230. .cfi_offset %r13,-40
  231. pushq %r14
  232. .cfi_adjust_cfa_offset 8
  233. .cfi_offset %r14,-48
  234. pushq %r15
  235. .cfi_adjust_cfa_offset 8
  236. .cfi_offset %r15,-56
  237. leaq 100(%rdi),%rdi
  238. subq $200,%rsp
  239. .cfi_adjust_cfa_offset 200
  240. notq -92(%rdi)
  241. notq -84(%rdi)
  242. notq -36(%rdi)
  243. notq -4(%rdi)
  244. notq 36(%rdi)
  245. notq 60(%rdi)
  246. leaq iotas(%rip),%r15
  247. leaq 100(%rsp),%rsi
  248. call __KeccakF1600
  249. notq -92(%rdi)
  250. notq -84(%rdi)
  251. notq -36(%rdi)
  252. notq -4(%rdi)
  253. notq 36(%rdi)
  254. notq 60(%rdi)
  255. leaq -100(%rdi),%rdi
  256. addq $200,%rsp
  257. .cfi_adjust_cfa_offset -200
  258. popq %r15
  259. .cfi_adjust_cfa_offset -8
  260. .cfi_restore %r15
  261. popq %r14
  262. .cfi_adjust_cfa_offset -8
  263. .cfi_restore %r14
  264. popq %r13
  265. .cfi_adjust_cfa_offset -8
  266. .cfi_restore %r13
  267. popq %r12
  268. .cfi_adjust_cfa_offset -8
  269. .cfi_restore %r12
  270. popq %rbp
  271. .cfi_adjust_cfa_offset -8
  272. .cfi_restore %rbp
  273. popq %rbx
  274. .cfi_adjust_cfa_offset -8
  275. .cfi_restore %rbx
  276. .byte 0xf3,0xc3
  277. .cfi_endproc
  278. .size KeccakF1600,.-KeccakF1600
  279. .globl SHA3_absorb
  280. .type SHA3_absorb,@function
  281. .align 32
  282. SHA3_absorb:
  283. .cfi_startproc
  284. pushq %rbx
  285. .cfi_adjust_cfa_offset 8
  286. .cfi_offset %rbx,-16
  287. pushq %rbp
  288. .cfi_adjust_cfa_offset 8
  289. .cfi_offset %rbp,-24
  290. pushq %r12
  291. .cfi_adjust_cfa_offset 8
  292. .cfi_offset %r12,-32
  293. pushq %r13
  294. .cfi_adjust_cfa_offset 8
  295. .cfi_offset %r13,-40
  296. pushq %r14
  297. .cfi_adjust_cfa_offset 8
  298. .cfi_offset %r14,-48
  299. pushq %r15
  300. .cfi_adjust_cfa_offset 8
  301. .cfi_offset %r15,-56
  302. leaq 100(%rdi),%rdi
  303. subq $232,%rsp
  304. .cfi_adjust_cfa_offset 232
  305. movq %rsi,%r9
  306. leaq 100(%rsp),%rsi
  307. notq -92(%rdi)
  308. notq -84(%rdi)
  309. notq -36(%rdi)
  310. notq -4(%rdi)
  311. notq 36(%rdi)
  312. notq 60(%rdi)
  313. leaq iotas(%rip),%r15
  314. movq %rcx,216-100(%rsi)
  315. .Loop_absorb:
  316. cmpq %rcx,%rdx
  317. jc .Ldone_absorb
  318. shrq $3,%rcx
  319. leaq -100(%rdi),%r8
  320. .Lblock_absorb:
  321. movq (%r9),%rax
  322. leaq 8(%r9),%r9
  323. xorq (%r8),%rax
  324. leaq 8(%r8),%r8
  325. subq $8,%rdx
  326. movq %rax,-8(%r8)
  327. subq $1,%rcx
  328. jnz .Lblock_absorb
  329. movq %r9,200-100(%rsi)
  330. movq %rdx,208-100(%rsi)
  331. call __KeccakF1600
  332. movq 200-100(%rsi),%r9
  333. movq 208-100(%rsi),%rdx
  334. movq 216-100(%rsi),%rcx
  335. jmp .Loop_absorb
  336. .align 32
  337. .Ldone_absorb:
  338. movq %rdx,%rax
  339. notq -92(%rdi)
  340. notq -84(%rdi)
  341. notq -36(%rdi)
  342. notq -4(%rdi)
  343. notq 36(%rdi)
  344. notq 60(%rdi)
  345. addq $232,%rsp
  346. .cfi_adjust_cfa_offset -232
  347. popq %r15
  348. .cfi_adjust_cfa_offset -8
  349. .cfi_restore %r15
  350. popq %r14
  351. .cfi_adjust_cfa_offset -8
  352. .cfi_restore %r14
  353. popq %r13
  354. .cfi_adjust_cfa_offset -8
  355. .cfi_restore %r13
  356. popq %r12
  357. .cfi_adjust_cfa_offset -8
  358. .cfi_restore %r12
  359. popq %rbp
  360. .cfi_adjust_cfa_offset -8
  361. .cfi_restore %rbp
  362. popq %rbx
  363. .cfi_adjust_cfa_offset -8
  364. .cfi_restore %rbx
  365. .byte 0xf3,0xc3
  366. .cfi_endproc
  367. .size SHA3_absorb,.-SHA3_absorb
  368. .globl SHA3_squeeze
  369. .type SHA3_squeeze,@function
  370. .align 32
  371. SHA3_squeeze:
  372. .cfi_startproc
  373. pushq %r12
  374. .cfi_adjust_cfa_offset 8
  375. .cfi_offset %r12,-16
  376. pushq %r13
  377. .cfi_adjust_cfa_offset 8
  378. .cfi_offset %r13,-24
  379. pushq %r14
  380. .cfi_adjust_cfa_offset 8
  381. .cfi_offset %r14,-32
  382. shrq $3,%rcx
  383. movq %rdi,%r8
  384. movq %rsi,%r12
  385. movq %rdx,%r13
  386. movq %rcx,%r14
  387. jmp .Loop_squeeze
  388. .align 32
  389. .Loop_squeeze:
  390. cmpq $8,%r13
  391. jb .Ltail_squeeze
  392. movq (%r8),%rax
  393. leaq 8(%r8),%r8
  394. movq %rax,(%r12)
  395. leaq 8(%r12),%r12
  396. subq $8,%r13
  397. jz .Ldone_squeeze
  398. subq $1,%rcx
  399. jnz .Loop_squeeze
  400. call KeccakF1600
  401. movq %rdi,%r8
  402. movq %r14,%rcx
  403. jmp .Loop_squeeze
  404. .Ltail_squeeze:
  405. movq %r8,%rsi
  406. movq %r12,%rdi
  407. movq %r13,%rcx
  408. .byte 0xf3,0xa4
  409. .Ldone_squeeze:
  410. popq %r14
  411. .cfi_adjust_cfa_offset -8
  412. .cfi_restore %r14
  413. popq %r13
  414. .cfi_adjust_cfa_offset -8
  415. .cfi_restore %r13
  416. popq %r12
  417. .cfi_adjust_cfa_offset -8
  418. .cfi_restore %r13
  419. .byte 0xf3,0xc3
  420. .cfi_endproc
  421. .size SHA3_squeeze,.-SHA3_squeeze
  422. .align 256
  423. .quad 0,0,0,0,0,0,0,0
  424. .type iotas,@object
  425. iotas:
  426. .quad 0x0000000000000001
  427. .quad 0x0000000000008082
  428. .quad 0x800000000000808a
  429. .quad 0x8000000080008000
  430. .quad 0x000000000000808b
  431. .quad 0x0000000080000001
  432. .quad 0x8000000080008081
  433. .quad 0x8000000000008009
  434. .quad 0x000000000000008a
  435. .quad 0x0000000000000088
  436. .quad 0x0000000080008009
  437. .quad 0x000000008000000a
  438. .quad 0x000000008000808b
  439. .quad 0x800000000000008b
  440. .quad 0x8000000000008089
  441. .quad 0x8000000000008003
  442. .quad 0x8000000000008002
  443. .quad 0x8000000000000080
  444. .quad 0x000000000000800a
  445. .quad 0x800000008000000a
  446. .quad 0x8000000080008081
  447. .quad 0x8000000000008080
  448. .quad 0x0000000080000001
  449. .quad 0x8000000080008008
  450. .size iotas,.-iotas
  451. .byte 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111,114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0