VirtualBox

source: vbox/trunk/src/libs/openssl-3.1.3/crypto/genasm-macosx/poly1305-x86.S@ 101665

Last change on this file since 101665 was 100980, checked in by vboxsync, 15 months ago

openssl-3.1.0: refenrated asm files for macos. ​bugref:10418

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1.text
2
3
4
5.globl _poly1305_init
6.private_extern _poly1305_init
7.globl _poly1305_blocks
8.private_extern _poly1305_blocks
9.globl _poly1305_emit
10.private_extern _poly1305_emit
11
12
13.p2align 5
14_poly1305_init:
15
16 xorq %rax,%rax
17 movq %rax,0(%rdi)
18 movq %rax,8(%rdi)
19 movq %rax,16(%rdi)
20
21 cmpq $0,%rsi
22 je L$no_key
23
24 leaq _poly1305_blocks(%rip),%r10
25 leaq _poly1305_emit(%rip),%r11
26 movq $0x0ffffffc0fffffff,%rax
27 movq $0x0ffffffc0ffffffc,%rcx
28 andq 0(%rsi),%rax
29 andq 8(%rsi),%rcx
30 movq %rax,24(%rdi)
31 movq %rcx,32(%rdi)
32 movq %r10,0(%rdx)
33 movq %r11,8(%rdx)
34 movl $1,%eax
35L$no_key:
36 .byte 0xf3,0xc3
37
38
39
40
41.p2align 5
42_poly1305_blocks:
43
44L$blocks:
45 shrq $4,%rdx
46 jz L$no_data
47
48 pushq %rbx
49
50 pushq %rbp
51
52 pushq %r12
53
54 pushq %r13
55
56 pushq %r14
57
58 pushq %r15
59
60L$blocks_body:
61
62 movq %rdx,%r15
63
64 movq 24(%rdi),%r11
65 movq 32(%rdi),%r13
66
67 movq 0(%rdi),%r14
68 movq 8(%rdi),%rbx
69 movq 16(%rdi),%rbp
70
71 movq %r13,%r12
72 shrq $2,%r13
73 movq %r12,%rax
74 addq %r12,%r13
75 jmp L$oop
76
77.p2align 5
78L$oop:
79 addq 0(%rsi),%r14
80 adcq 8(%rsi),%rbx
81 leaq 16(%rsi),%rsi
82 adcq %rcx,%rbp
83 mulq %r14
84 movq %rax,%r9
85 movq %r11,%rax
86 movq %rdx,%r10
87
88 mulq %r14
89 movq %rax,%r14
90 movq %r11,%rax
91 movq %rdx,%r8
92
93 mulq %rbx
94 addq %rax,%r9
95 movq %r13,%rax
96 adcq %rdx,%r10
97
98 mulq %rbx
99 movq %rbp,%rbx
100 addq %rax,%r14
101 adcq %rdx,%r8
102
103 imulq %r13,%rbx
104 addq %rbx,%r9
105 movq %r8,%rbx
106 adcq $0,%r10
107
108 imulq %r11,%rbp
109 addq %r9,%rbx
110 movq $-4,%rax
111 adcq %rbp,%r10
112
113 andq %r10,%rax
114 movq %r10,%rbp
115 shrq $2,%r10
116 andq $3,%rbp
117 addq %r10,%rax
118 addq %rax,%r14
119 adcq $0,%rbx
120 adcq $0,%rbp
121 movq %r12,%rax
122 decq %r15
123 jnz L$oop
124
125 movq %r14,0(%rdi)
126 movq %rbx,8(%rdi)
127 movq %rbp,16(%rdi)
128
129 movq 0(%rsp),%r15
130
131 movq 8(%rsp),%r14
132
133 movq 16(%rsp),%r13
134
135 movq 24(%rsp),%r12
136
137 movq 32(%rsp),%rbp
138
139 movq 40(%rsp),%rbx
140
141 leaq 48(%rsp),%rsp
142
143L$no_data:
144L$blocks_epilogue:
145 .byte 0xf3,0xc3
146
147
148
149
150.p2align 5
151_poly1305_emit:
152
153L$emit:
154 movq 0(%rdi),%r8
155 movq 8(%rdi),%r9
156 movq 16(%rdi),%r10
157
158 movq %r8,%rax
159 addq $5,%r8
160 movq %r9,%rcx
161 adcq $0,%r9
162 adcq $0,%r10
163 shrq $2,%r10
164 cmovnzq %r8,%rax
165 cmovnzq %r9,%rcx
166
167 addq 0(%rdx),%rax
168 adcq 8(%rdx),%rcx
169 movq %rax,0(%rsi)
170 movq %rcx,8(%rsi)
171
172 .byte 0xf3,0xc3
173
174
175.byte 80,111,108,121,49,51,48,53,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
176.p2align 4
177.globl _xor128_encrypt_n_pad
178
179.p2align 4
180_xor128_encrypt_n_pad:
181
182 subq %rdx,%rsi
183 subq %rdx,%rdi
184 movq %rcx,%r10
185 shrq $4,%rcx
186 jz L$tail_enc
187 nop
188L$oop_enc_xmm:
189 movdqu (%rsi,%rdx,1),%xmm0
190 pxor (%rdx),%xmm0
191 movdqu %xmm0,(%rdi,%rdx,1)
192 movdqa %xmm0,(%rdx)
193 leaq 16(%rdx),%rdx
194 decq %rcx
195 jnz L$oop_enc_xmm
196
197 andq $15,%r10
198 jz L$done_enc
199
200L$tail_enc:
201 movq $16,%rcx
202 subq %r10,%rcx
203 xorl %eax,%eax
204L$oop_enc_byte:
205 movb (%rsi,%rdx,1),%al
206 xorb (%rdx),%al
207 movb %al,(%rdi,%rdx,1)
208 movb %al,(%rdx)
209 leaq 1(%rdx),%rdx
210 decq %r10
211 jnz L$oop_enc_byte
212
213 xorl %eax,%eax
214L$oop_enc_pad:
215 movb %al,(%rdx)
216 leaq 1(%rdx),%rdx
217 decq %rcx
218 jnz L$oop_enc_pad
219
220L$done_enc:
221 movq %rdx,%rax
222 .byte 0xf3,0xc3
223
224
225
226.globl _xor128_decrypt_n_pad
227
228.p2align 4
229_xor128_decrypt_n_pad:
230
231 subq %rdx,%rsi
232 subq %rdx,%rdi
233 movq %rcx,%r10
234 shrq $4,%rcx
235 jz L$tail_dec
236 nop
237L$oop_dec_xmm:
238 movdqu (%rsi,%rdx,1),%xmm0
239 movdqa (%rdx),%xmm1
240 pxor %xmm0,%xmm1
241 movdqu %xmm1,(%rdi,%rdx,1)
242 movdqa %xmm0,(%rdx)
243 leaq 16(%rdx),%rdx
244 decq %rcx
245 jnz L$oop_dec_xmm
246
247 pxor %xmm1,%xmm1
248 andq $15,%r10
249 jz L$done_dec
250
251L$tail_dec:
252 movq $16,%rcx
253 subq %r10,%rcx
254 xorl %eax,%eax
255 xorq %r11,%r11
256L$oop_dec_byte:
257 movb (%rsi,%rdx,1),%r11b
258 movb (%rdx),%al
259 xorb %r11b,%al
260 movb %al,(%rdi,%rdx,1)
261 movb %r11b,(%rdx)
262 leaq 1(%rdx),%rdx
263 decq %r10
264 jnz L$oop_dec_byte
265
266 xorl %eax,%eax
267L$oop_dec_pad:
268 movb %al,(%rdx)
269 leaq 1(%rdx),%rdx
270 decq %rcx
271 jnz L$oop_dec_pad
272
273L$done_dec:
274 movq %rdx,%rax
275 .byte 0xf3,0xc3
276
277
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