mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 22:21:42 +00:00
59bcfd7885
The memory size consumed by the Jitter RNG is one contributing factor in the amount of entropy that is gathered. As the amount of entropy directly correlates with the distance of the memory from the CPU, the caches that are possibly present on a given system have an impact on the collected entropy. Thus, the kernel compile time should offer a means to configure the amount of memory used by the Jitter RNG. Although this option could be turned into a runtime option (e.g. a kernel command line option), it should remain a compile time option as otherwise adminsitrators who may not have performed an entropy assessment may select a value that is inappropriate. The default value selected by the configuration is identical to the current Jitter RNG value. Thus, the patch should not lead to any change in the Jitter RNG behavior. To accommodate larger memory buffers, kvzalloc / kvfree is used. Signed-off-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
33 lines
1.3 KiB
C
33 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
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);
|
|
extern int jent_hash_time(void *hash_state, __u64 time, u8 *addtl,
|
|
unsigned int addtl_len, __u64 hash_loop_cnt,
|
|
unsigned int stuck);
|
|
int jent_read_random_block(void *hash_state, char *dst, unsigned int dst_len);
|
|
|
|
struct rand_data;
|
|
extern int jent_entropy_init(unsigned int osr, unsigned int flags,
|
|
void *hash_state);
|
|
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,
|
|
void *hash_state);
|
|
extern void jent_entropy_collector_free(struct rand_data *entropy_collector);
|
|
|
|
#ifdef CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE
|
|
int jent_raw_hires_entropy_store(__u32 value);
|
|
void jent_testing_init(void);
|
|
void jent_testing_exit(void);
|
|
#else /* CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE */
|
|
static inline int jent_raw_hires_entropy_store(__u32 value) { return 0; }
|
|
static inline void jent_testing_init(void) { }
|
|
static inline void jent_testing_exit(void) { }
|
|
#endif /* CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE */
|