xref: /openbmc/linux/crypto/jitterentropy.h (revision 69f1c387)
1965d7286SBen Dooks // SPDX-License-Identifier: GPL-2.0-or-later
2965d7286SBen Dooks 
3965d7286SBen Dooks extern void *jent_zalloc(unsigned int len);
4965d7286SBen Dooks extern void jent_zfree(void *ptr);
5965d7286SBen Dooks extern void jent_get_nstime(__u64 *out);
6bb897c55SStephan Müller extern int jent_hash_time(void *hash_state, __u64 time, u8 *addtl,
7bb897c55SStephan Müller 			  unsigned int addtl_len, __u64 hash_loop_cnt,
8bb897c55SStephan Müller 			  unsigned int stuck);
9bb897c55SStephan Müller int jent_read_random_block(void *hash_state, char *dst, unsigned int dst_len);
10965d7286SBen Dooks 
11965d7286SBen Dooks struct rand_data;
12bb897c55SStephan Müller extern int jent_entropy_init(void *hash_state);
13965d7286SBen Dooks extern int jent_read_entropy(struct rand_data *ec, unsigned char *data,
14965d7286SBen Dooks 			     unsigned int len);
15965d7286SBen Dooks 
16965d7286SBen Dooks extern struct rand_data *jent_entropy_collector_alloc(unsigned int osr,
17bb897c55SStephan Müller 						      unsigned int flags,
18bb897c55SStephan Müller 						      void *hash_state);
19965d7286SBen Dooks extern void jent_entropy_collector_free(struct rand_data *entropy_collector);
20*69f1c387SStephan Müller 
21*69f1c387SStephan Müller #ifdef CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE
22*69f1c387SStephan Müller int jent_raw_hires_entropy_store(__u32 value);
23*69f1c387SStephan Müller void jent_testing_init(void);
24*69f1c387SStephan Müller void jent_testing_exit(void);
25*69f1c387SStephan Müller #else /* CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE */
jent_raw_hires_entropy_store(__u32 value)26*69f1c387SStephan Müller static inline int jent_raw_hires_entropy_store(__u32 value) { return 0; }
jent_testing_init(void)27*69f1c387SStephan Müller static inline void jent_testing_init(void) { }
jent_testing_exit(void)28*69f1c387SStephan Müller static inline void jent_testing_exit(void) { }
29*69f1c387SStephan Müller #endif /* CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE */
30