mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Denis Vlasenko <vda@ilport.com.ua>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Linux kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] i386 aes asm typo fix
Date: Thu, 24 Nov 2005 15:07:01 +0200	[thread overview]
Message-ID: <200511241507.01668.vda@ilport.com.ua> (raw)

[-- Attachment #1: Type: text/plain, Size: 94 bytes --]

* fix typo (128 -> 192,256 bits)
* nano-optimization (copied from x86_86)

Run tested.
--
vda

[-- Attachment #2: aes-i586-asm.patch --]
[-- Type: text/x-diff, Size: 4043 bytes --]

* fix typo (128 -> 192,256 bits)
* nano-optimization (taken from x86_86)

Run tested:

2005-11-24_12:51:47.65292 kern.info: testing tnepres ECB decryption across pages (chunking)
2005-11-24_12:51:47.65295 kern.info:
2005-11-24_12:51:47.65298 kern.info: testing aes ECB encryption
2005-11-24_12:51:47.91579 kern.info: test 1 (128 bit key):
2005-11-24_12:51:47.91599 kern.info: 69c4e0d86a7b0430d8cdb78070b4c55a
2005-11-24_12:51:47.91602 kern.info: pass
2005-11-24_12:51:47.91605 kern.info: test 2 (192 bit key):
2005-11-24_12:51:47.91608 kern.info: dda97ca4864cdfe06eaf70a0ec0d7191
2005-11-24_12:51:47.91611 kern.info: pass
2005-11-24_12:51:47.91613 kern.info: test 3 (256 bit key):
2005-11-24_12:51:47.91616 kern.info: 8ea2b7ca516745bfeafc49904b496089
2005-11-24_12:51:47.91620 kern.info: pass
2005-11-24_12:51:47.91622 kern.info:
2005-11-24_12:51:47.91625 kern.info: testing aes ECB encryption across pages (chunking)
2005-11-24_12:51:47.91629 kern.info:
2005-11-24_12:51:47.91631 kern.info: testing aes ECB decryption
2005-11-24_12:51:47.91634 kern.info: test 1 (128 bit key):
2005-11-24_12:51:47.91637 kern.info: 00112233445566778899aabbccddeeff
2005-11-24_12:51:47.91640 kern.info: pass
2005-11-24_12:51:47.91643 kern.info: test 2 (192 bit key):
2005-11-24_12:51:47.91646 kern.info: 00112233445566778899aabbccddeeff
2005-11-24_12:51:47.91649 kern.info: pass
2005-11-24_12:51:47.91652 kern.info: test 3 (256 bit key):
2005-11-24_12:51:47.91655 kern.info: 00112233445566778899aabbccddeeff
2005-11-24_12:51:47.91658 kern.info: pass
2005-11-24_12:51:47.91660 kern.info:
2005-11-24_12:51:47.91663 kern.info: testing aes ECB decryption across pages (chunking)
2005-11-24_12:51:47.91667 kern.info:
2005-11-24_12:51:47.91669 kern.info: testing cast5 ECB encryption

--- linux-2.6.14.org/arch/i386/crypto/aes-i586-asm.S.org	Mon Aug 29 02:41:01 2005
+++ linux-2.6.14.org/arch/i386/crypto/aes-i586-asm.S	Thu Nov 24 12:44:52 2005
@@ -255,18 +255,17 @@ aes_enc_blk:
 	xor     8(%ebp),%r4
 	xor     12(%ebp),%r5
 
-	sub     $8,%esp           // space for register saves on stack
-	add     $16,%ebp          // increment to next round key
-	sub     $10,%r3          
-	je      4f              // 10 rounds for 128-bit key
-	add     $32,%ebp
-	sub     $2,%r3
-	je      3f              // 12 rounds for 128-bit key
-	add     $32,%ebp
+	sub     $8,%esp		// space for register saves on stack
+	add     $16,%ebp	// increment to next round key
+	cmp     $12,%r3
+	jb      4f		// 10 rounds for 128-bit key
+	lea     32(%ebp),%ebp
+	je      3f		// 12 rounds for 192-bit key
+	lea     32(%ebp),%ebp
 
-2:	fwd_rnd1( -64(%ebp) ,ft_tab)	// 14 rounds for 128-bit key
+2:	fwd_rnd1( -64(%ebp) ,ft_tab)	// 14 rounds for 256-bit key
 	fwd_rnd2( -48(%ebp) ,ft_tab)
-3:	fwd_rnd1( -32(%ebp) ,ft_tab)	// 12 rounds for 128-bit key
+3:	fwd_rnd1( -32(%ebp) ,ft_tab)	// 12 rounds for 192-bit key
 	fwd_rnd2( -16(%ebp) ,ft_tab)
 4:	fwd_rnd1(    (%ebp) ,ft_tab)	// 10 rounds for 128-bit key
 	fwd_rnd2( +16(%ebp) ,ft_tab)
@@ -334,18 +333,17 @@ aes_dec_blk:
 	xor     8(%ebp),%r4
 	xor     12(%ebp),%r5
 
-	sub     $8,%esp         // space for register saves on stack
-	sub     $16,%ebp        // increment to next round key
-	sub     $10,%r3          
-	je      4f              // 10 rounds for 128-bit key
-	sub     $32,%ebp
-	sub     $2,%r3
-	je      3f              // 12 rounds for 128-bit key
-	sub     $32,%ebp
+	sub     $8,%esp		// space for register saves on stack
+	sub     $16,%ebp	// increment to next round key
+	cmp     $12,%r3
+	jb      4f		// 10 rounds for 128-bit key
+	lea     -32(%ebp),%ebp
+	je      3f		// 12 rounds for 192-bit key
+	lea     -32(%ebp),%ebp
 
-2:	inv_rnd1( +64(%ebp), it_tab)	// 14 rounds for 128-bit key
+2:	inv_rnd1( +64(%ebp), it_tab)	// 14 rounds for 256-bit key
 	inv_rnd2( +48(%ebp), it_tab)
-3:	inv_rnd1( +32(%ebp), it_tab)	// 12 rounds for 128-bit key
+3:	inv_rnd1( +32(%ebp), it_tab)	// 12 rounds for 192-bit key
 	inv_rnd2( +16(%ebp), it_tab)
 4:	inv_rnd1(    (%ebp), it_tab)	// 10 rounds for 128-bit key
 	inv_rnd2( -16(%ebp), it_tab)

             reply	other threads:[~2005-11-24 13:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-24 13:07 Denis Vlasenko [this message]
2005-11-29 11:24 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200511241507.01668.vda@ilport.com.ua \
    --to=vda@ilport.com.ua \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®