• Stephan Mueller's avatar
    crypto: drbg - Call CTR DRBG DF function only once · 72e7c25a
    Stephan Mueller authored
    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: default avatarStephan Mueller <smueller@chronox.de>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    72e7c25a
drbg.c 57.7 KB