Message ID | 20181009125541.24455-7-berrange@redhat.com |
---|---|
State | New |
Headers | show |
Series | crypto: improve performance of XTS cipher mode | expand |
On Tue 09 Oct 2018 02:55:41 PM CEST, Daniel P. Berrangé wrote: > Encouraging the compiler to inline xts_tweak_encdec increases the > performance for xts-aes-128 when built with gcrypt: > > Encrypt: 460 MB/s -> 485 MB/s > Decrypt: 485 MB/s -> 505 MB/s :-) > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Berto
diff --git a/crypto/xts.c b/crypto/xts.c index bba3280746..02d3bc3f16 100644 --- a/crypto/xts.c +++ b/crypto/xts.c @@ -61,11 +61,11 @@ static void xts_mult_x(xts_uint128 *I) * * Encrypt/decrypt data with a tweak */ -static void xts_tweak_encdec(const void *ctx, - xts_cipher_func *func, - const xts_uint128 *src, - xts_uint128 *dst, - xts_uint128 *iv) +static inline void xts_tweak_encdec(const void *ctx, + xts_cipher_func *func, + const xts_uint128 *src, + xts_uint128 *dst, + xts_uint128 *iv) { /* tweak encrypt block i */ xts_uint128_xor(dst, src, iv);
Encouraging the compiler to inline xts_tweak_encdec increases the performance for xts-aes-128 when built with gcrypt: Encrypt: 460 MB/s -> 485 MB/s Decrypt: 485 MB/s -> 505 MB/s Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- crypto/xts.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)