From: tedu Date: Fri, 19 Dec 2014 04:00:00 +0000 (+0000) Subject: rename buffer to digest, more clear. ok deraadt X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d47d0a64d3442978b0b2963ee10f35d617d65d53;p=openbsd rename buffer to digest, more clear. ok deraadt --- diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c index 4ceb97f2af4..48f2c41acb5 100644 --- a/sys/dev/rnd.c +++ b/sys/dev/rnd.c @@ -1,4 +1,4 @@ -/* $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. @@ -497,7 +497,7 @@ void 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 @@ -510,16 +510,15 @@ extract_entropy(u_int8_t *buf) * 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); @@ -528,7 +527,7 @@ extract_entropy(u_int8_t *buf) /* 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 */