aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/hw_random
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 13:25:58 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 13:25:58 -0500
commit27d189c02ba25851973c8582e419c0bded9f7e5b (patch)
treebe142d664bc4e3cec7ab2878a243343f46e897ee /drivers/char/hw_random
parenta1703154200c390ab03c10224c586e815d3e31e8 (diff)
parent55db8387a5e8d07407f0b7c6b2526417a2bc6243 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (46 commits) hwrng: via_rng - Fix memory scribbling on some CPUs crypto: padlock - Move padlock.h into include/crypto hwrng: via_rng - Fix asm constraints crypto: n2 - use __devexit not __exit in n2_unregister_algs crypto: mark crypto workqueues CPU_INTENSIVE crypto: mv_cesa - dont return PTR_ERR() of wrong pointer crypto: ripemd - Set module author and update email address crypto: omap-sham - backlog handling fix crypto: gf128mul - Remove experimental tag crypto: af_alg - fix af_alg memory_allocated data type crypto: aesni-intel - Fixed build with binutils 2.16 crypto: af_alg - Make sure sk_security is initialized on accept()ed sockets net: Add missing lockdep class names for af_alg include: Install linux/if_alg.h for user-space crypto API crypto: omap-aes - checkpatch --file warning fixes crypto: omap-aes - initialize aes module once per request crypto: omap-aes - unnecessary code removed crypto: omap-aes - error handling implementation improved crypto: omap-aes - redundant locking is removed crypto: omap-aes - DMA initialization fixes for OMAP off mode ...
Diffstat (limited to 'drivers/char/hw_random')
-rw-r--r--drivers/char/hw_random/via-rng.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/char/hw_random/via-rng.c b/drivers/char/hw_random/via-rng.c
index 794aacb715c1..d0387a84eec1 100644
--- a/drivers/char/hw_random/via-rng.c
+++ b/drivers/char/hw_random/via-rng.c
@@ -24,6 +24,7 @@
24 * warranty of any kind, whether express or implied. 24 * warranty of any kind, whether express or implied.
25 */ 25 */
26 26
27#include <crypto/padlock.h>
27#include <linux/module.h> 28#include <linux/module.h>
28#include <linux/kernel.h> 29#include <linux/kernel.h>
29#include <linux/hw_random.h> 30#include <linux/hw_random.h>
@@ -34,7 +35,6 @@
34#include <asm/i387.h> 35#include <asm/i387.h>
35 36
36 37
37#define PFX KBUILD_MODNAME ": "
38 38
39 39
40enum { 40enum {
@@ -81,8 +81,7 @@ static inline u32 xstore(u32 *addr, u32 edx_in)
81 ts_state = irq_ts_save(); 81 ts_state = irq_ts_save();
82 82
83 asm(".byte 0x0F,0xA7,0xC0 /* xstore %%edi (addr=%0) */" 83 asm(".byte 0x0F,0xA7,0xC0 /* xstore %%edi (addr=%0) */"
84 :"=m"(*addr), "=a"(eax_out) 84 : "=m" (*addr), "=a" (eax_out), "+d" (edx_in), "+D" (addr));
85 :"D"(addr), "d"(edx_in));
86 85
87 irq_ts_restore(ts_state); 86 irq_ts_restore(ts_state);
88 return eax_out; 87 return eax_out;
@@ -90,8 +89,10 @@ static inline u32 xstore(u32 *addr, u32 edx_in)
90 89
91static int via_rng_data_present(struct hwrng *rng, int wait) 90static int via_rng_data_present(struct hwrng *rng, int wait)
92{ 91{
92 char buf[16 + PADLOCK_ALIGNMENT - STACK_ALIGN] __attribute__
93 ((aligned(STACK_ALIGN)));
94 u32 *via_rng_datum = (u32 *)PTR_ALIGN(&buf[0], PADLOCK_ALIGNMENT);
93 u32 bytes_out; 95 u32 bytes_out;
94 u32 *via_rng_datum = (u32 *)(&rng->priv);
95 int i; 96 int i;
96 97
97 /* We choose the recommended 1-byte-per-instruction RNG rate, 98 /* We choose the recommended 1-byte-per-instruction RNG rate,
@@ -115,6 +116,7 @@ static int via_rng_data_present(struct hwrng *rng, int wait)
115 break; 116 break;
116 udelay(10); 117 udelay(10);
117 } 118 }
119 rng->priv = *via_rng_datum;
118 return bytes_out ? 1 : 0; 120 return bytes_out ? 1 : 0;
119} 121}
120 122