diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2014-03-17 16:36:27 -0700 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-03-19 22:22:06 -0400 |
commit | d20f78d252778e0fae8f8256e602bd682eb2185c (patch) | |
tree | 5f88e6bc17c69028085dc18d8252d5f3de9ee12b /arch/powerpc/include/asm/archrandom.h | |
parent | 46884442fc5bb81a896f7245bd850fde9b435509 (diff) | |
download | lwn-d20f78d252778e0fae8f8256e602bd682eb2185c.tar.gz lwn-d20f78d252778e0fae8f8256e602bd682eb2185c.zip |
x86, random: Enable the RDSEED instruction
Upcoming Intel silicon adds a new RDSEED instruction, which is similar
to RDRAND but provides a stronger guarantee: unlike RDRAND, RDSEED
will always reseed the PRNG from the true random number source between
each read. Thus, the output of RDSEED is guaranteed to be 100%
entropic, unlike RDRAND which is only architecturally guaranteed to be
1/512 entropic (although in practice is much more.)
The RDSEED instruction takes the same time to execute as RDRAND, but
RDSEED unlike RDRAND can legitimately return failure (CF=0) due to
entropy exhaustion if too many threads on too many cores are hammering
the RDSEED instruction at the same time. Therefore, we have to be
more conservative and only use it in places where we can tolerate
failures.
This patch introduces the primitives arch_get_random_seed_{int,long}()
but does not use it yet.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'arch/powerpc/include/asm/archrandom.h')
-rw-r--r-- | arch/powerpc/include/asm/archrandom.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/archrandom.h b/arch/powerpc/include/asm/archrandom.h index d853d163ba47..801beba4e64b 100644 --- a/arch/powerpc/include/asm/archrandom.h +++ b/arch/powerpc/include/asm/archrandom.h @@ -27,6 +27,15 @@ static inline int arch_get_random_int(unsigned int *v) int powernv_get_random_long(unsigned long *v); +static inline int arch_get_random_seed_long(unsigned long *v) +{ + return 0; +} +static inline int arch_get_random_seed_int(unsigned int *v) +{ + return 0; +} + #endif /* CONFIG_ARCH_RANDOM */ #endif /* _ASM_POWERPC_ARCHRANDOM_H */ |