summaryrefslogtreecommitdiff
path: root/lib/libcrypto
diff options
context:
space:
mode:
authoritojun <itojun@NetBSD.org>2003-11-13 19:36:31 +0000
committeritojun <itojun@NetBSD.org>2003-11-13 19:36:31 +0000
commit08cbee504fbec5bbbc86fe643766497d0f3f4c0b (patch)
treec8ca676e81ccf092ac2d003cff35cf1c67c2fba7 /lib/libcrypto
parent302df7965a78f434d182227c31d67fb5ef227a21 (diff)
avoid bswapl, which is post-i486 (including i486) insn. markus@openbsd
Diffstat (limited to 'lib/libcrypto')
-rw-r--r--lib/libcrypto/arch/i386/sha1_586.S98
1 files changed, 65 insertions, 33 deletions
diff --git a/lib/libcrypto/arch/i386/sha1_586.S b/lib/libcrypto/arch/i386/sha1_586.S
index 4b3967ea1f2..c8d7fb84f2e 100644
--- a/lib/libcrypto/arch/i386/sha1_586.S
+++ b/lib/libcrypto/arch/i386/sha1_586.S
@@ -1,4 +1,4 @@
-/* $NetBSD: sha1_586.S,v 1.1 2003/11/13 02:10:00 itojun Exp $ */
+/* $NetBSD: sha1_586.S,v 1.2 2003/11/13 19:36:31 itojun Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
@@ -85,66 +85,98 @@ L000start:
/* First, load the words onto the stack in network byte order */
movl (%esi), %eax
movl 4(%esi), %ecx
-.byte 15
-.byte 200 /* bswapl %eax */
-.byte 15
-.byte 201 /* bswapl %ecx */
+ /* bswapl eax */
+ xchg %al, %ah
+ rorl $16, %eax
+ xchg %al, %ah
+ /* bswapl ecx */
+ xchg %cl, %ch
+ rorl $16, %ecx
+ xchg %cl, %ch
movl %eax, (%esp)
movl %ecx, 4(%esp)
movl 8(%esi), %eax
movl 12(%esi), %ecx
-.byte 15
-.byte 200 /* bswapl %eax */
-.byte 15
-.byte 201 /* bswapl %ecx */
+ /* bswapl eax */
+ xchg %al, %ah
+ rorl $16, %eax
+ xchg %al, %ah
+ /* bswapl ecx */
+ xchg %cl, %ch
+ rorl $16, %ecx
+ xchg %cl, %ch
movl %eax, 8(%esp)
movl %ecx, 12(%esp)
movl 16(%esi), %eax
movl 20(%esi), %ecx
-.byte 15
-.byte 200 /* bswapl %eax */
-.byte 15
-.byte 201 /* bswapl %ecx */
+ /* bswapl eax */
+ xchg %al, %ah
+ rorl $16, %eax
+ xchg %al, %ah
+ /* bswapl ecx */
+ xchg %cl, %ch
+ rorl $16, %ecx
+ xchg %cl, %ch
movl %eax, 16(%esp)
movl %ecx, 20(%esp)
movl 24(%esi), %eax
movl 28(%esi), %ecx
-.byte 15
-.byte 200 /* bswapl %eax */
-.byte 15
-.byte 201 /* bswapl %ecx */
+ /* bswapl eax */
+ xchg %al, %ah
+ rorl $16, %eax
+ xchg %al, %ah
+ /* bswapl ecx */
+ xchg %cl, %ch
+ rorl $16, %ecx
+ xchg %cl, %ch
movl %eax, 24(%esp)
movl %ecx, 28(%esp)
movl 32(%esi), %eax
movl 36(%esi), %ecx
-.byte 15
-.byte 200 /* bswapl %eax */
-.byte 15
-.byte 201 /* bswapl %ecx */
+ /* bswapl eax */
+ xchg %al, %ah
+ rorl $16, %eax
+ xchg %al, %ah
+ /* bswapl ecx */
+ xchg %cl, %ch
+ rorl $16, %ecx
+ xchg %cl, %ch
movl %eax, 32(%esp)
movl %ecx, 36(%esp)
movl 40(%esi), %eax
movl 44(%esi), %ecx
-.byte 15
-.byte 200 /* bswapl %eax */
-.byte 15
-.byte 201 /* bswapl %ecx */
+ /* bswapl eax */
+ xchg %al, %ah
+ rorl $16, %eax
+ xchg %al, %ah
+ /* bswapl ecx */
+ xchg %cl, %ch
+ rorl $16, %ecx
+ xchg %cl, %ch
movl %eax, 40(%esp)
movl %ecx, 44(%esp)
movl 48(%esi), %eax
movl 52(%esi), %ecx
-.byte 15
-.byte 200 /* bswapl %eax */
-.byte 15
-.byte 201 /* bswapl %ecx */
+ /* bswapl eax */
+ xchg %al, %ah
+ rorl $16, %eax
+ xchg %al, %ah
+ /* bswapl ecx */
+ xchg %cl, %ch
+ rorl $16, %ecx
+ xchg %cl, %ch
movl %eax, 48(%esp)
movl %ecx, 52(%esp)
movl 56(%esi), %eax
movl 60(%esi), %ecx
-.byte 15
-.byte 200 /* bswapl %eax */
-.byte 15
-.byte 201 /* bswapl %ecx */
+ /* bswapl eax */
+ xchg %al, %ah
+ rorl $16, %eax
+ xchg %al, %ah
+ /* bswapl ecx */
+ xchg %cl, %ch
+ rorl $16, %ecx
+ xchg %cl, %ch
movl %eax, 56(%esp)
movl %ecx, 60(%esp)
/* We now have the X array on the stack */