linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] random: pull add_hwgenerator_randomness() declaration into random.h
@ 2022-02-13 15:25 Jason A. Donenfeld
  2022-02-13 15:33 ` Jason A. Donenfeld
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Jason A. Donenfeld @ 2022-02-13 15:25 UTC (permalink / raw)
  To: linux-kernel, linux, herbert, linux-crypto
  Cc: Jason A. Donenfeld, Matt Mackall, Kalle Valo, ath9k-devel,
	Theodore Ts'o

add_hwgenerator_randomness() is a function implemented and documented
inside of random.c. It is the way that hardware RNGs push data into it.
Therefore, it should be declared in random.h. Otherwise sparse complains
with:

random.c:1137:6: warning: symbol 'add_hwgenerator_randomness' was not declared. Should it be static?

The alternative would be to include hw_random.h into random.c, but that
wouldn't really be good for anything except slowing down compile time.

Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-crypto@vger.kernel.org
Cc: Kalle Valo <kvalo@kernel.org>
Cc: ath9k-devel@qca.qualcomm.com
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/char/hw_random/core.c        | 1 +
 drivers/net/wireless/ath/ath9k/rng.c | 1 +
 include/linux/hw_random.h            | 2 --
 include/linux/random.h               | 2 ++
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index a3db27916256..cfb085de876b 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -15,6 +15,7 @@
 #include <linux/err.h>
 #include <linux/fs.h>
 #include <linux/hw_random.h>
+#include <linux/random.h>
 #include <linux/kernel.h>
 #include <linux/kthread.h>
 #include <linux/sched/signal.h>
diff --git a/drivers/net/wireless/ath/ath9k/rng.c b/drivers/net/wireless/ath/ath9k/rng.c
index f9d3d6eedd3c..aae2bd3cac69 100644
--- a/drivers/net/wireless/ath/ath9k/rng.c
+++ b/drivers/net/wireless/ath/ath9k/rng.c
@@ -15,6 +15,7 @@
  */
 
 #include <linux/hw_random.h>
+#include <linux/random.h>
 #include <linux/kthread.h>
 
 #include "ath9k.h"
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index 1a9fc38f8938..aa1d4da03538 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -60,7 +60,5 @@ extern int devm_hwrng_register(struct device *dev, struct hwrng *rng);
 /** Unregister a Hardware Random Number Generator driver. */
 extern void hwrng_unregister(struct hwrng *rng);
 extern void devm_hwrng_unregister(struct device *dve, struct hwrng *rng);
-/** Feed random bits into the pool. */
-extern void add_hwgenerator_randomness(const void *buffer, size_t count, size_t entropy);
 
 #endif /* LINUX_HWRANDOM_H_ */
diff --git a/include/linux/random.h b/include/linux/random.h
index 37e1e8c43d7e..d7354de9351e 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -32,6 +32,8 @@ static inline void add_latent_entropy(void) {}
 extern void add_input_randomness(unsigned int type, unsigned int code,
 				 unsigned int value) __latent_entropy;
 extern void add_interrupt_randomness(int irq) __latent_entropy;
+extern void add_hwgenerator_randomness(const void *buffer, size_t count,
+				       size_t entropy);
 
 extern void get_random_bytes(void *buf, size_t nbytes);
 extern int wait_for_random_bytes(void);

base-commit: 1b057ea07bdc88c5ab77cb9a9bc46f8690492c81
prerequisite-patch-id: 722401baa02ea28022621588a48b701d116c0ad5
prerequisite-patch-id: 8da951eeda7c2b69ccf9de465f6e33b6a32d1b8a
prerequisite-patch-id: b252828d4fa0211224b7cac57b7a40a26847caf3
prerequisite-patch-id: ac9dc6b642ecfd8d42394b06d7757e4076da3a35
prerequisite-patch-id: aecaed912a18486ea6743ef94d86683d6ce35320
prerequisite-patch-id: 74e4aea70835f508339e5223f1b01266698f1173
prerequisite-patch-id: c315d7e54165666dae309e3ac6d5e666c6c97a33
prerequisite-patch-id: 9b8f505cf7f6b605ba5143c801e3487149481cde
prerequisite-patch-id: 7e48a52a3947c9d0d73a9867a7a3fb403e0e18ff
prerequisite-patch-id: 6c5c60bf502f7691087241c32c3a898135783ea0
prerequisite-patch-id: 80b04855c1ec5315d175cda682f528dab5db13ca
prerequisite-patch-id: 00ec3b71c3fe248d55b00f1b210f029a221f295a
prerequisite-patch-id: bac900c80e57d5fd5234b81a51359a76b378a9e9
prerequisite-patch-id: d2c04ce2d5667557c6d863fb26ad046a16b86f7b
prerequisite-patch-id: 4d98a7945c6dce30c3630f4668aa4b32ca53c971
prerequisite-patch-id: bd93293024b6ad54ffaf1ae5bee3d805961e310d
prerequisite-patch-id: e17118e66c1761f954fac49822231986f429e996
prerequisite-patch-id: dca680875ff2a505bc35d8999fa18832d6cc378e
prerequisite-patch-id: 798e5c78bbc4c0e1748a64496e4b139b6d5c85bf
prerequisite-patch-id: d41dada11f57459add7e28d4a8714929b9ed07f8
prerequisite-patch-id: a3159bc3b25f67ab0fb409dfc86373e3b6c3bc5e
prerequisite-patch-id: 6d069efe964e32e90ac052183360f3b8e78fd6bd
prerequisite-patch-id: 56253c1e4f608de542e26e5201f476a6e33c0166
prerequisite-patch-id: 4cdc3b96e517592d6fdf493baaa49e032f0788c9
prerequisite-patch-id: 4a7abc91a7dc1f6fdfb6a1bf310e0aeffee284ec
-- 
2.35.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] random: pull add_hwgenerator_randomness() declaration into random.h
  2022-02-13 15:25 [PATCH] random: pull add_hwgenerator_randomness() declaration into random.h Jason A. Donenfeld
@ 2022-02-13 15:33 ` Jason A. Donenfeld
  2022-02-13 19:42 ` Dominik Brodowski
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Jason A. Donenfeld @ 2022-02-13 15:33 UTC (permalink / raw)
  To: LKML, Dominik Brodowski, Herbert Xu, Linux Crypto Mailing List
  Cc: Matt Mackall, Kalle Valo, ath9k-devel, Theodore Ts'o

On Sun, Feb 13, 2022 at 4:25 PM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> base-commit: 1b057ea07bdc88c5ab77cb9a9bc46f8690492c81
> prerequisite-patch-id: 722401baa02ea28022621588a48b701d116c0ad5
> prerequisite-patch-id: 8da951eeda7c2b69ccf9de465f6e33b6a32d1b8a
> prerequisite-patch-id: b252828d4fa0211224b7cac57b7a40a26847caf3
> prerequisite-patch-id: ac9dc6b642ecfd8d42394b06d7757e4076da3a35
> prerequisite-patch-id: aecaed912a18486ea6743ef94d86683d6ce35320
> prerequisite-patch-id: 74e4aea70835f508339e5223f1b01266698f1173
> prerequisite-patch-id: c315d7e54165666dae309e3ac6d5e666c6c97a33
> prerequisite-patch-id: 9b8f505cf7f6b605ba5143c801e3487149481cde
> prerequisite-patch-id: 7e48a52a3947c9d0d73a9867a7a3fb403e0e18ff
> prerequisite-patch-id: 6c5c60bf502f7691087241c32c3a898135783ea0
> prerequisite-patch-id: 80b04855c1ec5315d175cda682f528dab5db13ca
> prerequisite-patch-id: 00ec3b71c3fe248d55b00f1b210f029a221f295a
> prerequisite-patch-id: bac900c80e57d5fd5234b81a51359a76b378a9e9
> prerequisite-patch-id: d2c04ce2d5667557c6d863fb26ad046a16b86f7b
> prerequisite-patch-id: 4d98a7945c6dce30c3630f4668aa4b32ca53c971
> prerequisite-patch-id: bd93293024b6ad54ffaf1ae5bee3d805961e310d
> prerequisite-patch-id: e17118e66c1761f954fac49822231986f429e996
> prerequisite-patch-id: dca680875ff2a505bc35d8999fa18832d6cc378e
> prerequisite-patch-id: 798e5c78bbc4c0e1748a64496e4b139b6d5c85bf
> prerequisite-patch-id: d41dada11f57459add7e28d4a8714929b9ed07f8
> prerequisite-patch-id: a3159bc3b25f67ab0fb409dfc86373e3b6c3bc5e
> prerequisite-patch-id: 6d069efe964e32e90ac052183360f3b8e78fd6bd
> prerequisite-patch-id: 56253c1e4f608de542e26e5201f476a6e33c0166
> prerequisite-patch-id: 4cdc3b96e517592d6fdf493baaa49e032f0788c9
> prerequisite-patch-id: 4a7abc91a7dc1f6fdfb6a1bf310e0aeffee284ec

Git's automatic things went crazy; please discard this part of the patch.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] random: pull add_hwgenerator_randomness() declaration into random.h
  2022-02-13 15:25 [PATCH] random: pull add_hwgenerator_randomness() declaration into random.h Jason A. Donenfeld
  2022-02-13 15:33 ` Jason A. Donenfeld
