summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rc5/asm/r586unix.cpp
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>1998-10-05 20:13:17 +0000
committercvs2svn <admin@example.com>1998-10-05 20:13:17 +0000
commite82f18fab47b698d93971f576f962a3068132912 (patch)
tree681519717892864935c3d0533cf171098afa649a /src/lib/libcrypto/rc5/asm/r586unix.cpp
parent536c76cbb863bab152f19842ab88772c01e922c7 (diff)
downloadopenbsd-SSLeay_0_9_0b.tar.gz
openbsd-SSLeay_0_9_0b.tar.bz2
openbsd-SSLeay_0_9_0b.zip
This commit was manufactured by cvs2git to create tag 'SSLeay_0_9_0b'.SSLeay_0_9_0b
Diffstat (limited to 'src/lib/libcrypto/rc5/asm/r586unix.cpp')
-rw-r--r--src/lib/libcrypto/rc5/asm/r586unix.cpp628
1 files changed, 628 insertions, 0 deletions
diff --git a/src/lib/libcrypto/rc5/asm/r586unix.cpp b/src/lib/libcrypto/rc5/asm/r586unix.cpp
new file mode 100644
index 0000000000..a25dd5a9a4
--- /dev/null
+++ b/src/lib/libcrypto/rc5/asm/r586unix.cpp
@@ -0,0 +1,628 @@
1/* Run the C pre-processor over this file with one of the following defined
2 * ELF - elf object files,
3 * OUT - a.out object files,
4 * BSDI - BSDI style a.out object files
5 * SOL - Solaris style elf
6 */
7
8#define TYPE(a,b) .type a,b
9#define SIZE(a,b) .size a,b
10
11#if defined(OUT) || defined(BSDI)
12#define RC5_32_encrypt _RC5_32_encrypt
13#define RC5_32_decrypt _RC5_32_decrypt
14#define RC5_32_cbc_encrypt _RC5_32_cbc_encrypt
15
16#endif
17
18#ifdef OUT
19#define OK 1
20#define ALIGN 4
21#endif
22
23#ifdef BSDI
24#define OK 1
25#define ALIGN 4
26#undef SIZE
27#undef TYPE
28#define SIZE(a,b)
29#define TYPE(a,b)
30#endif
31
32#if defined(ELF) || defined(SOL)
33#define OK 1
34#define ALIGN 16
35#endif
36
37#ifndef OK
38You need to define one of
39ELF - elf systems - linux-elf, NetBSD and DG-UX
40OUT - a.out systems - linux-a.out and FreeBSD
41SOL - solaris systems, which are elf with strange comment lines
42BSDI - a.out with a very primative version of as.
43#endif
44
45/* Let the Assembler begin :-) */
46 /* Don't even think of reading this code */
47 /* It was automatically generated by rc5-586.pl */
48 /* Which is a perl program used to generate the x86 assember for */
49 /* any of elf, a.out, BSDI,Win32, or Solaris */
50 /* eric <eay@cryptsoft.com> */
51
52 .file "rc5-586.s"
53 .version "01.01"
54gcc2_compiled.:
55.text
56 .align ALIGN
57.globl RC5_32_encrypt
58 TYPE(RC5_32_encrypt,@function)
59RC5_32_encrypt:
60
61 pushl %ebp
62 pushl %esi
63 pushl %edi
64 movl 16(%esp), %edx
65 movl 20(%esp), %ebp
66 /* Load the 2 words */
67 movl (%edx), %edi
68 movl 4(%edx), %esi
69 pushl %ebx
70 movl (%ebp), %ebx
71 addl 4(%ebp), %edi
72 addl 8(%ebp), %esi
73 xorl %esi, %edi
74 movl 12(%ebp), %eax
75 movl %esi, %ecx
76 roll %cl, %edi
77 addl %eax, %edi
78 xorl %edi, %esi
79 movl 16(%ebp), %eax
80 movl %edi, %ecx
81 roll %cl, %esi
82 addl %eax, %esi
83 xorl %esi, %edi
84 movl 20(%ebp), %eax
85 movl %esi, %ecx
86 roll %cl, %edi
87 addl %eax, %edi
88 xorl %edi, %esi
89 movl 24(%ebp), %eax
90 movl %edi, %ecx
91 roll %cl, %esi
92 addl %eax, %esi
93 xorl %esi, %edi
94 movl 28(%ebp), %eax
95 movl %esi, %ecx
96 roll %cl, %edi
97 addl %eax, %edi
98 xorl %edi, %esi
99 movl 32(%ebp), %eax
100 movl %edi, %ecx
101 roll %cl, %esi
102 addl %eax, %esi
103 xorl %esi, %edi
104 movl 36(%ebp), %eax
105 movl %esi, %ecx
106 roll %cl, %edi
107 addl %eax, %edi
108 xorl %edi, %esi
109 movl 40(%ebp), %eax
110 movl %edi, %ecx
111 roll %cl, %esi
112 addl %eax, %esi
113 xorl %esi, %edi
114 movl 44(%ebp), %eax
115 movl %esi, %ecx
116 roll %cl, %edi
117 addl %eax, %edi
118 xorl %edi, %esi
119 movl 48(%ebp), %eax
120 movl %edi, %ecx
121 roll %cl, %esi
122 addl %eax, %esi
123 xorl %esi, %edi
124 movl 52(%ebp), %eax
125 movl %esi, %ecx
126 roll %cl, %edi
127 addl %eax, %edi
128 xorl %edi, %esi
129 movl 56(%ebp), %eax
130 movl %edi, %ecx
131 roll %cl, %esi
132 addl %eax, %esi
133 xorl %esi, %edi
134 movl 60(%ebp), %eax
135 movl %esi, %ecx
136 roll %cl, %edi
137 addl %eax, %edi
138 xorl %edi, %esi
139 movl 64(%ebp), %eax
140 movl %edi, %ecx
141 roll %cl, %esi
142 addl %eax, %esi
143 xorl %esi, %edi
144 movl 68(%ebp), %eax
145 movl %esi, %ecx
146 roll %cl, %edi
147 addl %eax, %edi
148 xorl %edi, %esi
149 movl 72(%ebp), %eax
150 movl %edi, %ecx
151 roll %cl, %esi
152 addl %eax, %esi
153 cmpl $8, %ebx
154 je .L000rc5_exit
155 xorl %esi, %edi
156 movl 76(%ebp), %eax
157 movl %esi, %ecx
158 roll %cl, %edi
159 addl %eax, %edi
160 xorl %edi, %esi
161 movl 80(%ebp), %eax
162 movl %edi, %ecx
163 roll %cl, %esi
164 addl %eax, %esi
165 xorl %esi, %edi
166 movl 84(%ebp), %eax
167 movl %esi, %ecx
168 roll %cl, %edi
169 addl %eax, %edi
170 xorl %edi, %esi
171 movl 88(%ebp), %eax
172 movl %edi, %ecx
173 roll %cl, %esi
174 addl %eax, %esi
175 xorl %esi, %edi
176 movl 92(%ebp), %eax
177 movl %esi, %ecx
178 roll %cl, %edi
179 addl %eax, %edi
180 xorl %edi, %esi
181 movl 96(%ebp), %eax
182 movl %edi, %ecx
183 roll %cl, %esi
184 addl %eax, %esi
185 xorl %esi, %edi
186 movl 100(%ebp), %eax
187 movl %esi, %ecx
188 roll %cl, %edi
189 addl %eax, %edi
190 xorl %edi, %esi
191 movl 104(%ebp), %eax
192 movl %edi, %ecx
193 roll %cl, %esi
194 addl %eax, %esi
195 cmpl $12, %ebx
196 je .L000rc5_exit
197 xorl %esi, %edi
198 movl 108(%ebp), %eax
199 movl %esi, %ecx
200 roll %cl, %edi
201 addl %eax, %edi
202 xorl %edi, %esi
203 movl 112(%ebp), %eax
204 movl %edi, %ecx
205 roll %cl, %esi
206 addl %eax, %esi
207 xorl %esi, %edi
208 movl 116(%ebp), %eax
209 movl %esi, %ecx
210 roll %cl, %edi
211 addl %eax, %edi
212 xorl %edi, %esi
213 movl 120(%ebp), %eax
214 movl %edi, %ecx
215 roll %cl, %esi
216 addl %eax, %esi
217 xorl %esi, %edi
218 movl 124(%ebp), %eax
219 movl %esi, %ecx
220 roll %cl, %edi
221 addl %eax, %edi
222 xorl %edi, %esi
223 movl 128(%ebp), %eax
224 movl %edi, %ecx
225 roll %cl, %esi
226 addl %eax, %esi
227 xorl %esi, %edi
228 movl 132(%ebp), %eax
229 movl %esi, %ecx
230 roll %cl, %edi
231 addl %eax, %edi
232 xorl %edi, %esi
233 movl 136(%ebp), %eax
234 movl %edi, %ecx
235 roll %cl, %esi
236 addl %eax, %esi
237.L000rc5_exit:
238 movl %edi, (%edx)
239 movl %esi, 4(%edx)
240 popl %ebx
241 popl %edi
242 popl %esi
243 popl %ebp
244 ret
245.RC5_32_encrypt_end:
246 SIZE(RC5_32_encrypt,.RC5_32_encrypt_end-RC5_32_encrypt)
247.ident "desasm.pl"
248.text
249 .align ALIGN
250.globl RC5_32_decrypt
251 TYPE(RC5_32_decrypt,@function)
252RC5_32_decrypt:
253
254 pushl %ebp
255 pushl %esi
256 pushl %edi
257 movl 16(%esp), %edx
258 movl 20(%esp), %ebp
259 /* Load the 2 words */
260 movl (%edx), %edi
261 movl 4(%edx), %esi
262 pushl %ebx
263 movl (%ebp), %ebx
264 cmpl $12, %ebx
265 je .L001rc5_dec_12
266 cmpl $8, %ebx
267 je .L002rc5_dec_8
268 movl 136(%ebp), %eax
269 subl %eax, %esi
270 movl %edi, %ecx
271 rorl %cl, %esi
272 xorl %edi, %esi
273 movl 132(%ebp), %eax
274 subl %eax, %edi
275 movl %esi, %ecx
276 rorl %cl, %edi
277 xorl %esi, %edi
278 movl 128(%ebp), %eax
279 subl %eax, %esi
280 movl %edi, %ecx
281 rorl %cl, %esi
282 xorl %edi, %esi
283 movl 124(%ebp), %eax
284 subl %eax, %edi
285 movl %esi, %ecx
286 rorl %cl, %edi
287 xorl %esi, %edi
288 movl 120(%ebp), %eax
289 subl %eax, %esi
290 movl %edi, %ecx
291 rorl %cl, %esi
292 xorl %edi, %esi
293 movl 116(%ebp), %eax
294 subl %eax, %edi
295 movl %esi, %ecx
296 rorl %cl, %edi
297 xorl %esi, %edi
298 movl 112(%ebp), %eax
299 subl %eax, %esi
300 movl %edi, %ecx
301 rorl %cl, %esi
302 xorl %edi, %esi
303 movl 108(%ebp), %eax
304 subl %eax, %edi
305 movl %esi, %ecx
306 rorl %cl, %edi
307 xorl %esi, %edi
308.L001rc5_dec_12:
309 movl 104(%ebp), %eax
310 subl %eax, %esi
311 movl %edi, %ecx
312 rorl %cl, %esi
313 xorl %edi, %esi
314 movl 100(%ebp), %eax
315 subl %eax, %edi
316 movl %esi, %ecx
317 rorl %cl, %edi
318 xorl %esi, %edi
319 movl 96(%ebp), %eax
320 subl %eax, %esi
321 movl %edi, %ecx
322 rorl %cl, %esi
323 xorl %edi, %esi
324 movl 92(%ebp), %eax
325 subl %eax, %edi
326 movl %esi, %ecx
327 rorl %cl, %edi
328 xorl %esi, %edi
329 movl 88(%ebp), %eax
330 subl %eax, %esi
331 movl %edi, %ecx
332 rorl %cl, %esi
333 xorl %edi, %esi
334 movl 84(%ebp), %eax
335 subl %eax, %edi
336 movl %esi, %ecx
337 rorl %cl, %edi
338 xorl %esi, %edi
339 movl 80(%ebp), %eax
340 subl %eax, %esi
341 movl %edi, %ecx
342 rorl %cl, %esi
343 xorl %edi, %esi
344 movl 76(%ebp), %eax
345 subl %eax, %edi
346 movl %esi, %ecx
347 rorl %cl, %edi
348 xorl %esi, %edi
349.L002rc5_dec_8:
350 movl 72(%ebp), %eax
351 subl %eax, %esi
352 movl %edi, %ecx
353 rorl %cl, %esi
354 xorl %edi, %esi
355 movl 68(%ebp), %eax
356 subl %eax, %edi
357 movl %esi, %ecx
358 rorl %cl, %edi
359 xorl %esi, %edi
360 movl 64(%ebp), %eax
361 subl %eax, %esi
362 movl %edi, %ecx
363 rorl %cl, %esi
364 xorl %edi, %esi
365 movl 60(%ebp), %eax
366 subl %eax, %edi
367 movl %esi, %ecx
368 rorl %cl, %edi
369 xorl %esi, %edi
370 movl 56(%ebp), %eax
371 subl %eax, %esi
372 movl %edi, %ecx
373 rorl %cl, %esi
374 xorl %edi, %esi
375 movl 52(%ebp), %eax
376 subl %eax, %edi
377 movl %esi, %ecx
378 rorl %cl, %edi
379 xorl %esi, %edi
380 movl 48(%ebp), %eax
381 subl %eax, %esi
382 movl %edi, %ecx
383 rorl %cl, %esi
384 xorl %edi, %esi
385 movl 44(%ebp), %eax
386 subl %eax, %edi
387 movl %esi, %ecx
388 rorl %cl, %edi
389 xorl %esi, %edi
390 movl 40(%ebp), %eax
391 subl %eax, %esi
392 movl %edi, %ecx
393 rorl %cl, %esi
394 xorl %edi, %esi
395 movl 36(%ebp), %eax
396 subl %eax, %edi
397 movl %esi, %ecx
398 rorl %cl, %edi
399 xorl %esi, %edi
400 movl 32(%ebp), %eax
401 subl %eax, %esi
402 movl %edi, %ecx
403 rorl %cl, %esi
404 xorl %edi, %esi
405 movl 28(%ebp), %eax
406 subl %eax, %edi
407 movl %esi, %ecx
408 rorl %cl, %edi
409 xorl %esi, %edi
410 movl 24(%ebp), %eax
411 subl %eax, %esi
412 movl %edi, %ecx
413 rorl %cl, %esi
414 xorl %edi, %esi
415 movl 20(%ebp), %eax
416 subl %eax, %edi
417 movl %esi, %ecx
418 rorl %cl, %edi
419 xorl %esi, %edi
420 movl 16(%ebp), %eax
421 subl %eax, %esi
422 movl %edi, %ecx
423 rorl %cl, %esi
424 xorl %edi, %esi
425 movl 12(%ebp), %eax
426 subl %eax, %edi
427 movl %esi, %ecx
428 rorl %cl, %edi
429 xorl %esi, %edi
430 subl 8(%ebp), %esi
431 subl 4(%ebp), %edi
432.L003rc5_exit:
433 movl %edi, (%edx)
434 movl %esi, 4(%edx)
435 popl %ebx
436 popl %edi
437 popl %esi
438 popl %ebp
439 ret
440.RC5_32_decrypt_end:
441 SIZE(RC5_32_decrypt,.RC5_32_decrypt_end-RC5_32_decrypt)
442.ident "desasm.pl"
443.text
444 .align ALIGN
445.globl RC5_32_cbc_encrypt
446 TYPE(RC5_32_cbc_encrypt,@function)
447RC5_32_cbc_encrypt:
448
449 pushl %ebp
450 pushl %ebx
451 pushl %esi
452 pushl %edi
453 movl 28(%esp), %ebp
454 /* getting iv ptr from parameter 4 */
455 movl 36(%esp), %ebx
456 movl (%ebx), %esi
457 movl 4(%ebx), %edi
458 pushl %edi
459 pushl %esi
460 pushl %edi
461 pushl %esi
462 movl %esp, %ebx
463 movl 36(%esp), %esi
464 movl 40(%esp), %edi
465 /* getting encrypt flag from parameter 5 */
466 movl 56(%esp), %ecx
467 /* get and push parameter 3 */
468 movl 48(%esp), %eax
469 pushl %eax
470 pushl %ebx
471 cmpl $0, %ecx
472 jz .L004decrypt
473 andl $4294967288, %ebp
474 movl 8(%esp), %eax
475 movl 12(%esp), %ebx
476 jz .L005encrypt_finish
477.L006encrypt_loop:
478 movl (%esi), %ecx
479 movl 4(%esi), %edx
480 xorl %ecx, %eax
481 xorl %edx, %ebx
482 movl %eax, 8(%esp)
483 movl %ebx, 12(%esp)
484 call RC5_32_encrypt
485 movl 8(%esp), %eax
486 movl 12(%esp), %ebx
487 movl %eax, (%edi)
488 movl %ebx, 4(%edi)
489 addl $8, %esi
490 addl $8, %edi
491 subl $8, %ebp
492 jnz .L006encrypt_loop
493.L005encrypt_finish:
494 movl 52(%esp), %ebp
495 andl $7, %ebp
496 jz .L007finish
497 xorl %ecx, %ecx
498 xorl %edx, %edx
499 movl .L008cbc_enc_jmp_table(,%ebp,4),%ebp
500 jmp *%ebp
501.L009ej7:
502 movb 6(%esi), %dh
503 sall $8, %edx
504.L010ej6:
505 movb 5(%esi), %dh
506.L011ej5:
507 movb 4(%esi), %dl
508.L012ej4:
509 movl (%esi), %ecx
510 jmp .L013ejend
511.L014ej3:
512 movb 2(%esi), %ch
513 sall $8, %ecx
514.L015ej2:
515 movb 1(%esi), %ch
516.L016ej1:
517 movb (%esi), %cl
518.L013ejend:
519 xorl %ecx, %eax
520 xorl %edx, %ebx
521 movl %eax, 8(%esp)
522 movl %ebx, 12(%esp)
523 call RC5_32_encrypt
524 movl 8(%esp), %eax
525 movl 12(%esp), %ebx
526 movl %eax, (%edi)
527 movl %ebx, 4(%edi)
528 jmp .L007finish
529.align ALIGN
530.L004decrypt:
531 andl $4294967288, %ebp
532 movl 16(%esp), %eax
533 movl 20(%esp), %ebx
534 jz .L017decrypt_finish
535.L018decrypt_loop:
536 movl (%esi), %eax
537 movl 4(%esi), %ebx
538 movl %eax, 8(%esp)
539 movl %ebx, 12(%esp)
540 call RC5_32_decrypt
541 movl 8(%esp), %eax
542 movl 12(%esp), %ebx
543 movl 16(%esp), %ecx
544 movl 20(%esp), %edx
545 xorl %eax, %ecx
546 xorl %ebx, %edx
547 movl (%esi), %eax
548 movl 4(%esi), %ebx
549 movl %ecx, (%edi)
550 movl %edx, 4(%edi)
551 movl %eax, 16(%esp)
552 movl %ebx, 20(%esp)
553 addl $8, %esi
554 addl $8, %edi
555 subl $8, %ebp
556 jnz .L018decrypt_loop
557.L017decrypt_finish:
558 movl 52(%esp), %ebp
559 andl $7, %ebp
560 jz .L007finish
561 movl (%esi), %eax
562 movl 4(%esi), %ebx
563 movl %eax, 8(%esp)
564 movl %ebx, 12(%esp)
565 call RC5_32_decrypt
566 movl 8(%esp), %eax
567 movl 12(%esp), %ebx
568 movl 16(%esp), %ecx
569 movl 20(%esp), %edx
570 xorl %eax, %ecx
571 xorl %ebx, %edx
572 movl (%esi), %eax
573 movl 4(%esi), %ebx
574.L019dj7:
575 rorl $16, %edx
576 movb %dl, 6(%edi)
577 shrl $16, %edx
578.L020dj6:
579 movb %dh, 5(%edi)
580.L021dj5:
581 movb %dl, 4(%edi)
582.L022dj4:
583 movl %ecx, (%edi)
584 jmp .L023djend
585.L024dj3:
586 rorl $16, %ecx
587 movb %cl, 2(%edi)
588 sall $16, %ecx
589.L025dj2:
590 movb %ch, 1(%esi)
591.L026dj1:
592 movb %cl, (%esi)
593.L023djend:
594 jmp .L007finish
595.align ALIGN
596.L007finish:
597 movl 60(%esp), %ecx
598 addl $24, %esp
599 movl %eax, (%ecx)
600 movl %ebx, 4(%ecx)
601 popl %edi
602 popl %esi
603 popl %ebx
604 popl %ebp
605 ret
606.align ALIGN
607.L008cbc_enc_jmp_table:
608 .long 0
609 .long .L016ej1
610 .long .L015ej2
611 .long .L014ej3
612 .long .L012ej4
613 .long .L011ej5
614 .long .L010ej6
615 .long .L009ej7
616.align ALIGN
617.L027cbc_dec_jmp_table:
618 .long 0
619 .long .L026dj1
620 .long .L025dj2
621 .long .L024dj3
622 .long .L022dj4
623 .long .L021dj5
624 .long .L020dj6
625 .long .L019dj7
626.RC5_32_cbc_encrypt_end:
627 SIZE(RC5_32_cbc_encrypt,.RC5_32_cbc_encrypt_end-RC5_32_cbc_encrypt)
628.ident "desasm.pl"