From: Peter Maydell <peter.maydell@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
qemu-arm <qemu-arm@nongnu.org>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH v4 1/3] target/arm: Implement an IMPDEF pauth algorithm
Date: Fri, 8 Jan 2021 14:15:20 +0000 [thread overview]
Message-ID: <CAFEAcA8zz2ApaqE7h7LEhPML2KZLysQ9i2e7msDB0nhdJKkDnw@mail.gmail.com> (raw)
In-Reply-To: <20201216221247.522686-2-richard.henderson@linaro.org>
On Wed, 16 Dec 2020 at 22:12, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Without hardware acceleration, a cryptographically strong
> algorithm is too expensive for pauth_computepac.
>
> Even with hardware accel, we are not currently expecting
> to link the linux-user binaries to any crypto libraries,
> and doing so would generally make the --static build fail.
>
> So choose XXH64 as a reasonably quick and decent hash.
>
> Tested-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> v2: Move the XXH64 bits to xxhash.h (ajb).
> Create isar_feature_aa64_pauth_arch and fixup a comment
> in isar_feature_aa64_pauth that no longer applies.
> ---
> +static uint64_t pauth_computepac_impdef(uint64_t data, uint64_t modifier,
> + ARMPACKey key)
> +{
> + /*
> + * The XXH64 algorithmm, simplified for size 32.
> + * See the description of the algorithm in xxhash.h.
> + */
> + uint64_t v1 = QEMU_XXHASH_SEED + XXH_PRIME64_1 + XXH_PRIME64_2;
> + uint64_t v2 = QEMU_XXHASH_SEED + XXH_PRIME64_2;
> + uint64_t v3 = QEMU_XXHASH_SEED + 0;
> + uint64_t v4 = QEMU_XXHASH_SEED - XXH_PRIME64_1;
> +
> + v1 = XXH64_round(v1, data);
> + v2 = XXH64_round(v2, modifier);
> + v3 = XXH64_round(v3, key.lo);
> + v4 = XXH64_round(v4, key.hi);
> +
> + return XXH64_avalanche(XXH64_mergerounds(v1, v2, v3, v4));
Since the only use of xxh64 we make is "feed in 4 64 bit inputs
and get a 64 bit result", why provide all the components and
stitch them together here rather than following the existing
pattern we have for qemu_xxhash* (the xxh32 algorithm) and
providing a function
static inline uint64_t qemu_xxhash64_4(uint64_t a, uint64_t b,
uint64_t c, uint64_t d)
in xxhash.h ?
thanks
-- PMM
next prev parent reply other threads:[~2021-01-08 14:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-16 22:12 [PATCH v4 0/3] target/arm: Implement an IMPDEF pauth algorithm Richard Henderson
2020-12-16 22:12 ` [PATCH v4 1/3] " Richard Henderson
2021-01-08 14:15 ` Peter Maydell [this message]
2020-12-16 22:12 ` [PATCH v4 2/3] target/arm: Add cpu properties to control pauth Richard Henderson
2021-01-08 14:16 ` Peter Maydell
2020-12-16 22:12 ` [PATCH v4 3/3] target/arm: Use object_property_add_bool for "sve" property Richard Henderson
2020-12-16 22:43 ` Philippe Mathieu-Daudé
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=CAFEAcA8zz2ApaqE7h7LEhPML2KZLysQ9i2e7msDB0nhdJKkDnw@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=mark.rutland@arm.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).