@ 2022-02-13 19:42 ` Dominik Brodowski
  2022-02-14 11:43 ` Kalle Valo
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Dominik Brodowski @ 2022-02-13 19:42 UTC (permalink / raw)
  To: Jason A. Donenfeld
  Cc: linux-kernel, herbert, linux-crypto, Matt Mackall, Kalle Valo,
	ath9k-devel, Theodore Ts'o

Am Sun, Feb 13, 2022 at 04:25:22PM +0100 schrieb Jason A. Donenfeld:
> add_hwgenerator_randomness() is a function implemented and documented
> inside of random.c. It is the way that hardware RNGs push data into it.
> Therefore, it should be declared in random.h. Otherwise sparse complains
> with:
> 
> random.c:1137:6: warning: symbol 'add_hwgenerator_randomness' was not declared. Should it be static?
> 
> The alternative would be to include hw_random.h into random.c, but that
> wouldn't really be good for anything except slowing down compile time.

Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] random: pull add_hwgenerator_randomness() declaration into random.h
  2022-02-13 15:25 [PATCH] random: pull add_hwgenerator_randomness() declaration into random.h Jason A. Donenfeld
  2022-02-13 15:33 ` Jason A. Donenfeld
  2022-02-13 19:42 ` Dominik Brodowski
@ 2022-02-14 11:43 ` Kalle Valo
  2022-02-16 11:43   ` Jason A. Donenfeld
  2022-02-18  4:27 ` Herbert Xu
  2022-02-21  5:52 ` Eric Biggers
  4 siblings, 1 reply; 7+ messages in thread
