VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.1f/crypto/genasm-nasm/keccak1600-x86_64.S@ 83531

Last change on this file since 83531 was 83531, checked in by vboxsync, 5 years ago

setting svn:sync-process=export for openssl-1.1.1f, all files except tests

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