mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
Make the jitterentropy RNG use the SHA-3 library API instead of crypto_shash. This ends up being quite a bit simpler, as various dynamic allocations and error checks become unnecessary. Signed-off-by: David Howells <dhowells@redhat.com> Co-developed-by: Eric Biggers <ebiggers@kernel.org> Acked-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20260226010005.43528-1-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
36 lines
1.4 KiB
C
36 lines
1.4 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
struct sha3_ctx;
|
|
extern void *jent_kvzalloc(unsigned int len);
|
|
extern void jent_kvzfree(void *ptr, unsigned int len);
|
|
extern void *jent_zalloc(unsigned int len);
|
|
extern void jent_zfree(void *ptr);
|
|
extern void jent_get_nstime(__u64 *out);
|
|
void jent_hash_time(struct sha3_ctx *hash_state, __u64 time, u8 *addtl,
|
|
unsigned int addtl_len, __u64 hash_loop_cnt,
|
|
unsigned int stuck);
|
|
void jent_read_random_block(struct sha3_ctx *hash_state, char *dst,
|
|
unsigned int dst_len);
|
|
|
|
struct rand_data;
|
|
extern int jent_entropy_init(unsigned int osr, unsigned int flags,
|
|
struct sha3_ctx *hash_state,
|
|
struct rand_data *p_ec);
|
|
extern int jent_read_entropy(struct rand_data *ec, unsigned char *data,
|
|
unsigned int len);
|
|
|
|
extern struct rand_data *
|
|
jent_entropy_collector_alloc(unsigned int osr, unsigned int flags,
|
|
struct sha3_ctx *hash_state);
|
|
extern void jent_entropy_collector_free(struct rand_data *entropy_collector);
|
|
|
|
#ifdef CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE
|
|
int jent_raw_hires_entropy_store(__u64 value);
|
|
void jent_testing_init(void);
|
|
void jent_testing_exit(void);
|
|
#else /* CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE */
|
|
static inline int jent_raw_hires_entropy_store(__u64 value) { return 0; }
|
|
static inline void jent_testing_init(void) { }
|
|
static inline void jent_testing_exit(void) { }
|
|
#endif /* CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE */
|