From: Paul E Murphy <murphyp@linux.ibm.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
libc-alpha@sourceware.org
Subject: Re: [PATCH v3 7/9] powerpc64: Add optimized chacha20
Date: Wed, 20 Apr 2022 13:38:40 -0500 [thread overview]
Message-ID: <d2f96cb4-314e-165c-8a63-63357c9bd322@linux.ibm.com> (raw)
In-Reply-To: <20220419212812.2688764-8-adhemerval.zanella@linaro.org>
On 4/19/22 4:28 PM, Adhemerval Zanella via Libc-alpha wrote:
> It adds vectorized ChaCha20 implementation based on libgcrypt
> cipher/chacha20-ppc.c. It targets POWER8 and it is used on
> default for LE.
> diff --git a/sysdeps/powerpc/powerpc64/chacha20-ppc.c b/sysdeps/powerpc/powerpc64/chacha20-ppc.c
> new file mode 100644
> index 0000000000..e2567c379a
> --- /dev/null
> +++ b/sysdeps/powerpc/powerpc64/chacha20-ppc.c
How difficult is it to keep this synchronized with the upstream version
in libgcrypt? Also, this seems like it would be a better placed in the
power8 subdirectory.
> diff --git a/sysdeps/powerpc/powerpc64/chacha20_arch.h b/sysdeps/powerpc/powerpc64/chacha20_arch.h
> new file mode 100644
> index 0000000000..a18115392f
> --- /dev/null
> +++ b/sysdeps/powerpc/powerpc64/chacha20_arch.h
> @@ -0,0 +1,47 @@
> +/* PowerPC optimization for ChaCha20.
> + Copyright (C) 2022 Free Software Foundation, Inc.
> + This file is part of the GNU C Library.
> +
> + The GNU C Library is free software; you can redistribute it and/or
> + modify it under the terms of the GNU Lesser General Public
> + License as published by the Free Software Foundation; either
> + version 2.1 of the License, or (at your option) any later version.
> +
> + The GNU C Library is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + Lesser General Public License for more details.
> +
> + You should have received a copy of the GNU Lesser General Public
> + License along with the GNU C Library; if not, see
> + <http://www.gnu.org/licenses/>. */
> +
> +#include <stdbool.h>
> +#include <ldsodefs.h>
> +
> +unsigned int __chacha20_power8_blocks4 (uint32_t *state, uint8_t *dst,
> + const uint8_t *src, size_t nblks)
> + attribute_hidden;
> +
> +static void
> +chacha20_crypt (uint32_t *state, uint8_t *dst,
> + const uint8_t *src, size_t bytes)
> +{
> + _Static_assert (CHACHA20_BUFSIZE % 4 == 0,
> + "CHACHA20_BUFSIZE not multiple of 4");
> + _Static_assert (CHACHA20_BUFSIZE >= CHACHA20_BLOCK_SIZE * 4,
> + "CHACHA20_BUFSIZE < CHACHA20_BLOCK_SIZE * 4");
> +
> +#ifdef __LITTLE_ENDIAN__
> + __chacha20_power8_blocks4 (state, dst, src,
> + CHACHA20_BUFSIZE / CHACHA20_BLOCK_SIZE);
> +#else
> + unsigned long int hwcap = GLRO(dl_hwcap);
> + unsigned long int hwcap2 = GLRO(dl_hwcap2);
> + if (hwcap2 & PPC_FEATURE2_ARCH_2_07 && hwcap & PPC_FEATURE_HAS_ALTIVEC)
> + __chacha20_power8_blocks4 (state, dst, src,
> + CHACHA20_BUFSIZE / CHACHA20_BLOCK_SIZE);
> + else
> + chacha20_crypt_generic (state, dst, src, bytes);
> +#endif
This file doesn't seem to obey the multiarch conventions of other
powerpc64 specific bits. Is it possible to implement multiarch support
similar to the libc/libm routines?
next prev parent reply other threads:[~2022-04-20 18:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-19 21:28 [PATCH v3 0/9] Add arc4random support Adhemerval Zanella
2022-04-19 21:28 ` [PATCH v3 1/9] stdlib: Add arc4random, arc4random_buf, and arc4random_uniform (BZ #4417) Adhemerval Zanella
2022-04-19 21:52 ` H.J. Lu
2022-04-20 12:38 ` Adhemerval Zanella
2022-04-22 13:54 ` Yann Droneaud
2022-04-25 12:15 ` Adhemerval Zanella
2022-04-25 12:20 ` Adhemerval Zanella
2022-04-25 2:22 ` Mark Harris
2022-04-25 12:26 ` Adhemerval Zanella
2022-04-19 21:28 ` [PATCH v3 2/9] stdlib: Add arc4random tests Adhemerval Zanella
2022-04-19 21:28 ` [PATCH v3 3/9] benchtests: Add arc4random benchtest Adhemerval Zanella
2022-04-19 21:28 ` [PATCH v3 4/9] aarch64: Add optimized chacha20 Adhemerval Zanella
2022-04-19 21:28 ` [PATCH v3 5/9] x86: Add SSE2 " Adhemerval Zanella
2022-04-19 21:28 ` [PATCH v3 6/9] x86: Add AVX2 " Adhemerval Zanella
2022-04-19 21:28 ` [PATCH v3 7/9] powerpc64: Add " Adhemerval Zanella
2022-04-20 18:38 ` Paul E Murphy [this message]
2022-04-20 19:23 ` Adhemerval Zanella
2022-04-22 21:09 ` Paul E Murphy
2022-04-19 21:28 ` [PATCH v3 8/9] s390x: " Adhemerval Zanella
2022-04-19 21:28 ` [PATCH v3 9/9] stdlib: Add TLS optimization to arc4random Adhemerval Zanella
2022-04-22 16:02 ` Yann Droneaud
2022-04-25 12:36 ` Adhemerval Zanella
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=d2f96cb4-314e-165c-8a63-63357c9bd322@linux.ibm.com \
--to=murphyp@linux.ibm.com \
--cc=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).