Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 313529 Details for
Bug 458016
kernel: random32: seeding improvement [mrg-1]
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Upstream patch for this issue
0001-random32-seeding-improvement.patch (text/plain), 2.86 KB, created by
Eugene Teo (Security Response)
on 2008-08-06 06:22:51 UTC
(
hide
)
Description:
Upstream patch for this issue
Filename:
MIME Type:
Creator:
Eugene Teo (Security Response)
Created:
2008-08-06 06:22:51 UTC
Size:
2.86 KB
patch
obsolete
>From 697f8d0348a652593d195a13dd1067d9df911a82 Mon Sep 17 00:00:00 2001 >From: Stephen Hemminger <shemminger@vyatta.com> >Date: Wed, 30 Jul 2008 16:29:19 -0700 >Subject: [PATCH] random32: seeding improvement > >The rationale is: > * use u32 consistently > * no need to do LCG on values from (better) get_random_bytes > * use more data from get_random_bytes for secondary seeding > * don't reduce state space on srandom32() > * enforce state variable initialization restrictions > >Note: the second paper has a version of random32() with even longer period >and a version of random64() if needed. > >Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> >Signed-off-by: Andrew Morton <akpm@linux-foundation.org> >--- > lib/random32.c | 48 +++++++++++++++++++++++++++--------------------- > 1 files changed, 27 insertions(+), 21 deletions(-) > >diff --git a/lib/random32.c b/lib/random32.c >index ca87d86..217d5c4 100644 >--- a/lib/random32.c >+++ b/lib/random32.c >@@ -56,23 +56,12 @@ static u32 __random32(struct rnd_state *state) > return (state->s1 ^ state->s2 ^ state->s3); > } > >-static void __set_random32(struct rnd_state *state, unsigned long s) >+/* >+ * Handle minimum values for seeds >+ */ >+static inline u32 __seed(u32 x, u32 m) > { >- if (s == 0) >- s = 1; /* default seed is 1 */ >- >-#define LCG(n) (69069 * n) >- state->s1 = LCG(s); >- state->s2 = LCG(state->s1); >- state->s3 = LCG(state->s2); >- >- /* "warm it up" */ >- __random32(state); >- __random32(state); >- __random32(state); >- __random32(state); >- __random32(state); >- __random32(state); >+ return (x < m) ? x + m : x; > } > > /** >@@ -107,7 +96,7 @@ void srandom32(u32 entropy) > */ > for_each_possible_cpu (i) { > struct rnd_state *state = &per_cpu(net_rand_state, i); >- __set_random32(state, state->s1 ^ entropy); >+ state->s1 = __seed(state->s1 ^ entropy, 1); > } > } > EXPORT_SYMBOL(srandom32); >@@ -122,7 +111,19 @@ static int __init random32_init(void) > > for_each_possible_cpu(i) { > struct rnd_state *state = &per_cpu(net_rand_state,i); >- __set_random32(state, i + jiffies); >+ >+#define LCG(x) ((x) * 69069) /* super-duper LCG */ >+ state->s1 = __seed(LCG(i + jiffies), 1); >+ state->s2 = __seed(LCG(state->s1), 7); >+ state->s3 = __seed(LCG(state->s2), 15); >+ >+ /* "warm it up" */ >+ __random32(state); >+ __random32(state); >+ __random32(state); >+ __random32(state); >+ __random32(state); >+ __random32(state); > } > return 0; > } >@@ -135,13 +136,18 @@ core_initcall(random32_init); > static int __init random32_reseed(void) > { > int i; >- unsigned long seed; > > for_each_possible_cpu(i) { > struct rnd_state *state = &per_cpu(net_rand_state,i); >+ u32 seeds[3]; >+ >+ get_random_bytes(&seeds, sizeof(seeds)); >+ state->s1 = __seed(seeds[0], 1); >+ state->s2 = __seed(seeds[1], 7); >+ state->s3 = __seed(seeds[2], 15); > >- get_random_bytes(&seed, sizeof(seed)); >- __set_random32(state, seed); >+ /* mix it in */ >+ __random32(state); > } > return 0; > } >-- >1.5.5.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 458016
: 313529