]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit - crypto/drbg.c
crypto: drbg - Call CTR DRBG DF function only once
authorStephan Mueller <smueller@chronox.de>
Sun, 6 Jul 2014 00:24:35 +0000 (02:24 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 8 Jul 2014 13:18:24 +0000 (21:18 +0800)
commit72e7c25aa6d73df2951229d2ce0a35065de66d3a
tree5d242f50c32207d375766ca579b375f30fbb42a8
parenta9089571f2fc203c3ba6595a60f0045f048494da
crypto: drbg - Call CTR DRBG DF function only once

The CTR DRBG requires the update function to be called twice when
generating a random number. In both cases, update function must process
the additional information string by using the DF function. As the DF
produces the same result in both cases, we can save one invocation of
the DF function when the first DF function result is reused.

The result of the DF function is stored in the scratchpad storage. The
patch ensures that the scratchpad is not cleared when we want to reuse
the DF result. For achieving this, the CTR DRBG update function must
know by whom and in which scenario it is called. This information is
provided with the reseed parameter to the update function.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/drbg.c