s390/prng: Adjust generation of entropy to produce real 256 bits.
authorHarald Freudenberger <freude@linux.vnet.ibm.com>
Sat, 7 Oct 2017 22:36:57 +0000 (22:36 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Nov 2017 09:08:37 +0000 (10:08 +0100)
commitaa7a7e92e08e1f096a0eb63fb535d03c323b32e5
tree0bc73f0c61fce43e6012c079b61979e65216ed89
parentba56e6cd9741c8f7454e7712ec5f81c988e5cb9e
s390/prng: Adjust generation of entropy to produce real 256 bits.

[ Upstream commit d34b1acb78af41b8b8d5c60972b6555ea19f7564 ]

The generate_entropy function used a sha256 for compacting
together 256 bits of entropy into 32 bytes hash. However, it
is questionable if a sha256 can really be used here, as
potential collisions may reduce the max entropy fitting into
a 32 byte hash value. So this batch introduces the use of
sha512 instead and the required buffer adjustments for the
calling functions.

Further more the working buffer for the generate_entropy
function has been widened from one page to two pages. So now
1024 stckf invocations are used to gather 256 bits of
entropy. This has been done to be on the save side if the
jitters of stckf values isn't as good as supposed.

Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/s390/crypto/prng.c