diff options
author | Rich Salz <rsalz@openssl.org> | 2017-12-08 15:17:12 -0500 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2017-12-08 15:17:12 -0500 |
commit | a836f9fa951e33a5186e2421413de0b50ed2233a (patch) | |
tree | 15990a5d69da679ff48420e965abd4a5b3b98a03 /crypto/rand | |
parent | 62f494408dc87a264ecb8e94b59dde42d52dfefd (diff) |
Standardize syntax of sizeof(foo)
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4876)
Diffstat (limited to 'crypto/rand')
-rw-r--r-- | crypto/rand/md_rand.c | 10 | ||||
-rw-r--r-- | crypto/rand/rand_egd.c | 2 | ||||
-rw-r--r-- | crypto/rand/rand_unix.c | 10 |
3 files changed, 11 insertions, 11 deletions
diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c index fee722abf7..7d5fcb7f67 100644 --- a/crypto/rand/md_rand.c +++ b/crypto/rand/md_rand.c @@ -169,7 +169,7 @@ static int rand_add(const void *buf, int num, double add) md_c[0] = md_count[0]; md_c[1] = md_count[1]; - memcpy(local_md, md, sizeof md); + memcpy(local_md, md, sizeof(md)); /* state_index <= state_num <= STATE_SIZE */ state_index += num; @@ -416,7 +416,7 @@ static int rand_bytes(unsigned char *buf, int num, int pseudo) st_num = state_num; md_c[0] = md_count[0]; md_c[1] = md_count[1]; - memcpy(local_md, md, sizeof md); + memcpy(local_md, md, sizeof(md)); state_index += num_ceil; if (state_index > state_num) @@ -442,15 +442,15 @@ static int rand_bytes(unsigned char *buf, int num, int pseudo) goto err; #ifndef GETPID_IS_MEANINGLESS if (curr_pid) { /* just in the first iteration to save time */ - if (!MD_Update(m, (unsigned char *)&curr_pid, sizeof curr_pid)) + if (!MD_Update(m, (unsigned char *)&curr_pid, sizeof(curr_pid))) goto err; curr_pid = 0; } #endif if (curr_time) { /* just in the first iteration to save time */ - if (!MD_Update(m, (unsigned char *)&curr_time, sizeof curr_time)) + if (!MD_Update(m, (unsigned char *)&curr_time, sizeof(curr_time))) goto err; - if (!MD_Update(m, (unsigned char *)&tv, sizeof tv)) + if (!MD_Update(m, (unsigned char *)&tv, sizeof(tv))) goto err; curr_time = 0; if (!rand_hw_seed(m)) diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c index dd58b21498..50963b8e48 100644 --- a/crypto/rand/rand_egd.c +++ b/crypto/rand/rand_egd.c @@ -102,7 +102,7 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) addr.sun_family = AF_UNIX; if (strlen(path) >= sizeof(addr.sun_path)) return (-1); - OPENSSL_strlcpy(addr.sun_path, path, sizeof addr.sun_path); + OPENSSL_strlcpy(addr.sun_path, path, sizeof(addr.sun_path)); len = offsetof(struct sockaddr_un, sun_path) + strlen(path); fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd == -1) diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c index ecba2dc984..7a5a948430 100644 --- a/crypto/rand/rand_unix.c +++ b/crypto/rand/rand_unix.c @@ -80,15 +80,15 @@ int RAND_poll(void) */ curr_gid = getgid(); - RAND_add(&curr_gid, sizeof curr_gid, 1); + RAND_add(&curr_gid, sizeof(curr_gid), 1); curr_gid = 0; curr_pid = getpid(); - RAND_add(&curr_pid, sizeof curr_pid, 1); + RAND_add(&curr_pid, sizeof(curr_pid), 1); curr_pid = 0; curr_uid = getuid(); - RAND_add(&curr_uid, sizeof curr_uid, 1); + RAND_add(&curr_uid, sizeof(curr_uid), 1); curr_uid = 0; for (i = 0; i < (ENTROPY_NEEDED * 4); i++) { @@ -116,7 +116,7 @@ int RAND_poll(void) /* take 8 bits */ v = (unsigned char)(ts.tv_nsec % 256); - RAND_add(&v, sizeof v, 1); + RAND_add(&v, sizeof(v), 1); v = 0; } return 1; @@ -289,7 +289,7 @@ int RAND_poll(void) # if defined(DEVRANDOM) || (!defined(OPENSSL_NO_EGD) && defined(DEVRANDOM_EGD)) if (n > 0) { - RAND_add(tmpbuf, sizeof tmpbuf, (double)n); + RAND_add(tmpbuf, sizeof(tmpbuf), (double)n); OPENSSL_cleanse(tmpbuf, n); } # endif |