Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d3c91d90 authored by Eric Biggers's avatar Eric Biggers Committed by Greg Kroah-Hartman
Browse files

ANDROID: revert some RNG function signature changes



v4.19.249 changed the len argument of get_random_bytes() from int to
size_t, and the buf argument of add_hwgenerator_randomness() from
'const char *' to 'const void *'.  As these functions are part of the
GKI ABI that must be preserved, restore the old signatures.
get_random_bytes() should never be called with a length greater than
INT_MAX anyway, so it's fine to keep the old signature.

Bug: 161946584
Fixes: 08b70638 ("random: use hash function for crng_slow_load()")
Change-Id: I0749bf3596eae9732e1ae2a8264ad0ca542dd3a3
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
parent 72397113
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -432,7 +432,7 @@ static void _get_random_bytes(void *buf, size_t len)
 * wait_for_random_bytes() should be called and return 0 at least once
 * at any point prior.
 */
void get_random_bytes(void *buf, size_t len)
void get_random_bytes(void *buf, int len)
{
	warn_unseeded_randomness();
	_get_random_bytes(buf, len);
@@ -864,7 +864,7 @@ EXPORT_SYMBOL(add_device_randomness);
 * Those devices may produce endless random bits and will be throttled
 * when our pool is full.
 */
void add_hwgenerator_randomness(const void *buf, size_t len, size_t entropy)
void add_hwgenerator_randomness(const char *buf, size_t len, size_t entropy)
{
	mix_pool_bytes(buf, len);
	credit_init_bits(entropy);
+2 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ void __init add_bootloader_randomness(const void *buf, size_t len);
void add_input_randomness(unsigned int type, unsigned int code,
			  unsigned int value) __latent_entropy;
void add_interrupt_randomness(int irq) __latent_entropy;
void add_hwgenerator_randomness(const void *buf, size_t len, size_t entropy);
void add_hwgenerator_randomness(const char *buf, size_t len, size_t entropy);

#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__)
static inline void add_latent_entropy(void)
@@ -28,7 +28,7 @@ static inline void add_latent_entropy(void)
static inline void add_latent_entropy(void) { }
#endif

void get_random_bytes(void *buf, size_t len);
void get_random_bytes(void *buf, int len);
size_t __must_check get_random_bytes_arch(void *buf, size_t len);
u32 get_random_u32(void);
u64 get_random_u64(void);