-/* $OpenBSD: rnd.c,v 1.165 2014/12/19 02:29:40 tedu Exp $ */
+/* $OpenBSD: rnd.c,v 1.166 2014/12/19 04:00:00 tedu Exp $ */
/*
* Copyright (c) 2011 Theo de Raadt.
extract_entropy(u_int8_t *buf)
{
static u_int32_t extract_pool[POOLWORDS];
- u_char buffer[SHA512_DIGEST_LENGTH];
+ u_char digest[SHA512_DIGEST_LENGTH];
SHA2_CTX tmp;
#if SHA512_DIGEST_LENGTH < EBUFSIZE
* SHA512Update() would create nasty data dependencies. We
* do not rely on this as a benefit, but if it happens, cool.
*/
- memcpy(extract_pool, entropy_pool,
- sizeof(extract_pool));
+ memcpy(extract_pool, entropy_pool, sizeof(extract_pool));
/* Hash the pool to get the output */
SHA512Init(&tmp);
SHA512Update(&tmp, (u_int8_t *)extract_pool, sizeof(extract_pool));
- SHA512Final(buffer, &tmp);
+ SHA512Final(digest, &tmp);
/* Copy data to destination buffer */
- memcpy(buf, buffer, EBUFSIZE);
+ memcpy(buf, digest, EBUFSIZE);
/* Modify pool so next hash will produce different results */
add_timer_randomness(EBUFSIZE);
/* Wipe data from memory */
explicit_bzero(extract_pool, sizeof(extract_pool));
explicit_bzero(&tmp, sizeof(tmp));
- explicit_bzero(buffer, sizeof(buffer));
+ explicit_bzero(digest, sizeof(digest));
}
/* random keystream by ChaCha */