From: Kalle Valo @ 2022-02-14 11:43 UTC (permalink / raw)
  To: Jason A. Donenfeld
  Cc: linux-kernel, linux, herbert, linux-crypto, Matt Mackall,
	ath9k-devel, Theodore Ts'o

"Jason A. Donenfeld" <Jason@zx2c4.com> writes:

> add_hwgenerator_randomness() is a function implemented and documented
> inside of random.c. It is the way that hardware RNGs push data into it.
> Therefore, it should be declared in random.h. Otherwise sparse complains
> with:
>
> random.c:1137:6: warning: symbol 'add_hwgenerator_randomness' was not declared. Should it be static?
>
> The alternative would be to include hw_random.h into random.c, but that
> wouldn't really be good for anything except slowing down compile time.
>
> Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> Cc: Matt Mackall <mpm@selenic.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: linux-crypto@vger.kernel.org
> Cc: Kalle Valo <kvalo@kernel.org>
> Cc: ath9k-devel@qca.qualcomm.com
> Cc: Theodore Ts'o <tytso@mit.edu>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
>  drivers/char/hw_random/core.c        | 1 +
>  drivers/net/wireless/ath/ath9k/rng.c | 1 +

For ath9k:

Acked-by: Kalle Valo <kvalo@kernel.org>

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] random: pull add_hwgenerator_randomness() declaration into random.h
  2022-02-14 11:43 ` Kalle Valo
@ 2022-02-16 11:43   ` Jason A. Donenfeld
  0 siblings, 0 replies; 7+ messages in thread
From: Jason A. Donenfeld @ 2022-02-16 11:43 UTC (permalink / raw)
  To: Kalle Valo
  Cc: LKML, Dominik Brodowski, Herbert Xu, Linux Crypto Mailing List,
	Matt Mackall, ath9k-devel, Theodore Ts'o

Hi Kalle,

In light of https://lore.kernel.org/lkml/20220216113323.53332-1-Jason@zx2c4.com/
I'm going to drop the ath9k part of this patch here (and your Ack
along with it), so that there's no chance of merge conflict. It turns
out that the header that this patch added isn't 100% required because
it includes "hw.h" which includes <linux/if_ether.h> which includes
<linux/skbuff.h> which includes <linux/net.h> which includes
<linux/random.h>. So at least if there are a few commits between my
change going in and the driver rewrite from that other patch, the
build won't break.

