summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm.m49
-rw-r--r--x86/arcfour-crypt.asm8
2 files changed, 13 insertions, 4 deletions
diff --git a/asm.m4 b/asm.m4
index ee2be4fc..99c72c01 100644
--- a/asm.m4
+++ b/asm.m4
@@ -34,9 +34,18 @@ define(<STRUCT>,
<define(SPREFIX<_>$1, SOFFSET)dnl
define(<SOFFSET>, eval(SOFFSET + ($2)))>)dnl
+dnl UCHAR(name)
+define(<UCHAR>, <STRUCT(<$1>, 1)>)dnl
+
dnl UNSIGNED(name)
define(<UNSIGNED>, <STRUCT(<$1>, 4)>)dnl
+dnl Offsets in arcfour_ctx
+STRUCTURE(ARCFOUR)
+ STRUCT(S, 256)
+ UCHAR(I)
+ UCHAR(J)
+
dnl Offsets in aes_ctx and aes_table
STRUCTURE(AES)
STRUCT(KEYS, 4*60)
diff --git a/x86/arcfour-crypt.asm b/x86/arcfour-crypt.asm
index 74a65a94..5c87ff8c 100644
--- a/x86/arcfour-crypt.asm
+++ b/x86/arcfour-crypt.asm
@@ -55,8 +55,8 @@ C Register usage:
movl 32(%esp), %esi
addl %esi, %edx C Keep src + length
- movzbl 256(%ebp), %eax C i
- movzbl 257(%ebp), %ebx C j
+ movzbl ARCFOUR_I (%ebp), %eax C i
+ movzbl ARCFOUR_J (%ebp), %ebx C j
.Lloop:
C incb %al
incl %eax
@@ -80,8 +80,8 @@ C andl $0xff, %ebx
cmpl %esi, %edx
jne .Lloop
- movb %al, 256(%ebp) C Store the new i and j.
- movb %bl, 257(%ebp)
+ movb %al, ARCFOUR_I (%ebp) C Store the new i and j.
+ movb %bl, ARCFOUR_J (%ebp)
.Lend:
popl %edi
popl %esi