Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * RNG: Random Number Generator  algorithms under the crypto API
0004  *
0005  * Copyright (c) 2008 Neil Horman <nhorman@tuxdriver.com>
0006  * Copyright (c) 2015 Herbert Xu <herbert@gondor.apana.org.au>
0007  */
0008 
0009 #ifndef _CRYPTO_INTERNAL_RNG_H
0010 #define _CRYPTO_INTERNAL_RNG_H
0011 
0012 #include <crypto/algapi.h>
0013 #include <crypto/rng.h>
0014 
0015 int crypto_register_rng(struct rng_alg *alg);
0016 void crypto_unregister_rng(struct rng_alg *alg);
0017 int crypto_register_rngs(struct rng_alg *algs, int count);
0018 void crypto_unregister_rngs(struct rng_alg *algs, int count);
0019 
0020 #if defined(CONFIG_CRYPTO_RNG) || defined(CONFIG_CRYPTO_RNG_MODULE)
0021 int crypto_del_default_rng(void);
0022 #else
0023 static inline int crypto_del_default_rng(void)
0024 {
0025     return 0;
0026 }
0027 #endif
0028 
0029 static inline void *crypto_rng_ctx(struct crypto_rng *tfm)
0030 {
0031     return crypto_tfm_ctx(&tfm->base);
0032 }
0033 
0034 static inline void crypto_rng_set_entropy(struct crypto_rng *tfm,
0035                       const u8 *data, unsigned int len)
0036 {
0037     crypto_rng_alg(tfm)->set_ent(tfm, data, len);
0038 }
0039 
0040 #endif