Jason

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] random: pull add_hwgenerator_randomness() declaration into random.h
  2022-02-13 15:25 [PATCH] random: pull add_hwgenerator_randomness() declaration into random.h Jason A. Donenfeld
                   ` (2 preceding siblings ...)
  2022-02-14 11:43 ` Kalle Valo
@ 2022-02-18  4:27 ` Herbert Xu
  2022-02-21  5:52 ` Eric Biggers
  4 siblings, 0 replies; 7+ messages in thread
From: Herbert Xu @ 2022-02-18  4:27 UTC (permalink / raw)
  To: Jason A. Donenfeld
  Cc: linux-kernel, linux, linux-crypto, Matt Mackall, Kalle Valo,
	ath9k-devel, Theodore Ts'o

On Sun, Feb 13, 2022 at 04:25:22PM +0100, Jason A. Donenfeld wrote:
> add_hwgenerator_randomness() is a function implemented and documented
> inside of random.c. It is the way that hardware RNGs push data into it.
> Therefore, it should be declared in random.h. Otherwise sparse complains
> with:
> 
> random.c:1137:6: warning: symbol 'add_hwgenerator_randomness' was not declared. Should it be static?
> 
> The alternative would be to include hw_random.h into random.c, but that
> wouldn't really be good for anything except slowing down compile time.
> 
> Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> Cc: Matt Mackall <mpm@selenic.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: linux-crypto@vger.kernel.org
> Cc: Kalle Valo <kvalo@kernel.org>
> Cc: ath9k-devel@qca.qualcomm.com
> Cc: Theodore Ts'o <tytso@mit.edu>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
>  drivers/char/hw_random/core.c        | 1 +
>  drivers/net/wireless/ath/ath9k/rng.c | 1 +
>  include/linux/hw_random.h            | 2 --
>  include/linux/random.h               | 2 ++
>  4 files changed, 4 insertions(+), 2 deletions(-)

Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] random: pull add_hwgenerator_randomness() declaration into random.h
  2022-02-13 15:25 [PATCH] random: pull add_hwgenerator_randomness() declaration into random.h Jason A. Donenfeld
                   ` (3 preceding siblings ...)
  2022-02-18  4:27 ` Herbert Xu
@ 2022-02-21  5:52 ` Eric Biggers
  4 siblings, 0 replies; 7+ messages in thread
From: Eric Biggers @ 2022-02-21  5:52 UTC (permalink / raw)
  To: Jason A. Donenfeld
  Cc: linux-kernel, linux, herbert, linux-crypto, Matt Mackall,
	Kalle Valo, ath9k-devel, Theodore Ts'o

On Sun, Feb 13, 2022 at 04:25:22PM +0100, Jason A. Donenfeld wrote:
> add_hwgenerator_randomness() is a function implemented and documented
> inside of random.c. It is the way that hardware RNGs push data into it.
> Therefore, it should be declared in random.h. Otherwise sparse complains
> with:
> 
> random.c:1137:6: warning: symbol 'add_hwgenerator_randomness' was not declared. Should it be static?
> 
> The alternative would be to include hw_random.h into random.c, but that
> wouldn't really be good for anything except slowing down compile time.
> 
> Cc: Dominik Brodowski <linux@dominikbrodowski.net>
> Cc: Matt Mackall <mpm@selenic.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: linux-crypto@vger.kernel.org
> Cc: Kalle Valo <kvalo@kernel.org>
> Cc: ath9k-devel@qca.qualcomm.com
> Cc: Theodore Ts'o <tytso@mit.edu>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
>  drivers/char/hw_random/core.c        | 1 +
>  drivers/net/wireless/ath/ath9k/rng.c | 1 +
>  include/linux/hw_random.h            | 2 --
>  include/linux/random.h               | 2 ++
>  4 files changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Eric Biggers <ebiggers@google.com>

- Eric

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-02-21  5:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-13 15:25 [PATCH] random: pull add_hwgenerator_randomness() declaration into random.h Jason A. Donenfeld
2022-02-13 15:33 ` Jason A. Donenfeld
2022-02-13 19:42 ` Dominik Brodowski
2022-02-14 11:43 ` Kalle Valo
2022-02-16 11:43   ` Jason A. Donenfeld
2022-02-18  4:27 ` Herbert Xu
2022-02-21  5:52 ` Eric Biggers

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).