summaryrefslogtreecommitdiff
path: root/src/journal/fsprg.c
diff options
context:
space:
mode:
authorGreg KH <gregkh@linuxfoundation.org>2014-01-31 06:51:32 +0100
committerTom Gundersen <teg@jklm.no>2014-01-31 11:55:01 +0100
commit29804cc1e0f37ee34301530fd7f1eb8550be464e (patch)
treeba287b984b216279bb342579a9d1039383ca3a39 /src/journal/fsprg.c
parentb5cfa7408c4cb68e9bb232fc34b07fd03c915617 (diff)
use memzero(foo, length); for all memset(foo, 0, length); calls
In trying to track down a stupid linker bug, I noticed a bunch of memset() calls that should be using memzero() to make it more "obvious" that the options are correct (i.e. 0 is not the length, but the data to set). So fix up all current calls to memset(foo, 0, length) to memzero(foo, length).
Diffstat (limited to 'src/journal/fsprg.c')
-rw-r--r--src/journal/fsprg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/journal/fsprg.c b/src/journal/fsprg.c
index dd9a242561..5c8d6d6feb 100644
--- a/src/journal/fsprg.c
+++ b/src/journal/fsprg.c
@@ -51,7 +51,7 @@ static void mpi_export(void *buf, size_t buflen, const gcry_mpi_t x) {
assert(gcry_mpi_cmp_ui(x, 0) >= 0);
len = (gcry_mpi_get_nbits(x) + 7) / 8;
assert(len <= buflen);
- memset(buf, 0, buflen);
+ memzero(buf, buflen);
gcry_mpi_print(GCRYMPI_FMT_USG, buf + (buflen - len), len, &nwritten, x);
assert(nwritten == len);
}
@@ -306,7 +306,7 @@ void FSPRG_GenState0(void *state, const void *mpk, const void *seed, size_t seed
memcpy(state, mpk, 2 + secpar / 8);
mpi_export(state + 2 + 1 * secpar / 8, secpar / 8, x);
- memset(state + 2 + 2 * secpar / 8, 0, 8);
+ memzero(state + 2 + 2 * secpar / 8, 8);
gcry_mpi_release(n);
gcry_mpi_release(x);