Commit e6a3a925 authored by Denis Vlasenko's avatar Denis Vlasenko Committed by David S. Miller

[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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 827c3911
...@@ -257,16 +257,15 @@ aes_enc_blk: ...@@ -257,16 +257,15 @@ aes_enc_blk:
sub $8,%esp // space for register saves on stack sub $8,%esp // space for register saves on stack
add $16,%ebp // increment to next round key add $16,%ebp // increment to next round key
sub $10,%r3 cmp $12,%r3
je 4f // 10 rounds for 128-bit key jb 4f // 10 rounds for 128-bit key
add $32,%ebp lea 32(%ebp),%ebp
sub $2,%r3 je 3f // 12 rounds for 192-bit key
je 3f // 12 rounds for 128-bit key lea 32(%ebp),%ebp
add $32,%ebp
2: fwd_rnd1( -64(%ebp) ,ft_tab) // 14 rounds for 256-bit key
2: fwd_rnd1( -64(%ebp) ,ft_tab) // 14 rounds for 128-bit key
fwd_rnd2( -48(%ebp) ,ft_tab) 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) fwd_rnd2( -16(%ebp) ,ft_tab)
4: fwd_rnd1( (%ebp) ,ft_tab) // 10 rounds for 128-bit key 4: fwd_rnd1( (%ebp) ,ft_tab) // 10 rounds for 128-bit key
fwd_rnd2( +16(%ebp) ,ft_tab) fwd_rnd2( +16(%ebp) ,ft_tab)
...@@ -336,16 +335,15 @@ aes_dec_blk: ...@@ -336,16 +335,15 @@ aes_dec_blk:
sub $8,%esp // space for register saves on stack sub $8,%esp // space for register saves on stack
sub $16,%ebp // increment to next round key sub $16,%ebp // increment to next round key
sub $10,%r3 cmp $12,%r3
je 4f // 10 rounds for 128-bit key jb 4f // 10 rounds for 128-bit key
sub $32,%ebp lea -32(%ebp),%ebp
sub $2,%r3 je 3f // 12 rounds for 192-bit key
je 3f // 12 rounds for 128-bit key lea -32(%ebp),%ebp
sub $32,%ebp
2: inv_rnd1( +64(%ebp), it_tab) // 14 rounds for 256-bit key
2: inv_rnd1( +64(%ebp), it_tab) // 14 rounds for 128-bit key
inv_rnd2( +48(%ebp), it_tab) 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) inv_rnd2( +16(%ebp), it_tab)
4: inv_rnd1( (%ebp), it_tab) // 10 rounds for 128-bit key 4: inv_rnd1( (%ebp), it_tab) // 10 rounds for 128-bit key
inv_rnd2( -16(%ebp), it_tab) inv_rnd2( -16(%ebp), it_tab)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment