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