mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
account for output buffer being smaller than entropy pool
git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@168 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
@ -196,7 +196,8 @@ EXP_FUNC void STDCALL get_random(int num_rand_bytes, uint8_t *rand_data)
|
||||
|
||||
/* come up with the random sequence */
|
||||
RC4_setup(&rng_ctx, digest, MD5_SIZE); /* use as a key */
|
||||
memcpy(rand_data, entropy_pool, ENTROPY_POOL_SIZE);
|
||||
memcpy(rand_data, entropy_pool, num_rand_bytes < ENTROPY_POOL_SIZE ?
|
||||
num_rand_bytes : ENTROPY_POOL_SIZE);
|
||||
RC4_crypt(&rng_ctx, rand_data, rand_data, num_rand_bytes);
|
||||
|
||||
/* move things along */
|
||||
|
Reference in New Issue
Block a user