random: Eliminate unneeded memcpy invocations in the DRBG.
* random/random-drbg.c (drbg_hash): Remove arg 'outval' and return a pointer instead. (drbg_instantiate): Reduce size of scratchpad. (drbg_hmac_update): Avoid use of scratch buffers for the hash. (drbg_hmac_generate, drbg_hash_df): Ditto. (drbg_hash_process_addtl): Ditto. (drbg_hash_hashgen): Ditto. (drbg_hash_generate): Ditto.
The gcry_md_read returns a pointer to the hash which can be directly
used instead of copying it into a scratch buffer. This eliminates a
number of memcpy invocations for HMAC and Hash DRBG and reduces the
memory footprint of the Hash DRBG by the block size of the used hash.
The performance increase is between 1 and 3 MB/s depending on the output
buffer size.
ChangeLog entries above written by -wk.
- Signed-off-by: Stephan Mueller <smueller@chronox.de>