[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 5/8] crypto: convert xts_mult_x to use xts_ui
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-devel] [PATCH v2 5/8] crypto: convert xts_mult_x to use xts_uint128 type |
Date: |
Tue, 16 Oct 2018 15:35:01 +0200 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
On Tue 16 Oct 2018 12:09:15 PM CEST, Daniel P. Berrangé wrote:
> Using 64-bit arithmetic increases the performance for xts-aes-128
> when built with gcrypt:
>
> Encrypt: 355 MB/s -> 545 MB/s
> Decrypt: 362 MB/s -> 568 MB/s
>
> Signed-off-by: Daniel P. Berrangé <address@hidden>
This patch is also fine, but I have a couple of minor comments:
> +static void xts_mult_x(xts_uint128 *I)
> +{
> + uint64_t tt;
> +
> + xts_uint128_cpu_to_les(I);
> +
> + tt = I->u[0] >> 63;
> + I->u[0] = I->u[0] << 1;
Perhaps I->u[0] <<= 1 , for clarity and consistency with the following
line (I->u[0] ^= 0x87) ? But I don't mind if you prefer to keep it as is
now.
> + if (I->u[1] >> 63) {
> + I->u[0] ^= 0x87;
> }
> + I->u[1] = (I->u[1] << 1) | tt;
> +
> + xts_uint128_le_to_cpus(I);
I think both endianness conversion calls should be flipped. First you
convert from the buffer byte order (LE) to the CPU byte order so you can
do the bit shifts, then back to the original byte order (LE).
Changing this doesn't have any practical effect because both calls
perform the exact same operation, but it documents better what's going
on.
With this changed,
Reviewed-by: Alberto Garcia <address@hidden>
Berto
- [Qemu-devel] [PATCH v2 0/8] crypto: improve performance of XTS cipher mode, Daniel P . Berrangé, 2018/10/16
- [Qemu-devel] [PATCH v2 3/8] crypto: introduce a xts_uint128 data type, Daniel P . Berrangé, 2018/10/16
- [Qemu-devel] [PATCH v2 7/8] crypto: refactor XTS cipher mode test suite, Daniel P . Berrangé, 2018/10/16
- [Qemu-devel] [PATCH v2 1/8] crypto: expand algorithm coverage for cipher benchmark, Daniel P . Berrangé, 2018/10/16
- [Qemu-devel] [PATCH v2 8/8] crypto: add testing for unaligned buffers with XTS cipher mode, Daniel P . Berrangé, 2018/10/16