aboutsummaryrefslogtreecommitdiff
path: root/lib/hcrypto/rand-fortuna.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/hcrypto/rand-fortuna.c')
-rw-r--r--lib/hcrypto/rand-fortuna.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/hcrypto/rand-fortuna.c b/lib/hcrypto/rand-fortuna.c
index 529bf8f301a8..2082f35ec72d 100644
--- a/lib/hcrypto/rand-fortuna.c
+++ b/lib/hcrypto/rand-fortuna.c
@@ -159,7 +159,7 @@ md_result(MD_CTX * ctx, unsigned char *dst)
memcpy(&tmp, ctx, sizeof(*ctx));
SHA256_Final(dst, &tmp);
- memset(&tmp, 0, sizeof(tmp));
+ memset_s(&tmp, sizeof(tmp), 0, sizeof(tmp));
}
/*
@@ -234,7 +234,7 @@ enough_time_passed(FState * st)
if (ok)
memcpy(last, &tv, sizeof(tv));
- memset(&tv, 0, sizeof(tv));
+ memset_s(&tv, sizeof(tv), 0, sizeof(tv));
return ok;
}
@@ -284,8 +284,8 @@ reseed(FState * st)
/* use new key */
ciph_init(&st->ciph, st->key, BLOCK);
- memset(&key_md, 0, sizeof(key_md));
- memset(buf, 0, BLOCK);
+ memset_s(&key_md, sizeof(key_md), 0, sizeof(key_md));
+ memset_s(buf, sizeof(buf), 0, sizeof(buf));
}
/*
@@ -335,8 +335,8 @@ add_entropy(FState * st, const unsigned char *data, unsigned len)
if (pos == 0)
st->pool0_bytes += len;
- memset(hash, 0, BLOCK);
- memset(&md, 0, sizeof(md));
+ memset_s(hash, sizeof(hash), 0, sizeof(hash));
+ memset_s(&md, sizeof(hash), 0, sizeof(md));
}
/*
@@ -372,7 +372,7 @@ startup_tricks(FState * st)
encrypt_counter(st, buf + CIPH_BLOCK);
md_update(&st->pool[i], buf, BLOCK);
}
- memset(buf, 0, BLOCK);
+ memset_s(buf, sizeof(buf), 0, sizeof(buf));
/* Hide the key. */
rekey(st);
@@ -468,7 +468,7 @@ fortuna_reseed(void)
if ((*hc_rand_unix_method.bytes)(buf, sizeof(buf)) == 1) {
add_entropy(&main_state, buf, sizeof(buf));
entropy_p = 1;
- memset(buf, 0, sizeof(buf));
+ memset_s(buf, sizeof(buf), 0, sizeof(buf));
}
}
#endif
@@ -509,7 +509,7 @@ fortuna_reseed(void)
close(fd);
}
- memset(&u, 0, sizeof(u));
+ memset_s(&u, sizeof(u), 0, sizeof(u));
entropy_p = 1; /* sure about this ? */
}
@@ -593,7 +593,7 @@ fortuna_cleanup(void)
init_done = 0;
have_entropy = 0;
- memset(&main_state, 0, sizeof(main_state));
+ memset_s(&main_state, sizeof(main_state), 0, sizeof(main_state));
HEIMDAL_MUTEX_unlock(&fortuna_mutex);
}