Received: from eggs.gnu.org ([2001:4830:134:3::10]:44285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9ty1-0008Vv-E7 for qemu-devel@nongnu.org; Tue, 09 Oct 2018 11:30:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9txy-0008ET-2x for qemu-devel@nongnu.org; Tue, 09 Oct 2018 11:30:37 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:38359) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g9txu-0008BD-OB for qemu-devel@nongnu.org; Tue, 09 Oct 2018 11:30:32 -0400 From: Alberto Garcia In-Reply-To: <20181009150629.GK22838@redhat.com> References: <20181009125541.24455-1-berrange@redhat.com> <20181009125541.24455-5-berrange@redhat.com> <20181009150629.GK22838@redhat.com> Date: Tue, 09 Oct 2018 17:30:25 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 4/6] crypto: convert xts_tweak_encdec to use xts_uint128 type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Daniel_P=2E_Berrang=C3=A9?= Cc: qemu-devel@nongnu.org >> > for (i = 0; i < lim; i++) { >> > - xts_tweak_encdec(datactx, decfunc, src, dst, (uint8_t *)&T); >> > + xts_uint128 S, D; >> > + >> > + memcpy(&S, src, XTS_BLOCK_SIZE); >> > + xts_tweak_encdec(datactx, decfunc, &S, &D, &T); >> > + memcpy(dst, &D, XTS_BLOCK_SIZE); >> >> Why do you need S and D? > > I think src & dst pointers can't be guaranteed to be aligned > sufficiently for int64 operations, if we just cast from uint8t*. I see. I did a quick test without the memcpy() calls and it doesn't seem to have a visible effect on performance, but if it turns out that it does then maybe this is worth investigating further. I suspect all buffers received by this code are allocated with qemu_try_blockalign() anyway, so it should be safe. Berto