~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/hw_random.h

Version: ~ [ linux-5.2 ] ~ [ linux-5.1.16 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.57 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.132 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.184 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.184 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.69 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2         Hardware Random Number Generator
  3 
  4         Please read Documentation/hw_random.txt for details on use.
  5 
  6         ----------------------------------------------------------
  7         This software may be used and distributed according to the terms
  8         of the GNU General Public License, incorporated herein by reference.
  9 
 10  */
 11 
 12 #ifndef LINUX_HWRANDOM_H_
 13 #define LINUX_HWRANDOM_H_
 14 
 15 #include <linux/completion.h>
 16 #include <linux/types.h>
 17 #include <linux/list.h>
 18 #include <linux/kref.h>
 19 
 20 /**
 21  * struct hwrng - Hardware Random Number Generator driver
 22  * @name:               Unique RNG name.
 23  * @init:               Initialization callback (can be NULL).
 24  * @cleanup:            Cleanup callback (can be NULL).
 25  * @data_present:       Callback to determine if data is available
 26  *                      on the RNG. If NULL, it is assumed that
 27  *                      there is always data available.  *OBSOLETE*
 28  * @data_read:          Read data from the RNG device.
 29  *                      Returns the number of lower random bytes in "data".
 30  *                      Must not be NULL.    *OBSOLETE*
 31  * @read:               New API. drivers can fill up to max bytes of data
 32  *                      into the buffer. The buffer is aligned for any type
 33  *                      and max is a multiple of 4 and >= 32 bytes.
 34  * @priv:               Private data, for use by the RNG driver.
 35  * @quality:            Estimation of true entropy in RNG's bitstream
 36  *                      (per mill).
 37  */
 38 struct hwrng {
 39         const char *name;
 40         int (*init)(struct hwrng *rng);
 41         void (*cleanup)(struct hwrng *rng);
 42         int (*data_present)(struct hwrng *rng, int wait);
 43         int (*data_read)(struct hwrng *rng, u32 *data);
 44         int (*read)(struct hwrng *rng, void *data, size_t max, bool wait);
 45         unsigned long priv;
 46         unsigned short quality;
 47 
 48         /* internal. */
 49         struct list_head list;
 50         struct kref ref;
 51         struct completion cleanup_done;
 52 };
 53 
 54 struct device;
 55 
 56 /** Register a new Hardware Random Number Generator driver. */
 57 extern int hwrng_register(struct hwrng *rng);
 58 extern int devm_hwrng_register(struct device *dev, struct hwrng *rng);
 59 /** Unregister a Hardware Random Number Generator driver. */
 60 extern void hwrng_unregister(struct hwrng *rng);
 61 extern void devm_hwrng_unregister(struct device *dve, struct hwrng *rng);
 62 /** Feed random bits into the pool. */
 63 extern void add_hwgenerator_randomness(const char *buffer, size_t count, size_t entropy);
 64 
 65 #endif /* LINUX_HWRANDOM_H_ */
 66 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp