162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
262306a36Sopenharmony_ci
362306a36Sopenharmony_ciextern void *jent_zalloc(unsigned int len);
462306a36Sopenharmony_ciextern void jent_zfree(void *ptr);
562306a36Sopenharmony_ciextern void jent_get_nstime(__u64 *out);
662306a36Sopenharmony_ciextern int jent_hash_time(void *hash_state, __u64 time, u8 *addtl,
762306a36Sopenharmony_ci			  unsigned int addtl_len, __u64 hash_loop_cnt,
862306a36Sopenharmony_ci			  unsigned int stuck);
962306a36Sopenharmony_ciint jent_read_random_block(void *hash_state, char *dst, unsigned int dst_len);
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_cistruct rand_data;
1262306a36Sopenharmony_ciextern int jent_entropy_init(void *hash_state);
1362306a36Sopenharmony_ciextern int jent_read_entropy(struct rand_data *ec, unsigned char *data,
1462306a36Sopenharmony_ci			     unsigned int len);
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ciextern struct rand_data *jent_entropy_collector_alloc(unsigned int osr,
1762306a36Sopenharmony_ci						      unsigned int flags,
1862306a36Sopenharmony_ci						      void *hash_state);
1962306a36Sopenharmony_ciextern void jent_entropy_collector_free(struct rand_data *entropy_collector);
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#ifdef CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE
2262306a36Sopenharmony_ciint jent_raw_hires_entropy_store(__u32 value);
2362306a36Sopenharmony_civoid jent_testing_init(void);
2462306a36Sopenharmony_civoid jent_testing_exit(void);
2562306a36Sopenharmony_ci#else /* CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE */
2662306a36Sopenharmony_cistatic inline int jent_raw_hires_entropy_store(__u32 value) { return 0; }
2762306a36Sopenharmony_cistatic inline void jent_testing_init(void) { }
2862306a36Sopenharmony_cistatic inline void jent_testing_exit(void) { }
2962306a36Sopenharmony_ci#endif /* CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE */
30