From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au
Cc: ebiggers@google.com, davem@davemloft.net, dm-devel@redhat.com,
johannes@sipsolutions.net, linux-wireless@vger.kernel.org,
agk@redhat.com, snitzer@redhat.com,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH v2 0/2] crypto/algapi - refactor crypto_xor() to avoid memcpy()s
Date: Tue, 18 Jul 2017 10:19:10 +0100 [thread overview]
Message-ID: <20170718091912.14104-1-ard.biesheuvel@linaro.org> (raw)
>From 2/2:
"""
There are quite a number of occurrences in the kernel of the pattern
if (dst != src)
memcpy(dst, src, walk.total % AES_BLOCK_SIZE);
crypto_xor(dst, final, walk.total % AES_BLOCK_SIZE);
or
crypto_xor(keystream, src, nbytes);
memcpy(dst, keystream, nbytes);
where crypto_xor() is preceded or followed by a memcpy() invocation
that is only there because crypto_xor() uses its output parameter as
one of the inputs.
"""
Patch #1 is a preparatory patch, which is split off for ease of review.
Patch #2 updates all occurrences of crypto_xor() involving a memcpy() to
use a new API function crypto_xor_cpy() which combines the two operations.
v2: - keep existing crypto_xor() as-is, and add crypto_xor_cpy() for the
cases where a redundant memcpy() can be eliminated.
Ard Biesheuvel (2):
crypto/algapi - use separate dst and src operands for __crypto_xor()
crypto/algapi - make crypto_xor() take separate dst and src arguments
arch/arm/crypto/aes-ce-glue.c | 4 +---
arch/arm/crypto/aes-neonbs-glue.c | 5 ++--
arch/arm64/crypto/aes-glue.c | 4 +---
arch/arm64/crypto/aes-neonbs-glue.c | 5 ++--
arch/sparc/crypto/aes_glue.c | 3 +--
arch/x86/crypto/aesni-intel_glue.c | 4 ++--
arch/x86/crypto/blowfish_glue.c | 3 +--
arch/x86/crypto/cast5_avx_glue.c | 3 +--
arch/x86/crypto/des3_ede_glue.c | 3 +--
crypto/algapi.c | 25 ++++++++++++--------
crypto/ctr.c | 3 +--
crypto/pcbc.c | 12 ++++------
drivers/crypto/vmx/aes_ctr.c | 3 +--
drivers/md/dm-crypt.c | 11 ++++-----
include/crypto/algapi.h | 23 ++++++++++++++++--
15 files changed, 59 insertions(+), 52 deletions(-)
--
2.9.3
next reply other threads:[~2017-07-18 9:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 9:19 Ard Biesheuvel [this message]
2017-07-18 9:19 ` [PATCH v2 1/2] crypto/algapi - use separate dst and src operands for __crypto_xor() Ard Biesheuvel
2017-07-18 9:19 ` [PATCH v2 2/2] crypto/algapi - make crypto_xor() take separate dst and src arguments Ard Biesheuvel
2017-07-23 1:16 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170718091912.14104-1-ard.biesheuvel@linaro.org \
--to=ard.biesheuvel@linaro.org \
--cc=agk@redhat.com \
--cc=davem@davemloft.net \
--cc=dm-devel@redhat.com \
--cc=ebiggers@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=johannes@sipsolutions.net \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=snitzer@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).