xref: /linux/crypto/jitterentropy.h (revision 0fc8f6200d2313278fbf4539bbab74677c685531)
1965d7286SBen Dooks // SPDX-License-Identifier: GPL-2.0-or-later
2965d7286SBen Dooks 
3*ce260754SDavid Howells struct sha3_ctx;
459bcfd78SStephan Müller extern void *jent_kvzalloc(unsigned int len);
559bcfd78SStephan Müller extern void jent_kvzfree(void *ptr, unsigned int len);
6965d7286SBen Dooks extern void *jent_zalloc(unsigned int len);
7965d7286SBen Dooks extern void jent_zfree(void *ptr);
8965d7286SBen Dooks extern void jent_get_nstime(__u64 *out);
9*ce260754SDavid Howells void jent_hash_time(struct sha3_ctx *hash_state, __u64 time, u8 *addtl,
10bb897c55SStephan Müller 		    unsigned int addtl_len, __u64 hash_loop_cnt,
11bb897c55SStephan Müller 		    unsigned int stuck);
12*ce260754SDavid Howells void jent_read_random_block(struct sha3_ctx *hash_state, char *dst,
13*ce260754SDavid Howells 			    unsigned int dst_len);
14965d7286SBen Dooks 
15965d7286SBen Dooks struct rand_data;
1604597c8dSStephan Müller extern int jent_entropy_init(unsigned int osr, unsigned int flags,
17*ce260754SDavid Howells 			     struct sha3_ctx *hash_state,
18*ce260754SDavid Howells 			     struct rand_data *p_ec);
19965d7286SBen Dooks extern int jent_read_entropy(struct rand_data *ec, unsigned char *data,
20965d7286SBen Dooks 			     unsigned int len);
21965d7286SBen Dooks 
22*ce260754SDavid Howells extern struct rand_data *
23*ce260754SDavid Howells jent_entropy_collector_alloc(unsigned int osr, unsigned int flags,
24*ce260754SDavid Howells 			     struct sha3_ctx *hash_state);
25965d7286SBen Dooks extern void jent_entropy_collector_free(struct rand_data *entropy_collector);
2669f1c387SStephan Müller 
2769f1c387SStephan Müller #ifdef CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE
2804305f83SJoachim Vandersmissen int jent_raw_hires_entropy_store(__u64 value);
2969f1c387SStephan Müller void jent_testing_init(void);
3069f1c387SStephan Müller void jent_testing_exit(void);
3169f1c387SStephan Müller #else /* CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE */
jent_raw_hires_entropy_store(__u64 value)3204305f83SJoachim Vandersmissen static inline int jent_raw_hires_entropy_store(__u64 value) { return 0; }
jent_testing_init(void)3369f1c387SStephan Müller static inline void jent_testing_init(void) { }
jent_testing_exit(void)3469f1c387SStephan Müller static inline void jent_testing_exit(void) { }
3569f1c387SStephan Müller #endif /* CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE */
36