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

(aes_decrypt): Use AES_STORE.

Rev: src/nettle/x86/aes-decrypt.asm:1.11
parent a7f3f302
No related branches found
No related tags found
No related merge requests found
...@@ -40,9 +40,9 @@ aes_decrypt: ...@@ -40,9 +40,9 @@ aes_decrypt:
movl 24(%esp), %ebp movl 24(%esp), %ebp
testl %ebp,%ebp testl %ebp,%ebp
jz .Ldecrypt_end jz .Lend
.Ldecrypt_block_loop: .Lblock_loop:
movl 20(%esp),%esi C address of context struct ctx movl 20(%esp),%esi C address of context struct ctx
movl 32(%esp),%ebp C address of plaintext movl 32(%esp),%ebp C address of plaintext
AES_LOAD(%esi, %ebp) AES_LOAD(%esi, %ebp)
...@@ -53,7 +53,7 @@ aes_decrypt: ...@@ -53,7 +53,7 @@ aes_decrypt:
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
.Ldecrypt_loop: .Lround_loop:
pushl %esi C save this first: we'll clobber it later pushl %esi C save this first: we'll clobber it later
C Why??? C Why???
...@@ -83,7 +83,7 @@ aes_decrypt: ...@@ -83,7 +83,7 @@ aes_decrypt:
xorl 12(%esi),%edx xorl 12(%esi),%edx
addl $16,%esi C point to next key addl $16,%esi C point to next key
decl %ebp decl %ebp
jnz .Ldecrypt_loop jnz .Lround_loop
C Foo? C Foo?
xchgl %ebx,%edx xchgl %ebx,%edx
...@@ -109,29 +109,21 @@ aes_decrypt: ...@@ -109,29 +109,21 @@ aes_decrypt:
C inverse S-box substitution C inverse S-box substitution
mov $4,%edi mov $4,%edi
.Lisubst: .Lsubst:
AES_SUBST_BYTE(_aes_decrypt_table) AES_SUBST_BYTE(_aes_decrypt_table)
decl %edi decl %edi
jnz .Lisubst jnz .Lsubst
xorl (%esi),%eax C add last key to plaintext C Add last subkey, and store encrypted data
xorl 4(%esi),%ebx
xorl 8(%esi),%ecx
xorl 12(%esi),%edx
C // store decrypted data back to caller's buffer
movl 28(%esp),%edi movl 28(%esp),%edi
movl %eax,(%edi) AES_STORE(%esi, %edi)
movl %ebx,4(%edi)
movl %ecx,8(%edi)
movl %edx,12(%edi)
addl $16, 28(%esp) C Increment destination pointer addl $16, 28(%esp) C Increment destination pointer
subl $16, 24(%esp) subl $16, 24(%esp)
jnz .Ldecrypt_block_loop jnz .Lblock_loop
.Ldecrypt_end: .Lend:
popl %edi popl %edi
popl %esi popl %esi
popl %ebp popl %ebp
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment