VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.7/crypto/genasm-nasm/keccak1600-x86_64.S@ 98024

Last change on this file since 98024 was 94083, checked in by vboxsync, 3 years ago

libs/openssl-3.0.1: Recreate asm files, bugref:10128

File size: 7.1 KB
Line 
1default rel
2%define XMMWORD
3%define YMMWORD
4%define ZMMWORD
5section .text code align=64
6
7
8
9ALIGN 32
10__KeccakF1600:
11
12 mov rax,QWORD[60+rdi]
13 mov rbx,QWORD[68+rdi]
14 mov rcx,QWORD[76+rdi]
15 mov rdx,QWORD[84+rdi]
16 mov rbp,QWORD[92+rdi]
17 jmp NEAR $L$oop
18
19ALIGN 32
20$L$oop:
21 mov r8,QWORD[((-100))+rdi]
22 mov r9,QWORD[((-52))+rdi]
23 mov r10,QWORD[((-4))+rdi]
24 mov r11,QWORD[44+rdi]
25
26 xor rcx,QWORD[((-84))+rdi]
27 xor rdx,QWORD[((-76))+rdi]
28 xor rax,r8
29 xor rbx,QWORD[((-92))+rdi]
30 xor rcx,QWORD[((-44))+rdi]
31 xor rax,QWORD[((-60))+rdi]
32 mov r12,rbp
33 xor rbp,QWORD[((-68))+rdi]
34
35 xor rcx,r10
36 xor rax,QWORD[((-20))+rdi]
37 xor rdx,QWORD[((-36))+rdi]
38 xor rbx,r9
39 xor rbp,QWORD[((-28))+rdi]
40
41 xor rcx,QWORD[36+rdi]
42 xor rax,QWORD[20+rdi]
43 xor rdx,QWORD[4+rdi]
44 xor rbx,QWORD[((-12))+rdi]
45 xor rbp,QWORD[12+rdi]
46
47 mov r13,rcx
48 rol rcx,1
49 xor rcx,rax
50 xor rdx,r11
51
52 rol rax,1
53 xor rax,rdx
54 xor rbx,QWORD[28+rdi]
55
56 rol rdx,1
57 xor rdx,rbx
58 xor rbp,QWORD[52+rdi]
59
60 rol rbx,1
61 xor rbx,rbp
62
63 rol rbp,1
64 xor rbp,r13
65 xor r9,rcx
66 xor r10,rdx
67 rol r9,44
68 xor r11,rbp
69 xor r12,rax
70 rol r10,43
71 xor r8,rbx
72 mov r13,r9
73 rol r11,21
74 or r9,r10
75 xor r9,r8
76 rol r12,14
77
78 xor r9,QWORD[r15]
79 lea r15,[8+r15]
80
81 mov r14,r12
82 and r12,r11
83 mov QWORD[((-100))+rsi],r9
84 xor r12,r10
85 not r10
86 mov QWORD[((-84))+rsi],r12
87
88 or r10,r11
89 mov r12,QWORD[76+rdi]
90 xor r10,r13
91 mov QWORD[((-92))+rsi],r10
92
93 and r13,r8
94 mov r9,QWORD[((-28))+rdi]
95 xor r13,r14
96 mov r10,QWORD[((-20))+rdi]
97 mov QWORD[((-68))+rsi],r13
98
99 or r14,r8
100 mov r8,QWORD[((-76))+rdi]
101 xor r14,r11
102 mov r11,QWORD[28+rdi]
103 mov QWORD[((-76))+rsi],r14
104
105
106 xor r8,rbp
107 xor r12,rdx
108 rol r8,28
109 xor r11,rcx
110 xor r9,rax
111 rol r12,61
112 rol r11,45
113 xor r10,rbx
114 rol r9,20
115 mov r13,r8
116 or r8,r12
117 rol r10,3
118
119 xor r8,r11
120 mov QWORD[((-36))+rsi],r8
121
122 mov r14,r9
123 and r9,r13
124 mov r8,QWORD[((-92))+rdi]
125 xor r9,r12
126 not r12
127 mov QWORD[((-28))+rsi],r9
128
129 or r12,r11
130 mov r9,QWORD[((-44))+rdi]
131 xor r12,r10
132 mov QWORD[((-44))+rsi],r12
133
134 and r11,r10
135 mov r12,QWORD[60+rdi]
136 xor r11,r14
137 mov QWORD[((-52))+rsi],r11
138
139 or r14,r10
140 mov r10,QWORD[4+rdi]
141 xor r14,r13
142 mov r11,QWORD[52+rdi]
143 mov QWORD[((-60))+rsi],r14
144
145
146 xor r10,rbp
147 xor r11,rax
148 rol r10,25
149 xor r9,rdx
150 rol r11,8
151 xor r12,rbx
152 rol r9,6
153 xor r8,rcx
154 rol r12,18
155 mov r13,r10
156 and r10,r11
157 rol r8,1
158
159 not r11
160 xor r10,r9
161 mov QWORD[((-12))+rsi],r10
162
163 mov r14,r12
164 and r12,r11
165 mov r10,QWORD[((-12))+rdi]
166 xor r12,r13
167 mov QWORD[((-4))+rsi],r12
168
169 or r13,r9
170 mov r12,QWORD[84+rdi]
171 xor r13,r8
172 mov QWORD[((-20))+rsi],r13
173
174 and r9,r8
175 xor r9,r14
176 mov QWORD[12+rsi],r9
177
178 or r14,r8
179 mov r9,QWORD[((-60))+rdi]
180 xor r14,r11
181 mov r11,QWORD[36+rdi]
182 mov QWORD[4+rsi],r14
183
184
185 mov r8,QWORD[((-68))+rdi]
186
187 xor r10,rcx
188 xor r11,rdx
189 rol r10,10
190 xor r9,rbx
191 rol r11,15
192 xor r12,rbp
193 rol r9,36
194 xor r8,rax
195 rol r12,56
196 mov r13,r10
197 or r10,r11
198 rol r8,27
199
200 not r11
201 xor r10,r9
202 mov QWORD[28+rsi],r10
203
204 mov r14,r12
205 or r12,r11
206 xor r12,r13
207 mov QWORD[36+rsi],r12
208
209 and r13,r9
210 xor r13,r8
211 mov QWORD[20+rsi],r13
212
213 or r9,r8
214 xor r9,r14
215 mov QWORD[52+rsi],r9
216
217 and r8,r14
218 xor r8,r11
219 mov QWORD[44+rsi],r8
220
221
222 xor rdx,QWORD[((-84))+rdi]
223 xor rbp,QWORD[((-36))+rdi]
224 rol rdx,62
225 xor rcx,QWORD[68+rdi]
226 rol rbp,55
227 xor rax,QWORD[12+rdi]
228 rol rcx,2
229 xor rbx,QWORD[20+rdi]
230 xchg rdi,rsi
231 rol rax,39
232 rol rbx,41
233 mov r13,rdx
234 and rdx,rbp
235 not rbp
236 xor rdx,rcx
237 mov QWORD[92+rdi],rdx
238
239 mov r14,rax
240 and rax,rbp
241 xor rax,r13
242 mov QWORD[60+rdi],rax
243
244 or r13,rcx
245 xor r13,rbx
246 mov QWORD[84+rdi],r13
247
248 and rcx,rbx
249 xor rcx,r14
250 mov QWORD[76+rdi],rcx
251
252 or rbx,r14
253 xor rbx,rbp
254 mov QWORD[68+rdi],rbx
255
256 mov rbp,rdx
257 mov rdx,r13
258
259 test r15,255
260 jnz NEAR $L$oop
261
262 lea r15,[((-192))+r15]
263 DB 0F3h,0C3h ;repret
264
265
266
267
268ALIGN 32
269KeccakF1600:
270
271 push rbx
272
273 push rbp
274
275 push r12
276
277 push r13
278
279 push r14
280
281 push r15
282
283
284 lea rdi,[100+rdi]
285 sub rsp,200
286
287
288 not QWORD[((-92))+rdi]
289 not QWORD[((-84))+rdi]
290 not QWORD[((-36))+rdi]
291 not QWORD[((-4))+rdi]
292 not QWORD[36+rdi]
293 not QWORD[60+rdi]
294
295 lea r15,[iotas]
296 lea rsi,[100+rsp]
297
298 call __KeccakF1600
299
300 not QWORD[((-92))+rdi]
301 not QWORD[((-84))+rdi]
302 not QWORD[((-36))+rdi]
303 not QWORD[((-4))+rdi]
304 not QWORD[36+rdi]
305 not QWORD[60+rdi]
306 lea rdi,[((-100))+rdi]
307
308 add rsp,200
309
310
311 pop r15
312
313 pop r14
314
315 pop r13
316
317 pop r12
318
319 pop rbp
320
321 pop rbx
322
323 DB 0F3h,0C3h ;repret
324
325
326global SHA3_absorb
327
328ALIGN 32
329SHA3_absorb:
330 mov QWORD[8+rsp],rdi ;WIN64 prologue
331 mov QWORD[16+rsp],rsi
332 mov rax,rsp
333$L$SEH_begin_SHA3_absorb:
334 mov rdi,rcx
335 mov rsi,rdx
336 mov rdx,r8
337 mov rcx,r9
338
339
340
341 push rbx
342
343 push rbp
344
345 push r12
346
347 push r13
348
349 push r14
350
351 push r15
352
353
354 lea rdi,[100+rdi]
355 sub rsp,232
356
357
358 mov r9,rsi
359 lea rsi,[100+rsp]
360
361 not QWORD[((-92))+rdi]
362 not QWORD[((-84))+rdi]
363 not QWORD[((-36))+rdi]
364 not QWORD[((-4))+rdi]
365 not QWORD[36+rdi]
366 not QWORD[60+rdi]
367 lea r15,[iotas]
368
369 mov QWORD[((216-100))+rsi],rcx
370
371$L$oop_absorb:
372 cmp rdx,rcx
373 jc NEAR $L$done_absorb
374
375 shr rcx,3
376 lea r8,[((-100))+rdi]
377
378$L$block_absorb:
379 mov rax,QWORD[r9]
380 lea r9,[8+r9]
381 xor rax,QWORD[r8]
382 lea r8,[8+r8]
383 sub rdx,8
384 mov QWORD[((-8))+r8],rax
385 sub rcx,1
386 jnz NEAR $L$block_absorb
387
388 mov QWORD[((200-100))+rsi],r9
389 mov QWORD[((208-100))+rsi],rdx
390 call __KeccakF1600
391 mov r9,QWORD[((200-100))+rsi]
392 mov rdx,QWORD[((208-100))+rsi]
393 mov rcx,QWORD[((216-100))+rsi]
394 jmp NEAR $L$oop_absorb
395
396ALIGN 32
397$L$done_absorb:
398 mov rax,rdx
399
400 not QWORD[((-92))+rdi]
401 not QWORD[((-84))+rdi]
402 not QWORD[((-36))+rdi]
403 not QWORD[((-4))+rdi]
404 not QWORD[36+rdi]
405 not QWORD[60+rdi]
406
407 add rsp,232
408
409
410 pop r15
411
412 pop r14
413
414 pop r13
415
416 pop r12
417
418 pop rbp
419
420 pop rbx
421
422 mov rdi,QWORD[8+rsp] ;WIN64 epilogue
423 mov rsi,QWORD[16+rsp]
424 DB 0F3h,0C3h ;repret
425
426$L$SEH_end_SHA3_absorb:
427global SHA3_squeeze
428
429ALIGN 32
430SHA3_squeeze:
431 mov QWORD[8+rsp],rdi ;WIN64 prologue
432 mov QWORD[16+rsp],rsi
433 mov rax,rsp
434$L$SEH_begin_SHA3_squeeze:
435 mov rdi,rcx
436 mov rsi,rdx
437 mov rdx,r8
438 mov rcx,r9
439
440
441
442 push r12
443
444 push r13
445
446 push r14
447
448
449 shr rcx,3
450 mov r8,rdi
451 mov r12,rsi
452 mov r13,rdx
453 mov r14,rcx
454 jmp NEAR $L$oop_squeeze
455
456ALIGN 32
457$L$oop_squeeze:
458 cmp r13,8
459 jb NEAR $L$tail_squeeze
460
461 mov rax,QWORD[r8]
462 lea r8,[8+r8]
463 mov QWORD[r12],rax
464 lea r12,[8+r12]
465 sub r13,8
466 jz NEAR $L$done_squeeze
467
468 sub rcx,1
469 jnz NEAR $L$oop_squeeze
470
471 call KeccakF1600
472 mov r8,rdi
473 mov rcx,r14
474 jmp NEAR $L$oop_squeeze
475
476$L$tail_squeeze:
477 mov rsi,r8
478 mov rdi,r12
479 mov rcx,r13
480DB 0xf3,0xa4
481
482$L$done_squeeze:
483 pop r14
484
485 pop r13
486
487 pop r12
488
489 mov rdi,QWORD[8+rsp] ;WIN64 epilogue
490 mov rsi,QWORD[16+rsp]
491 DB 0F3h,0C3h ;repret
492
493$L$SEH_end_SHA3_squeeze:
494ALIGN 256
495 DQ 0,0,0,0,0,0,0,0
496
497iotas:
498 DQ 0x0000000000000001
499 DQ 0x0000000000008082
500 DQ 0x800000000000808a
501 DQ 0x8000000080008000
502 DQ 0x000000000000808b
503 DQ 0x0000000080000001
504 DQ 0x8000000080008081
505 DQ 0x8000000000008009
506 DQ 0x000000000000008a
507 DQ 0x0000000000000088
508 DQ 0x0000000080008009
509 DQ 0x000000008000000a
510 DQ 0x000000008000808b
511 DQ 0x800000000000008b
512 DQ 0x8000000000008089
513 DQ 0x8000000000008003
514 DQ 0x8000000000008002
515 DQ 0x8000000000000080
516 DQ 0x000000000000800a
517 DQ 0x800000008000000a
518 DQ 0x8000000080008081
519 DQ 0x8000000000008080
520 DQ 0x0000000080000001
521 DQ 0x8000000080008008
522
523DB 75,101,99,99,97,107,45,49,54,48,48,32,97,98,115,111
524DB 114,98,32,97,110,100,32,115,113,117,101,101,122,101,32,102
525DB 111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84
526DB 79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64
527DB 111,112,101,110,115,115,108,46,111,114,103,62,0
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette