OSDN Git Service

crypto: gf128mul - define gf128mul_x_* in gf128mul.h
authorOndrej Mosnáček <omosnacek@gmail.com>
Sun, 2 Apr 2017 19:19:13 +0000 (21:19 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 5 Apr 2017 13:58:35 +0000 (21:58 +0800)
commitacb9b159c784dc0033ede0dadde876ebd93aca4c
tree4bc26c590b0fdcb517e996197958aa2654496f06
parentf275d3856cf597419293cd7d95aa628d3073f556
crypto: gf128mul - define gf128mul_x_* in gf128mul.h

The gf128mul_x_ble function is currently defined in gf128mul.c, because
it depends on the gf128mul_table_be multiplication table.

However, since the function is very small and only uses two values from
the table, it is better for it to be defined as inline function in
gf128mul.h. That way, the function can be inlined by the compiler for
better performance.

For consistency, the other gf128mul_x_* functions are also moved to the
header file. In addition, the code is rewritten to be constant-time.

After this change, the speed of the generic 'xts(aes)' implementation
increased from ~225 MiB/s to ~235 MiB/s (measured using 'cryptsetup
benchmark -c aes-xts-plain64' on an Intel system with CRYPTO_AES_X86_64
and CRYPTO_AES_NI_INTEL disabled).

Signed-off-by: Ondrej Mosnacek <omosnacek@gmail.com>
Reviewd-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/gf128mul.c
include/crypto/gf128mul.h