Skip to content

camellia: 64-bit optimization and code shrink

Denys Vlasenko linux-crypto 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4camellia: 64-bit optimizationcrypto/camellia.c+722 -1382 replies
2/4camellia: code shrinkcrypto/camellia.c+108 -4051 reply
3/4camellia: code shrink 2crypto/camellia.c+184 -2770 replies
4/4camellia: code shrink 3crypto/camellia.c+168 -2700 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] camellia: 64-bit optimization and code shrink

Patches start from 5 because pathches 1..4 are already in cryptodev-2.6.

camellia5:
adds 64-bit key setup, it is used if BITS_PER_LONG is 64.

camellia6:
unifies encrypt/decrypt routines for different key lengths. This reduces module size by ~25%, with tiny (less than 1%) speed impact.
Also collapses encrypt/decrypt into more readable (visually shorter) form using macros.

camellia7:
Move "key XOR is end of F-function" code part into camellia_setup_tail(), it is sufficiently similar between camellia_setup128 and camellia_setup256.

camellia8:
Analogously to camellia7 patch, move
"absorb kw2 to other subkeys" and "absorb kw4 to other subkeys" code parts into camellia_setup_tail(). This further reduces source and object code size at the cost of two brances in key setup code.

Code sizes:
64-bit:

dec      hex   filename
22786    5902  2.6.23.1.camellia4.t64/crypto/camellia.o
21422    53ae  2.6.23.1.camellia5.t64/crypto/camellia.o
16355    3fe3  2.6.23.1.camellia6.t64/crypto/camellia.o
15813    3dc5  2.6.23.1.camellia7.t64/crypto/camellia.o
15670    3d36  2.6.23.1.camellia8.t64/crypto/camellia.o

32-bit:

29948    74fc  2.6.23.1.camellia4.t/crypto/camellia.o
29457    7311  2.6.23.1.camellia5.t/crypto/camellia.o
21414    53a6  2.6.23.1.camellia6.t/crypto/camellia.o
20518    5026  2.6.23.1.camellia7.t/crypto/camellia.o
18454    4816  2.6.23.1.camellia8.t/crypto/camellia.oamellia.o

These patches apply cleanly to current cryptodev-2.6. They should be applied in order.
Compile and run tested.

--
vda