xref: /linux/crypto/jitterentropy.h (revision 59bcfd788552504606e3eb774ae68052379396b6)
1965d7286SBen Dooks // SPDX-License-Identifier: GPL-2.0-or-later
2965d7286SBen Dooks 
3*59bcfd78SStephan Müller extern void *jent_kvzalloc(unsigned int len);
4*59bcfd78SStephan Müller extern void jent_kvzfree(void *ptr, unsigned int len);
5965d7286SBen Dooks extern void *jent_zalloc(unsigned int len);
6965d7286SBen Dooks extern void jent_zfree(void *ptr);
7965d7286SBen Dooks extern void jent_get_nstime(__u64 *out);
8bb897c55SStephan Müller extern int jent_hash_time(void *hash_state, __u64 time, u8 *addtl,
9bb897c55SStephan Müller 			  unsigned int addtl_len, __u64 hash_loop_cnt,
10bb897c55SStephan Müller 			  unsigned int stuck);
11bb897c55SStephan Müller int jent_read_random_block(void *hash_state, char *dst, unsigned int dst_len);
12965d7286SBen Dooks 
13965d7286SBen Dooks struct rand_data;
1404597c8dSStephan Müller extern int jent_entropy_init(unsigned int osr, unsigned int flags,
1504597c8dSStephan Müller 			     void *hash_state);
16965d7286SBen Dooks extern int jent_read_entropy(struct rand_data *ec, unsigned char *data,
17965d7286SBen Dooks 			     unsigned int len);
18965d7286SBen Dooks 
19965d7286SBen Dooks extern struct rand_data *jent_entropy_collector_alloc(unsigned int osr,
20bb897c55SStephan Müller 						      unsigned int flags,
21bb897c55SStephan Müller 						      void *hash_state);
22965d7286SBen Dooks extern void jent_entropy_collector_free(struct rand_data *entropy_collector);
2369f1c387SStephan Müller 
2469f1c387SStephan Müller #ifdef CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE
2569f1c387SStephan Müller int jent_raw_hires_entropy_store(__u32 value);
2669f1c387SStephan Müller void jent_testing_init(void);
2769f1c387SStephan Müller void jent_testing_exit(void);
2869f1c387SStephan Müller #else /* CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE */
2969f1c387SStephan Müller static inline int jent_raw_hires_entropy_store(__u32 value) { return 0; }
3069f1c387SStephan Müller static inline void jent_testing_init(void) { }
3169f1c387SStephan Müller static inline void jent_testing_exit(void) { }
3269f1c387SStephan Müller #endif /* CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE */
33