mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
	linux-kernel@vger.kernel.org
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Subject: [PATCH] random: vDSO: move prototype of arch chacha function to vdso/getrandom.h
Date: Tue, 27 Aug 2024 17:18:20 +0200	[thread overview]
Message-ID: <20240827151828.3326600-1-Jason@zx2c4.com> (raw)
In-Reply-To: <CAHmME9o35OwD574x2TyAfp=iRfWD95pvi561+Q=2aAWRORofKg@mail.gmail.com>

Having the prototype for __arch_chacha20_blocks_nostack in
arch/x86/include/asm/vdso/getrandom.h meant that the prototype and large
doc comment were cloned by every architecture, which has been causing
unnecessary churn. Instead move it into include/vdso/getrandom.h, where
it can be shared by all archs implementing it.

Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 arch/x86/include/asm/vdso/getrandom.h | 13 -------------
 include/vdso/getrandom.h              | 13 +++++++++++++
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/x86/include/asm/vdso/getrandom.h b/arch/x86/include/asm/vdso/getrandom.h
index b96e674cafde..ff5334ad32a0 100644
--- a/arch/x86/include/asm/vdso/getrandom.h
+++ b/arch/x86/include/asm/vdso/getrandom.h
@@ -37,19 +37,6 @@ static __always_inline const struct vdso_rng_data *__arch_get_vdso_rng_data(void
 	return &__vdso_rng_data;
 }
 
-/**
- * __arch_chacha20_blocks_nostack - Generate ChaCha20 stream without using the stack.
- * @dst_bytes:	Destination buffer to hold @nblocks * 64 bytes of output.
- * @key:	32-byte input key.
- * @counter:	8-byte counter, read on input and updated on return.
- * @nblocks:	Number of blocks to generate.
- *
- * Generates a given positive number of blocks of ChaCha20 output with nonce=0, and does not write
- * to any stack or memory outside of the parameters passed to it, in order to mitigate stack data
- * leaking into forked child processes.
- */
-extern void __arch_chacha20_blocks_nostack(u8 *dst_bytes, const u32 *key, u32 *counter, size_t nblocks);
-
 #endif /* !__ASSEMBLY__ */
 
 #endif /* __ASM_VDSO_GETRANDOM_H */
diff --git a/include/vdso/getrandom.h b/include/vdso/getrandom.h
index a8b7c14b0ae0..4cf02e678f5e 100644
--- a/include/vdso/getrandom.h
+++ b/include/vdso/getrandom.h
@@ -43,4 +43,17 @@ struct vgetrandom_state {
 	bool 			in_use;
 };
 
+/**
+ * __arch_chacha20_blocks_nostack - Generate ChaCha20 stream without using the stack.
+ * @dst_bytes:	Destination buffer to hold @nblocks * 64 bytes of output.
+ * @key:	32-byte input key.
+ * @counter:	8-byte counter, read on input and updated on return.
+ * @nblocks:	Number of blocks to generate.
+ *
+ * Generates a given positive number of blocks of ChaCha20 output with nonce=0, and does not write
+ * to any stack or memory outside of the parameters passed to it, in order to mitigate stack data
+ * leaking into forked child processes.
+ */
+extern void __arch_chacha20_blocks_nostack(u8 *dst_bytes, const u32 *key, u32 *counter, size_t nblocks);
+
 #endif /* _VDSO_GETRANDOM_H */
-- 
2.46.0


  reply	other threads:[~2024-08-27 15:18 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-26 18:10 [PATCH] aarch64: vdso: Wire up getrandom() vDSO implementation Adhemerval Zanella
2024-08-26 20:27 ` Jason A. Donenfeld
2024-08-27 13:17   ` Adhemerval Zanella Netto
2024-08-27 13:34     ` Jason A. Donenfeld
2024-08-27 13:39       ` Adhemerval Zanella Netto
2024-08-27 14:00         ` Christophe Leroy
2024-08-27 14:01           ` Adhemerval Zanella Netto
2024-08-27 14:10             ` Christophe Leroy
2024-08-27 14:14               ` Adhemerval Zanella Netto
2024-08-27 14:28                 ` Jason A. Donenfeld
2024-08-27 14:30                   ` Adhemerval Zanella Netto
2024-08-27 14:32                     ` Jason A. Donenfeld
2024-08-27 14:35                       ` Adhemerval Zanella Netto
2024-08-27 14:41                         ` [PATCH] selftests/vDSO: separate LDLIBS from CFLAGS for libsodium Jason A. Donenfeld
2024-08-27 14:45                           ` Adhemerval Zanella Netto
2024-08-27 14:52                             ` Jason A. Donenfeld
2024-08-27 13:52     ` [PATCH] aarch64: vdso: Wire up getrandom() vDSO implementation Christophe Leroy
2024-08-26 20:55 ` Jason A. Donenfeld
2024-08-27  8:46 ` Christophe Leroy
2024-08-27  8:53   ` Jason A. Donenfeld
2024-08-27 15:16     ` Jason A. Donenfeld
2024-08-27 15:18       ` Jason A. Donenfeld [this message]
2024-08-27 15:47         ` [PATCH v2] random: vDSO: move prototype of arch chacha function to vdso/getrandom.h Jason A. Donenfeld
2024-08-27 16:53           ` Christophe Leroy
2024-08-27 16:55             ` Jason A. Donenfeld
2024-08-27 14:07   ` [PATCH] aarch64: vdso: Wire up getrandom() vDSO implementation Adhemerval Zanella Netto
2024-08-27 13:51 ` Ard Biesheuvel
2024-08-27 14:00 ` Mark Rutland
2024-08-27 14:05   ` Adhemerval Zanella Netto

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=20240827151828.3326600-1-Jason@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®