From 2fd342810cf57a9c82b939ffae1f56edb885cee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Wed, 15 May 2002 16:03:52 +0200 Subject: [PATCH] Minor cleanups to make the encrypt and decrypt code more similar. Rev: src/nettle/x86/aes-decrypt.asm:1.12 Rev: src/nettle/x86/aes-encrypt.asm:1.17 --- x86/aes-decrypt.asm | 5 ++++- x86/aes-encrypt.asm | 16 ++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/x86/aes-decrypt.asm b/x86/aes-decrypt.asm index e19ac708..42b41167 100644 --- a/x86/aes-decrypt.asm +++ b/x86/aes-decrypt.asm @@ -120,7 +120,10 @@ aes_decrypt: AES_STORE(%esi, %edi) addl $16, 28(%esp) C Increment destination pointer - subl $16, 24(%esp) + subl $16, 24(%esp) C Length + + C NOTE: Will loop forever if input data is not an + C integer number of blocks. jnz .Lblock_loop .Lend: diff --git a/x86/aes-encrypt.asm b/x86/aes-encrypt.asm index 32b266ad..347318ee 100644 --- a/x86/aes-encrypt.asm +++ b/x86/aes-encrypt.asm @@ -51,9 +51,9 @@ aes_encrypt: movl 24(%esp), %ebp testl %ebp,%ebp - jz .Lencrypt_end + jz .Lend -.Lencrypt_block_loop: +.Lblock_loop: movl 20(%esp),%esi C address of context struct ctx movl 32(%esp),%ebp C address of plaintext AES_LOAD(%esi, %ebp) @@ -64,7 +64,7 @@ aes_encrypt: subl $1,%ebp addl $16,%esi C point to next key -.Laes_encrypt_loop: +.Lround_loop: pushl %esi C save this first: we'll clobber it later AES_ROUND(_aes_encrypt_table,a,b,c,d) @@ -91,7 +91,7 @@ aes_encrypt: xorl 12(%esi),%edx addl $16,%esi C point to next key decl %ebp - jnz .Laes_encrypt_loop + jnz .Lround_loop C last round @@ -105,15 +105,15 @@ aes_encrypt: pushl %edi AES_FINAL_ROUND(d,a,b,c) + movl %edi,%edx - popl %ecx popl %ebx popl %eax C S-box substitution mov $4,%edi -.Lsubst: +.Lsubst: AES_SUBST_BYTE(_aes_encrypt_table) decl %edi @@ -128,9 +128,9 @@ aes_encrypt: C NOTE: Will loop forever if input data is not an C integer number of blocks. - jnz .Lencrypt_block_loop + jnz .Lblock_loop -.Lencrypt_end: +.Lend: popl %edi popl %esi popl %ebp -- GitLab