aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util-linux/seedrng.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/util-linux/seedrng.c b/util-linux/seedrng.c
index 3074e9a58..2965f3d47 100644
--- a/util-linux/seedrng.c
+++ b/util-linux/seedrng.c
@@ -151,7 +151,8 @@ static void seed_from_file_if_exists(const char *filename, int dfd, bool credit,
151 */ 151 */
152 fsync(dfd); 152 fsync(dfd);
153 153
154 sha256_hash(hash, &seed_len, sizeof(seed_len)); 154//Length is not random, and taking its address spills variable to stack
155// sha256_hash(hash, &seed_len, sizeof(seed_len));
155 sha256_hash(hash, seed, seed_len); 156 sha256_hash(hash, seed, seed_len);
156 printf("Seeding %u bits %s crediting\n", 157 printf("Seeding %u bits %s crediting\n",
157 (unsigned)seed_len * 8, credit ? "and" : "without"); 158 (unsigned)seed_len * 8, credit ? "and" : "without");
@@ -220,7 +221,8 @@ int seedrng_main(int argc UNUSED_PARAM, char *argv[])
220 221
221 new_seed_len = determine_optimal_seed_len(); 222 new_seed_len = determine_optimal_seed_len();
222 new_seed_creditable = read_new_seed(new_seed, new_seed_len); 223 new_seed_creditable = read_new_seed(new_seed, new_seed_len);
223 sha256_hash(&hash, &new_seed_len, sizeof(new_seed_len)); 224//Length is not random, and taking its address spills variable to stack
225// sha256_hash(&hash, &new_seed_len, sizeof(new_seed_len));
224 sha256_hash(&hash, new_seed, new_seed_len); 226 sha256_hash(&hash, new_seed, new_seed_len);
225 sha256_end(&hash, new_seed + new_seed_len - SHA256_OUTSIZE); 227 sha256_end(&hash, new_seed + new_seed_len - SHA256_OUTSIZE);
226 228
@@ -230,7 +232,7 @@ int seedrng_main(int argc UNUSED_PARAM, char *argv[])
230 xwrite(fd, new_seed, new_seed_len); 232 xwrite(fd, new_seed, new_seed_len);
231 if (new_seed_creditable) { 233 if (new_seed_creditable) {
232 /* More paranoia when we create a file which we believe contains 234 /* More paranoia when we create a file which we believe contains
233 * genuine entropy: make sure disk is not full, quota was't esceeded, etc: 235 * genuine entropy: make sure disk is not full, quota was't exceeded, etc:
234 */ 236 */
235 if (fsync(fd) < 0) 237 if (fsync(fd) < 0)
236 bb_perror_msg_and_die("can't write '%s'", NON_CREDITABLE_SEED_NAME); 238 bb_perror_msg_and_die("can't write '%s'", NON_CREDITABLE_SEED_NAME);