diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c index 39c4e7e741..5d1e0d8b17 100644 --- a/crypto/rand/rand_unix.c +++ b/crypto/rand/rand_unix.c @@ -615,7 +615,10 @@ int rand_pool_add_nonce_data(RAND_POOL *pool) pid_t pid; CRYPTO_THREAD_ID tid; uint64_t time; - } data = { 0 }; + } data; + + /* Erase the entire structure including any padding */ + memset(&data, 0, sizeof(data)); /* * Add process id, thread id, and a high resolution timestamp to @@ -634,7 +637,10 @@ int rand_pool_add_additional_data(RAND_POOL *pool) struct { CRYPTO_THREAD_ID tid; uint64_t time; - } data = { 0 }; + } data; + + /* Erase the entire structure including any padding */ + memset(&data, 0, sizeof(data)); /* * Add some noise from the thread id and a high resolution timer. diff --git a/crypto/rand/rand_vms.c b/crypto/rand/rand_vms.c index d35106a310..3f13529d0f 100644 --- a/crypto/rand/rand_vms.c +++ b/crypto/rand/rand_vms.c @@ -475,7 +475,10 @@ int rand_pool_add_nonce_data(RAND_POOL *pool) pid_t pid; CRYPTO_THREAD_ID tid; uint64_t time; - } data = { 0 }; + } data; + + /* Erase the entire structure including any padding */ + memset(&data, 0, sizeof(data)); /* * Add process id, thread id, and a high resolution timestamp @@ -499,7 +502,10 @@ int rand_pool_add_additional_data(RAND_POOL *pool) struct { CRYPTO_THREAD_ID tid; uint64_t time; - } data = { 0 }; + } data; + + /* Erase the entire structure including any padding */ + memset(&data, 0, sizeof(data)); /* * Add some noise from the thread id and a high resolution timer. diff --git a/crypto/rand/rand_win.c b/crypto/rand/rand_win.c index ceeae379d5..278aee08b4 100644 --- a/crypto/rand/rand_win.c +++ b/crypto/rand/rand_win.c @@ -125,7 +125,10 @@ int rand_pool_add_nonce_data(RAND_POOL *pool) DWORD pid; DWORD tid; FILETIME time; - } data = { 0 }; + } data; + + /* Erase the entire structure including any padding */ + memset(&data, 0, sizeof(data)); /* * Add process id, thread id, and a high resolution timestamp to @@ -144,7 +147,10 @@ int rand_pool_add_additional_data(RAND_POOL *pool) struct { DWORD tid; LARGE_INTEGER time; - } data = { 0 }; + } data; + + /* Erase the entire structure including any padding */ + memset(&data, 0, sizeof(data)); /* * Add some noise from the thread id and a high resolution timer.