rng.h 1021 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * RNG: Random Number Generator algorithms under the crypto API
  4. *
  5. * Copyright (c) 2008 Neil Horman <[email protected]>
  6. * Copyright (c) 2015 Herbert Xu <[email protected]>
  7. */
  8. #ifndef _CRYPTO_INTERNAL_RNG_H
  9. #define _CRYPTO_INTERNAL_RNG_H
  10. #include <crypto/algapi.h>
  11. #include <crypto/rng.h>
  12. int crypto_register_rng(struct rng_alg *alg);
  13. void crypto_unregister_rng(struct rng_alg *alg);
  14. int crypto_register_rngs(struct rng_alg *algs, int count);
  15. void crypto_unregister_rngs(struct rng_alg *algs, int count);
  16. #if defined(CONFIG_CRYPTO_RNG) || defined(CONFIG_CRYPTO_RNG_MODULE)
  17. int crypto_del_default_rng(void);
  18. #else
  19. static inline int crypto_del_default_rng(void)
  20. {
  21. return 0;
  22. }
  23. #endif
  24. static inline void *crypto_rng_ctx(struct crypto_rng *tfm)
  25. {
  26. return crypto_tfm_ctx(&tfm->base);
  27. }
  28. static inline void crypto_rng_set_entropy(struct crypto_rng *tfm,
  29. const u8 *data, unsigned int len)
  30. {
  31. crypto_rng_alg(tfm)->set_ent(tfm, data, len);
  32. }
  33. #endif