Skip to content
Snippets Groups Projects
Commit 699e6816 authored by Niels Möller's avatar Niels Möller
Browse files

* x86/aes-decrypt.asm (aes_decrypt): Use the AES_LOAD macro.

(aes_decrypt): Start using AES_ROUND.

Rev: src/nettle/x86/aes-decrypt.asm:1.4
parent 27e90cc8
Branches
Tags
No related merge requests found
...@@ -48,27 +48,8 @@ aes_decrypt: ...@@ -48,27 +48,8 @@ aes_decrypt:
AES_LOAD(%esi, %ebp) AES_LOAD(%esi, %ebp)
addl $16, 32(%esp) C Increment src pointer addl $16, 32(%esp) C Increment src pointer
C movl 32(%esp),%esi C address of ciphertext C get number of rounds to do from struct
C movl (%esi),%eax C load ciphertext into registers movl AES_NROUNDS (%esi),%ebp
C movl 4(%esi),%ebx
C movl 8(%esi),%ecx
C movl 12(%esi),%edx
C
C addl $16, 32(%esp) C Increment src pointer
C
C movl 20(%esp),%esi C address of context struct ctx
C xorl (%esi),%eax C add first key to ciphertext
C xorl 4(%esi),%ebx
C xorl 8(%esi),%ecx
C xorl 12(%esi),%edx
movl AES_NROUNDS (%esi),%ebp C get number of rounds to do from struct
C shll $4,%ebp
C leal 240(%esi, %ebp),%esi
C shrl $4,%ebp
C xorl (%esi),%eax C add last key to ciphertext
C xorl 4(%esi),%ebx
C xorl 8(%esi),%ecx
C xorl 12(%esi),%edx
subl $1,%ebp C one round is complete subl $1,%ebp C one round is complete
addl $16,%esi C point to next key addl $16,%esi C point to next key
...@@ -78,24 +59,25 @@ C xorl 12(%esi),%edx ...@@ -78,24 +59,25 @@ C xorl 12(%esi),%edx
C Why??? C Why???
xchgl %ebx,%edx xchgl %ebx,%edx
C // First column C First column
C a b c d AES_ROUND(_aes_decrypt_table,a,b,c,d)
movl %eax,%esi C copy first in C C a b c d
andl $0x000000ff,%esi C clear all but offset C movl %eax,%esi C copy first in
shll $2,%esi C index in itbl1 C andl $0x000000ff,%esi C clear all but offset
movl AES_TABLE0 + _aes_decrypt_table (%esi),%edi C shll $2,%esi C index in itbl1
movl %ebx,%esi C second one C movl AES_TABLE0 + _aes_decrypt_table (%esi),%edi
shrl $6,%esi C movl %ebx,%esi C second one
andl $0x000003fc,%esi C clear all but offset bytes C shrl $6,%esi
xorl AES_TABLE1 + _aes_decrypt_table (%esi),%edi C andl $0x000003fc,%esi C clear all but offset bytes
movl %ecx,%esi C third one C xorl AES_TABLE1 + _aes_decrypt_table (%esi),%edi
shrl $14,%esi C movl %ecx,%esi C third one
andl $0x000003fc,%esi C shrl $14,%esi
xorl AES_TABLE2 + _aes_decrypt_table (%esi),%edi C andl $0x000003fc,%esi
movl %edx,%esi C fourth one C xorl AES_TABLE2 + _aes_decrypt_table (%esi),%edi
shrl $22,%esi C movl %edx,%esi C fourth one
andl $0x000003fc,%esi C shrl $22,%esi
xorl AES_TABLE3 + _aes_decrypt_table (%esi),%edi C andl $0x000003fc,%esi
C xorl AES_TABLE3 + _aes_decrypt_table (%esi),%edi
pushl %edi C save first on stack pushl %edi C save first on stack
C // Second column C // Second column
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment