xref: /openbmc/linux/crypto/jitterentropy.h (revision 6db6b729)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 extern void *jent_zalloc(unsigned int len);
4 extern void jent_zfree(void *ptr);
5 extern void jent_get_nstime(__u64 *out);
6 extern int jent_hash_time(void *hash_state, __u64 time, u8 *addtl,
7 			  unsigned int addtl_len, __u64 hash_loop_cnt,
8 			  unsigned int stuck);
9 int jent_read_random_block(void *hash_state, char *dst, unsigned int dst_len);
10 
11 struct rand_data;
12 extern int jent_entropy_init(void *hash_state);
13 extern int jent_read_entropy(struct rand_data *ec, unsigned char *data,
14 			     unsigned int len);
15 
16 extern struct rand_data *jent_entropy_collector_alloc(unsigned int osr,
17 						      unsigned int flags,
18 						      void *hash_state);
19 extern void jent_entropy_collector_free(struct rand_data *entropy_collector);
20 
21 #ifdef CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE
22 int jent_raw_hires_entropy_store(__u32 value);
23 void jent_testing_init(void);
24 void jent_testing_exit(void);
25 #else /* CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE */
26 static inline int jent_raw_hires_entropy_store(__u32 value) { return 0; }
27 static inline void jent_testing_init(void) { }
28 static inline void jent_testing_exit(void) { }
29 #endif /* CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE */
30