aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDenis Vlasenko <vda@ilport.com.ua>2005-11-29 06:23:20 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-01-09 17:15:51 -0500
commite6a3a925a25ddd2ebd66dbc8d14ebdd3d57ca0c3 (patch)
tree1b13c0cd7da01e4a7c14cdae1231ca22d317df21 /arch
parent827c3911d8551842900f44c9a139382bcae68e6e (diff)
[CRYPTO] aes-i586: Nano-optimisation on key length check
Reduce the number of comparisons by one through the use of jb/je. This patch also corrects the comments regarding the different key lengths. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/crypto/aes-i586-asm.S40
1 files changed, 19 insertions, 21 deletions
diff --git a/arch/i386/crypto/aes-i586-asm.S b/arch/i386/crypto/aes-i586-asm.S
index 7b73c67cb4e8..911b15377f2e 100644
--- a/arch/i386/crypto/aes-i586-asm.S
+++ b/arch/i386/crypto/aes-i586-asm.S
@@ -255,18 +255,17 @@ aes_enc_blk:
255 xor 8(%ebp),%r4 255 xor 8(%ebp),%r4
256 xor 12(%ebp),%r5 256 xor 12(%ebp),%r5
257 257
258 sub $8,%esp // space for register saves on stack 258 sub $8,%esp // space for register saves on stack
259 add $16,%ebp // increment to next round key 259 add $16,%ebp // increment to next round key
260 sub $10,%r3 260 cmp $12,%r3
261 je 4f // 10 rounds for 128-bit key 261 jb 4f // 10 rounds for 128-bit key
262 add $32,%ebp 262 lea 32(%ebp),%ebp
263 sub $2,%r3 263 je 3f // 12 rounds for 192-bit key
264 je 3f // 12 rounds for 128-bit key 264 lea 32(%ebp),%ebp
265 add $32,%ebp 265
266 2662: fwd_rnd1( -64(%ebp) ,ft_tab) // 14 rounds for 256-bit key
2672: fwd_rnd1( -64(%ebp) ,ft_tab) // 14 rounds for 128-bit key
268 fwd_rnd2( -48(%ebp) ,ft_tab) 267 fwd_rnd2( -48(%ebp) ,ft_tab)
2693: fwd_rnd1( -32(%ebp) ,ft_tab) // 12 rounds for 128-bit key 2683: fwd_rnd1( -32(%ebp) ,ft_tab) // 12 rounds for 192-bit key
270 fwd_rnd2( -16(%ebp) ,ft_tab) 269 fwd_rnd2( -16(%ebp) ,ft_tab)
2714: fwd_rnd1( (%ebp) ,ft_tab) // 10 rounds for 128-bit key 2704: fwd_rnd1( (%ebp) ,ft_tab) // 10 rounds for 128-bit key
272 fwd_rnd2( +16(%ebp) ,ft_tab) 271 fwd_rnd2( +16(%ebp) ,ft_tab)
@@ -334,18 +333,17 @@ aes_dec_blk:
334 xor 8(%ebp),%r4 333 xor 8(%ebp),%r4
335 xor 12(%ebp),%r5 334 xor 12(%ebp),%r5
336 335
337 sub $8,%esp // space for register saves on stack 336 sub $8,%esp // space for register saves on stack
338 sub $16,%ebp // increment to next round key 337 sub $16,%ebp // increment to next round key
339 sub $10,%r3 338 cmp $12,%r3
340 je 4f // 10 rounds for 128-bit key 339 jb 4f // 10 rounds for 128-bit key
341 sub $32,%ebp 340 lea -32(%ebp),%ebp
342 sub $2,%r3 341 je 3f // 12 rounds for 192-bit key
343 je 3f // 12 rounds for 128-bit key 342 lea -32(%ebp),%ebp
344 sub $32,%ebp
345 343
3462: inv_rnd1( +64(%ebp), it_tab) // 14 rounds for 128-bit key 3442: inv_rnd1( +64(%ebp), it_tab) // 14 rounds for 256-bit key
347 inv_rnd2( +48(%ebp), it_tab) 345 inv_rnd2( +48(%ebp), it_tab)
3483: inv_rnd1( +32(%ebp), it_tab) // 12 rounds for 128-bit key 3463: inv_rnd1( +32(%ebp), it_tab) // 12 rounds for 192-bit key
349 inv_rnd2( +16(%ebp), it_tab) 347 inv_rnd2( +16(%ebp), it_tab)
3504: inv_rnd1( (%ebp), it_tab) // 10 rounds for 128-bit key 3484: inv_rnd1( (%ebp), it_tab) // 10 rounds for 128-bit key
351 inv_rnd2( -16(%ebp), it_tab) 349 inv_rnd2( -16(%ebp), it_tab)