summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/random.c62
1 files changed, 45 insertions, 17 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index b423214..5dc7ad8 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -192,14 +192,30 @@
* Exported interfaces ---- sysctl
* ===============================
- * /proc/sys/kernel/random/poolsize (read only) reports the size of
- * the input pool. Since 2.6.12 this is measured in bits. Previously
- * it was measured in bytes. Note that the blocking pool and the
- * nonblocking pool are 4x smaller than the input pool.
+ * files in /proc/sys/kernel/random :
- * /proc/sys/kernel/random/entropy_avail (read only) reports the total
- * amount of stored entropy, measured in bits. This includes entropy
- * stored in both the input pool and the blocking pool.
+ * .../poolsize (read only) -- reports the size of the input pool. Since
+ * 2.6.12 this is measured in bits. Previously it was measured in
+ * bytes. Note that the blocking pool and the nonblocking pool are 4x
+ * smaller than the input pool.
+
+ * .../entropy_avail (read only) -- reports the total amount of stored
+ * entropy, measured in bits. This includes entropy stored in both
+ * the input pool and the blocking pool.
+
+ * .../entropy_avail_input .../entropy_avail_random
+ * .../entropy_avail_urandom (r/w) -- same as above, but report the
+ * content of each pool separately
+
+ * .../extracted_total_input .../extracted_total_random
+ * .../extracted_total_urandom (r/w) -- report the total number of
+ * bits of randomness extracted from the pool since the start of
+ * operation.
+
+ * .../extracted_subttl_input .../extracted_subttl_random
+ * .../extracted_subttl_urandom (r/w) -- report the number of bits of
+ * randomness extracted from the pool since the last time it was
+ * reseeded. This is particularly significant for /dev/urandom
* Exported interfaces ---- ioctl
* ===============================
@@ -1381,11 +1397,17 @@ random_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
{
ssize_t n, retval = 0, count = 0;
+ if (nbytes == 0){
+#ifdef OVERCOMPLICATED
/*
* Kludge: zero-byte read: Fill the pool from upstream sources.
+ * Problem: this doesn't happen often enough.
+ * You can make it happen from userland, but that's a kludge,
+ * suitable for testing ideas, but not a long-term solution.
*/
- if (nbytes == 0){
+
fill_pool(&devrand_pool, 0);
+#endif
return 0;
}
@@ -1669,63 +1691,69 @@ struct ctl_table random_table[] = {
.data = &total_entropy_count,
},
{
- .procname = "entropy_avail_inp",
+ .procname = "entropy_avail_input",
.maxlen = sizeof(int),
.mode = 0444,
.proc_handler = proc_dointvec,
.data = &input_pool.entropy_count,
},
+#ifdef OVERCOMPLICATED
{
- .procname = "entropy_avail_r",
+ .procname = "entropy_avail_random",
.maxlen = sizeof(int),
.mode = 0444,
.proc_handler = proc_dointvec,
.data = &devrand_pool.entropy_count,
},
+#endif
{
- .procname = "entropy_avail_ur",
+ .procname = "entropy_avail_urandom",
.maxlen = sizeof(int),
.mode = 0444,
.proc_handler = proc_dointvec,
.data = &prng_pool.entropy_count,
},
{
- .procname = "extracted_total_inp",
+ .procname = "extracted_total_input",
.maxlen = sizeof(ulonglong),
.mode = 0644,
.proc_handler = proc_doulonglongvec_minmax,
.data = &input_pool.extracted_total,
},
+#ifdef OVERCOMPLICATED
{
- .procname = "extracted_total_r",
+ .procname = "extracted_total_random",
.maxlen = sizeof(ulonglong),
.mode = 0644,
.proc_handler = proc_doulonglongvec_minmax,
.data = &devrand_pool.extracted_total,
},
+#endif
{
- .procname = "extracted_total_ur",
+ .procname = "extracted_total_urandom",
.maxlen = sizeof(ulonglong),
.mode = 0644,
.proc_handler = proc_doulonglongvec_minmax,
.data = &prng_pool.extracted_total,
},
{
- .procname = "extracted_subttl_inp",
+ .procname = "extracted_subttl_input",
.maxlen = sizeof(ulonglong),
.mode = 0644,
.proc_handler = proc_doulonglongvec_minmax,
.data = &input_pool.extracted_subttl,
},
+#ifdef OVERCOMPLICATED
{
- .procname = "extracted_subttl_r",
+ .procname = "extracted_subttl_random",
.maxlen = sizeof(ulonglong),
.mode = 0644,
.proc_handler = proc_doulonglongvec_minmax,
.data = &devrand_pool.extracted_subttl,
},
+#endif
{
- .procname = "extracted_subttl_ur",
+ .procname = "extracted_subttl_urandom",
.maxlen = sizeof(ulonglong),
.mode = 0644,
.proc_handler = proc_doulonglongvec_minmax,