diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2014-12-19 04:00:01 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2014-12-19 04:00:01 +0000 |
commit | 10b0744127bc28e3270ce693382ce4cd5f504fc5 (patch) | |
tree | 081f45438a632976ff8c816760aefeb5e9cd4833 | |
parent | c896c973bbac0f165998bdeccd6890ffc2f81dc8 (diff) |
rename buffer to digest, more clear. ok deraadt
-rw-r--r-- | sys/dev/rnd.c | 13 |
1 files changed, 6 insertions, 7 deletions
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 */ |