diff options
author | Rich Salz <rsalz@openssl.org> | 2017-12-07 13:39:34 -0500 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2017-12-07 19:11:49 -0500 |
commit | cbe2964821bb063f61ed2544cfce196ec1c0d62b (patch) | |
tree | 098cdc33d8174fffae52bd8885e384ef86570c25 /apps | |
parent | e7a206694451be19432d079691610994473f53b7 (diff) |
Consistent formatting for sizeof(foo)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4872)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/apps.c | 48 | ||||
-rw-r--r-- | apps/ciphers.c | 2 | ||||
-rw-r--r-- | apps/dhparam.c | 4 | ||||
-rw-r--r-- | apps/dsaparam.c | 6 | ||||
-rw-r--r-- | apps/ecparam.c | 12 | ||||
-rw-r--r-- | apps/enc.c | 18 | ||||
-rw-r--r-- | apps/errstr.c | 2 | ||||
-rw-r--r-- | apps/ocsp.c | 4 | ||||
-rw-r--r-- | apps/openssl.c | 2 | ||||
-rw-r--r-- | apps/opt.c | 18 | ||||
-rw-r--r-- | apps/passwd.c | 42 | ||||
-rw-r--r-- | apps/pkcs12.c | 12 | ||||
-rw-r--r-- | apps/pkcs8.c | 4 | ||||
-rw-r--r-- | apps/rand.c | 2 | ||||
-rw-r--r-- | apps/req.c | 4 | ||||
-rw-r--r-- | apps/s_server.c | 6 | ||||
-rw-r--r-- | apps/speed.c | 4 | ||||
-rw-r--r-- | apps/vms_term_sock.c | 12 |
18 files changed, 101 insertions, 101 deletions
diff --git a/apps/apps.c b/apps/apps.c index fd8156744e..3040566257 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -1425,9 +1425,9 @@ int save_serial(const char *serialfile, const char *suffix, const BIGNUM *serial OPENSSL_strlcpy(buf[0], serialfile, BSIZE); else { #ifndef OPENSSL_SYS_VMS - j = BIO_snprintf(buf[0], sizeof buf[0], "%s.%s", serialfile, suffix); + j = BIO_snprintf(buf[0], sizeof(buf[0]), "%s.%s", serialfile, suffix); #else - j = BIO_snprintf(buf[0], sizeof buf[0], "%s-%s", serialfile, suffix); + j = BIO_snprintf(buf[0], sizeof(buf[0]), "%s-%s", serialfile, suffix); #endif } out = BIO_new_file(buf[0], "w"); @@ -1468,11 +1468,11 @@ int rotate_serial(const char *serialfile, const char *new_suffix, goto err; } #ifndef OPENSSL_SYS_VMS - j = BIO_snprintf(buf[0], sizeof buf[0], "%s.%s", serialfile, new_suffix); - j = BIO_snprintf(buf[1], sizeof buf[1], "%s.%s", serialfile, old_suffix); + j = BIO_snprintf(buf[0], sizeof(buf[0]), "%s.%s", serialfile, new_suffix); + j = BIO_snprintf(buf[1], sizeof(buf[1]), "%s.%s", serialfile, old_suffix); #else - j = BIO_snprintf(buf[0], sizeof buf[0], "%s-%s", serialfile, new_suffix); - j = BIO_snprintf(buf[1], sizeof buf[1], "%s-%s", serialfile, old_suffix); + j = BIO_snprintf(buf[0], sizeof(buf[0]), "%s-%s", serialfile, new_suffix); + j = BIO_snprintf(buf[1], sizeof(buf[1]), "%s-%s", serialfile, old_suffix); #endif if (rename(serialfile, buf[1]) < 0 && errno != ENOENT #ifdef ENOTDIR @@ -1537,9 +1537,9 @@ CA_DB *load_index(const char *dbfile, DB_ATTR *db_attr) goto err; #ifndef OPENSSL_SYS_VMS - BIO_snprintf(buf, sizeof buf, "%s.attr", dbfile); + BIO_snprintf(buf, sizeof(buf), "%s.attr", dbfile); #else - BIO_snprintf(buf, sizeof buf, "%s-attr", dbfile); + BIO_snprintf(buf, sizeof(buf), "%s-attr", dbfile); #endif dbattr_conf = app_load_config(buf); @@ -1600,13 +1600,13 @@ int save_index(const char *dbfile, const char *suffix, CA_DB *db) goto err; } #ifndef OPENSSL_SYS_VMS - j = BIO_snprintf(buf[2], sizeof buf[2], "%s.attr", dbfile); - j = BIO_snprintf(buf[1], sizeof buf[1], "%s.attr.%s", dbfile, suffix); - j = BIO_snprintf(buf[0], sizeof buf[0], "%s.%s", dbfile, suffix); + j = BIO_snprintf(buf[2], sizeof(buf[2]), "%s.attr", dbfile); + j = BIO_snprintf(buf[1], sizeof(buf[1]), "%s.attr.%s", dbfile, suffix); + j = BIO_snprintf(buf[0], sizeof(buf[0]), "%s.%s", dbfile, suffix); #else - j = BIO_snprintf(buf[2], sizeof buf[2], "%s-attr", dbfile); - j = BIO_snprintf(buf[1], sizeof buf[1], "%s-attr-%s", dbfile, suffix); - j = BIO_snprintf(buf[0], sizeof buf[0], "%s-%s", dbfile, suffix); + j = BIO_snprintf(buf[2], sizeof(buf[2]), "%s-attr", dbfile); + j = BIO_snprintf(buf[1], sizeof(buf[1]), "%s-attr-%s", dbfile, suffix); + j = BIO_snprintf(buf[0], sizeof(buf[0]), "%s-%s", dbfile, suffix); #endif out = BIO_new_file(buf[0], "w"); if (out == NULL) { @@ -1649,17 +1649,17 @@ int rotate_index(const char *dbfile, const char *new_suffix, goto err; } #ifndef OPENSSL_SYS_VMS - j = BIO_snprintf(buf[4], sizeof buf[4], "%s.attr", dbfile); - j = BIO_snprintf(buf[3], sizeof buf[3], "%s.attr.%s", dbfile, old_suffix); - j = BIO_snprintf(buf[2], sizeof buf[2], "%s.attr.%s", dbfile, new_suffix); - j = BIO_snprintf(buf[1], sizeof buf[1], "%s.%s", dbfile, old_suffix); - j = BIO_snprintf(buf[0], sizeof buf[0], "%s.%s", dbfile, new_suffix); + j = BIO_snprintf(buf[4], sizeof(buf[4]), "%s.attr", dbfile); + j = BIO_snprintf(buf[3], sizeof(buf[3]), "%s.attr.%s", dbfile, old_suffix); + j = BIO_snprintf(buf[2], sizeof(buf[2]), "%s.attr.%s", dbfile, new_suffix); + j = BIO_snprintf(buf[1], sizeof(buf[1]), "%s.%s", dbfile, old_suffix); + j = BIO_snprintf(buf[0], sizeof(buf[0]), "%s.%s", dbfile, new_suffix); #else - j = BIO_snprintf(buf[4], sizeof buf[4], "%s-attr", dbfile); - j = BIO_snprintf(buf[3], sizeof buf[3], "%s-attr-%s", dbfile, old_suffix); - j = BIO_snprintf(buf[2], sizeof buf[2], "%s-attr-%s", dbfile, new_suffix); - j = BIO_snprintf(buf[1], sizeof buf[1], "%s-%s", dbfile, old_suffix); - j = BIO_snprintf(buf[0], sizeof buf[0], "%s-%s", dbfile, new_suffix); + j = BIO_snprintf(buf[4], sizeof(buf[4]), "%s-attr", dbfile); + j = BIO_snprintf(buf[3], sizeof(buf[3]), "%s-attr-%s", dbfile, old_suffix); + j = BIO_snprintf(buf[2], sizeof(buf[2]), "%s-attr-%s", dbfile, new_suffix); + j = BIO_snprintf(buf[1], sizeof(buf[1]), "%s-%s", dbfile, old_suffix); + j = BIO_snprintf(buf[0], sizeof(buf[0]), "%s-%s", dbfile, new_suffix); #endif if (rename(dbfile, buf[1]) < 0 && errno != ENOENT #ifdef ENOTDIR diff --git a/apps/ciphers.c b/apps/ciphers.c index 83cdb55e76..d171b865eb 100644 --- a/apps/ciphers.c +++ b/apps/ciphers.c @@ -236,7 +236,7 @@ int ciphers_main(int argc, char **argv) nm = "UNKNOWN"; BIO_printf(bio_out, "%s - ", nm); } - BIO_puts(bio_out, SSL_CIPHER_description(c, buf, sizeof buf)); + BIO_puts(bio_out, SSL_CIPHER_description(c, buf, sizeof(buf))); } } diff --git a/apps/dhparam.c b/apps/dhparam.c index 7c7d684163..2a78ce28fc 100644 --- a/apps/dhparam.c +++ b/apps/dhparam.c @@ -319,9 +319,9 @@ int dhparam_main(int argc, char **argv) "\n" " if (dh == NULL)\n" " return NULL;\n"); - BIO_printf(out, " dhp_bn = BN_bin2bn(dhp_%d, sizeof (dhp_%d), NULL);\n", + BIO_printf(out, " dhp_bn = BN_bin2bn(dhp_%d, sizeof(dhp_%d), NULL);\n", bits, bits); - BIO_printf(out, " dhg_bn = BN_bin2bn(dhg_%d, sizeof (dhg_%d), NULL);\n", + BIO_printf(out, " dhg_bn = BN_bin2bn(dhg_%d, sizeof(dhg_%d), NULL);\n", bits, bits); BIO_printf(out, " if (dhp_bn == NULL || dhg_bn == NULL\n" " || !DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) {\n" diff --git a/apps/dsaparam.c b/apps/dsaparam.c index 2f43b1f096..ff66fcc64c 100644 --- a/apps/dsaparam.c +++ b/apps/dsaparam.c @@ -180,11 +180,11 @@ int dsaparam_main(int argc, char **argv) "\n"); BIO_printf(bio_out, " if (dsa == NULL)\n" " return NULL;\n"); - BIO_printf(bio_out, " dsa->p = BN_bin2bn(dsap_%d, sizeof (dsap_%d), NULL);\n", + BIO_printf(bio_out, " dsa->p = BN_bin2bn(dsap_%d, sizeof(dsap_%d), NULL);\n", bits_p, bits_p); - BIO_printf(bio_out, " dsa->q = BN_bin2bn(dsaq_%d, sizeof (dsaq_%d), NULL);\n", + BIO_printf(bio_out, " dsa->q = BN_bin2bn(dsaq_%d, sizeof(dsaq_%d), NULL);\n", bits_p, bits_p); - BIO_printf(bio_out, " dsa->g = BN_bin2bn(dsag_%d, sizeof (dsag_%d), NULL);\n", + BIO_printf(bio_out, " dsa->g = BN_bin2bn(dsag_%d, sizeof(dsag_%d), NULL);\n", bits_p, bits_p); BIO_printf(bio_out, " if (!dsa->p || !dsa->q || !dsa->g) {\n" " DSA_free(dsa);\n" diff --git a/apps/ecparam.c b/apps/ecparam.c index 7529f241fb..1f3770e284 100644 --- a/apps/ecparam.c +++ b/apps/ecparam.c @@ -347,24 +347,24 @@ int ecparam_main(int argc, char **argv) " BIGNUM *tmp_3 = NULL;\n" "\n"); - BIO_printf(out, " if ((tmp_1 = BN_bin2bn(ec_p_%d, sizeof (ec_p_%d), NULL)) == NULL)\n" + BIO_printf(out, " if ((tmp_1 = BN_bin2bn(ec_p_%d, sizeof(ec_p_%d), NULL)) == NULL)\n" " goto err;\n", len, len); - BIO_printf(out, " if ((tmp_2 = BN_bin2bn(ec_a_%d, sizeof (ec_a_%d), NULL)) == NULL)\n" + BIO_printf(out, " if ((tmp_2 = BN_bin2bn(ec_a_%d, sizeof(ec_a_%d), NULL)) == NULL)\n" " goto err;\n", len, len); - BIO_printf(out, " if ((tmp_3 = BN_bin2bn(ec_b_%d, sizeof (ec_b_%d), NULL)) == NULL)\n" + BIO_printf(out, " if ((tmp_3 = BN_bin2bn(ec_b_%d, sizeof(ec_b_%d), NULL)) == NULL)\n" " goto err;\n", len, len); BIO_printf(out, " if ((group = EC_GROUP_new_curve_GFp(tmp_1, tmp_2, tmp_3, NULL)) == NULL)\n" " goto err;\n" "\n"); BIO_printf(out, " /* build generator */\n"); - BIO_printf(out, " if ((tmp_1 = BN_bin2bn(ec_gen_%d, sizeof (ec_gen_%d), tmp_1)) == NULL)\n" + BIO_printf(out, " if ((tmp_1 = BN_bin2bn(ec_gen_%d, sizeof(ec_gen_%d), tmp_1)) == NULL)\n" " goto err;\n", len, len); BIO_printf(out, " point = EC_POINT_bn2point(group, tmp_1, NULL, NULL);\n"); BIO_printf(out, " if (point == NULL)\n" " goto err;\n"); - BIO_printf(out, " if ((tmp_2 = BN_bin2bn(ec_order_%d, sizeof (ec_order_%d), tmp_2)) == NULL)\n" + BIO_printf(out, " if ((tmp_2 = BN_bin2bn(ec_order_%d, sizeof(ec_order_%d), tmp_2)) == NULL)\n" " goto err;\n", len, len); - BIO_printf(out, " if ((tmp_3 = BN_bin2bn(ec_cofactor_%d, sizeof (ec_cofactor_%d), tmp_3)) == NULL)\n" + BIO_printf(out, " if ((tmp_3 = BN_bin2bn(ec_cofactor_%d, sizeof(ec_cofactor_%d), tmp_3)) == NULL)\n" " goto err;\n", len, len); BIO_printf(out, " if (!EC_GROUP_set_generator(group, point, tmp_2, tmp_3))\n" " goto err;\n" diff --git a/apps/enc.c b/apps/enc.c index 14b029b33f..af882598cc 100644 --- a/apps/enc.c +++ b/apps/enc.c @@ -98,7 +98,7 @@ int enc_main(int argc, char **argv) char *hkey = NULL, *hiv = NULL, *hsalt = NULL, *p; char *infile = NULL, *outfile = NULL, *prog; char *str = NULL, *passarg = NULL, *pass = NULL, *strbuf = NULL; - char mbuf[sizeof magic - 1]; + char mbuf[sizeof(magic) - 1]; OPTION_CHOICE o; int bsize = BSIZE, verbose = 0, debug = 0, olb64 = 0, nosalt = 0; int enc = 1, printkey = 0, i, k; @@ -220,7 +220,7 @@ int enc_main(int argc, char **argv) in = bio_open_default(opt_arg(), 'r', FORMAT_TEXT); if (in == NULL) goto opthelp; - i = BIO_gets(in, buf, sizeof buf); + i = BIO_gets(in, buf, sizeof(buf)); BIO_free(in); in = NULL; if (i <= 0) { @@ -409,11 +409,11 @@ int enc_main(int argc, char **argv) } else { if (enc) { if (hsalt) { - if (!set_hex(hsalt, salt, sizeof salt)) { + if (!set_hex(hsalt, salt, sizeof(salt))) { BIO_printf(bio_err, "invalid hex salt value\n"); goto end; } - } else if (RAND_bytes(salt, sizeof salt) <= 0) { + } else if (RAND_bytes(salt, sizeof(salt)) <= 0) { goto end; } /* @@ -421,20 +421,20 @@ int enc_main(int argc, char **argv) */ if ((printkey != 2) && (BIO_write(wbio, magic, - sizeof magic - 1) != sizeof magic - 1 + sizeof(magic) - 1) != sizeof(magic) - 1 || BIO_write(wbio, (char *)salt, - sizeof salt) != sizeof salt)) { + sizeof(salt)) != sizeof(salt))) { BIO_printf(bio_err, "error writing output file\n"); goto end; } - } else if (BIO_read(rbio, mbuf, sizeof mbuf) != sizeof mbuf + } else if (BIO_read(rbio, mbuf, sizeof(mbuf)) != sizeof(mbuf) || BIO_read(rbio, (unsigned char *)salt, - sizeof salt) != sizeof salt) { + sizeof(salt)) != sizeof(salt)) { BIO_printf(bio_err, "error reading input file\n"); goto end; - } else if (memcmp(mbuf, magic, sizeof magic - 1)) { + } else if (memcmp(mbuf, magic, sizeof(magic) - 1)) { BIO_printf(bio_err, "bad magic number\n"); goto end; } diff --git a/apps/errstr.c b/apps/errstr.c index 324e6e49ae..3ce4acf744 100644 --- a/apps/errstr.c +++ b/apps/errstr.c @@ -57,7 +57,7 @@ int errstr_main(int argc, char **argv) */ OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); - ERR_error_string_n(l, buf, sizeof buf); + ERR_error_string_n(l, buf, sizeof(buf)); BIO_printf(bio_out, "%s\n", buf); } } diff --git a/apps/ocsp.c b/apps/ocsp.c index d7351fa034..87c841dd38 100644 --- a/apps/ocsp.c +++ b/apps/ocsp.c @@ -1088,7 +1088,7 @@ static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio) *pcbio = cbio; /* Read the request line. */ - len = BIO_gets(cbio, reqbuf, sizeof reqbuf); + len = BIO_gets(cbio, reqbuf, sizeof(reqbuf)); if (len <= 0) return 1; if (strncmp(reqbuf, "GET ", 4) == 0) { @@ -1130,7 +1130,7 @@ static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio) /* Read and skip past the headers. */ for (;;) { - len = BIO_gets(cbio, inbuf, sizeof inbuf); + len = BIO_gets(cbio, inbuf, sizeof(inbuf)); if (len <= 0) return 1; if ((inbuf[0] == '\r') || (inbuf[0] == '\n')) diff --git a/apps/openssl.c b/apps/openssl.c index fd89629bbe..1c8682759f 100644 --- a/apps/openssl.c +++ b/apps/openssl.c @@ -188,7 +188,7 @@ int main(int argc, char *argv[]) for (;;) { ret = 0; /* Read a line, continue reading if line ends with \ */ - for (p = buf, n = sizeof buf, i = 0, first = 1; n > 0; first = 0) { + for (p = buf, n = sizeof(buf), i = 0, first = 1; n > 0; first = 0) { prompt = first ? "OpenSSL> " : "> "; p[0] = '\0'; #ifndef READLINE diff --git a/apps/opt.c b/apps/opt.c index 40d6a279b3..fcd01c01a1 100644 --- a/apps/opt.c +++ b/apps/opt.c @@ -58,8 +58,8 @@ char *opt_progname(const char *argv0) n -= 4; /* Copy over the name, in lowercase. */ - if (n > sizeof prog - 1) - n = sizeof prog - 1; + if (n > sizeof(prog) - 1) + n = sizeof(prog) - 1; for (q = prog, i = 0; i < n; i++, p++) *q++ = tolower((unsigned char)*p); *q = '\0'; @@ -80,9 +80,9 @@ char *opt_progname(const char *argv0) } q = strrchr(p, '.'); - strncpy(prog, p, sizeof prog - 1); - prog[sizeof prog - 1] = '\0'; - if (q != NULL && q - p < sizeof prog) + strncpy(prog, p, sizeof(prog) - 1); + prog[sizeof(prog) - 1] = '\0'; + if (q != NULL && q - p < sizeof(prog)) prog[q - p] = '\0'; return prog; } @@ -99,8 +99,8 @@ char *opt_progname(const char *argv0) p++; break; } - strncpy(prog, p, sizeof prog - 1); - prog[sizeof prog - 1] = '\0'; + strncpy(prog, p, sizeof(prog) - 1); + prog[sizeof(prog) - 1] = '\0'; return prog; } #endif @@ -859,7 +859,7 @@ void opt_help(const OPTIONS *list) i += 1 + strlen(valtype2param(o)); if (i < MAX_OPT_HELP_WIDTH && i > width) width = i; - assert(i < (int)sizeof start); + assert(i < (int)sizeof(start)); } if (standard_prolog) @@ -876,7 +876,7 @@ void opt_help(const OPTIONS *list) /* Pad out prefix */ memset(start, ' ', sizeof(start) - 1); - start[sizeof start - 1] = '\0'; + start[sizeof(start) - 1] = '\0'; if (o->name == OPT_MORE_STR) { /* Continuation of previous line; pad and print. */ diff --git a/apps/passwd.c b/apps/passwd.c index 220a1885dc..85e7a6ebcd 100644 --- a/apps/passwd.c +++ b/apps/passwd.c @@ -274,7 +274,7 @@ int passwd_main(int argc, char **argv) /* ignore rest of line */ char trash[BUFSIZ]; do - r = BIO_gets(in, trash, sizeof trash); + r = BIO_gets(in, trash, sizeof(trash)); while ((r > 0) && (!strchr(trash, '\n'))); } @@ -325,14 +325,14 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt) out_buf[0] = 0; magic_len = strlen(magic); - OPENSSL_strlcpy(ascii_magic, magic, sizeof ascii_magic); + OPENSSL_strlcpy(ascii_magic, magic, sizeof(ascii_magic)); #ifdef CHARSET_EBCDIC if ((magic[0] & 0x80) != 0) /* High bit is 1 in EBCDIC alnums */ ebcdic2ascii(ascii_magic, ascii_magic, magic_len); #endif /* The salt gets truncated to 8 chars */ - OPENSSL_strlcpy(ascii_salt, salt, sizeof ascii_salt); + OPENSSL_strlcpy(ascii_salt, salt, sizeof(ascii_salt)); salt_len = strlen(ascii_salt); #ifdef CHARSET_EBCDIC ebcdic2ascii(ascii_salt, ascii_salt, salt_len); @@ -347,16 +347,16 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt) #endif if (magic_len > 0) { - OPENSSL_strlcat(out_buf, ascii_dollar, sizeof out_buf); + OPENSSL_strlcat(out_buf, ascii_dollar, sizeof(out_buf)); if (magic_len > 4) /* assert it's "1" or "apr1" */ goto err; - OPENSSL_strlcat(out_buf, ascii_magic, sizeof out_buf); - OPENSSL_strlcat(out_buf, ascii_dollar, sizeof out_buf); + OPENSSL_strlcat(out_buf, ascii_magic, sizeof(out_buf)); + OPENSSL_strlcat(out_buf, ascii_dollar, sizeof(out_buf)); } - OPENSSL_strlcat(out_buf, ascii_salt, sizeof out_buf); + OPENSSL_strlcat(out_buf, ascii_salt, sizeof(out_buf)); if (strlen(out_buf) > 6 + 8) /* assert "$apr1$..salt.." */ goto err; @@ -392,8 +392,8 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt) || !EVP_DigestFinal_ex(md2, buf, NULL)) goto err; - for (i = passwd_len; i > sizeof buf; i -= sizeof buf) { - if (!EVP_DigestUpdate(md, buf, sizeof buf)) + for (i = passwd_len; i > sizeof(buf); i -= sizeof(buf)) { + if (!EVP_DigestUpdate(md, buf, sizeof(buf))) goto err; } if (!EVP_DigestUpdate(md, buf, i)) @@ -413,7 +413,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt) goto err; if (!EVP_DigestUpdate(md2, (i & 1) ? (unsigned const char *)passwd : buf, - (i & 1) ? passwd_len : sizeof buf)) + (i & 1) ? passwd_len : sizeof(buf))) goto err; if (i % 3) { if (!EVP_DigestUpdate(md2, ascii_salt, salt_len)) @@ -425,7 +425,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt) } if (!EVP_DigestUpdate(md2, (i & 1) ? buf : (unsigned const char *)passwd, - (i & 1) ? sizeof buf : passwd_len)) + (i & 1) ? sizeof(buf) : passwd_len)) goto err; if (!EVP_DigestFinal_ex(md2, buf, NULL)) goto err; @@ -437,7 +437,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt) { /* transform buf into output string */ - unsigned char buf_perm[sizeof buf]; + unsigned char buf_perm[sizeof(buf)]; int dest, source; char *output; @@ -449,7 +449,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt) buf_perm[15] = buf[11]; # ifndef PEDANTIC /* Unfortunately, this generates a "no * effect" warning */ - assert(16 == sizeof buf_perm); + assert(16 == sizeof(buf_perm)); # endif output = salt_out + salt_len; @@ -558,14 +558,14 @@ static char *shacrypt(const char *passwd, const char *magic, const char *salt) } } - OPENSSL_strlcpy(ascii_magic, magic, sizeof ascii_magic); + OPENSSL_strlcpy(ascii_magic, magic, sizeof(ascii_magic)); #ifdef CHARSET_EBCDIC if ((magic[0] & 0x80) != 0) /* High bit is 1 in EBCDIC alnums */ ebcdic2ascii(ascii_magic, ascii_magic, magic_len); #endif /* The salt gets truncated to 16 chars */ - OPENSSL_strlcpy(ascii_salt, salt, sizeof ascii_salt); + OPENSSL_strlcpy(ascii_salt, salt, sizeof(ascii_salt)); salt_len = strlen(ascii_salt); #ifdef CHARSET_EBCDIC ebcdic2ascii(ascii_salt, ascii_salt, salt_len); @@ -580,9 +580,9 @@ static char *shacrypt(const char *passwd, const char *magic, const char *salt) #endif out_buf[0] = 0; - OPENSSL_strlcat(out_buf, ascii_dollar, sizeof out_buf); - OPENSSL_strlcat(out_buf, ascii_magic, sizeof out_buf); - OPENSSL_strlcat(out_buf, ascii_dollar, sizeof out_buf); + OPENSSL_strlcat(out_buf, ascii_dollar, sizeof(out_buf)); + OPENSSL_strlcat(out_buf, ascii_magic, sizeof(out_buf)); + OPENSSL_strlcat(out_buf, ascii_dollar, sizeof(out_buf)); if (rounds_custom) { char tmp_buf[80]; /* "rounds=999999999" */ sprintf(tmp_buf, "rounds=%u", rounds); @@ -591,10 +591,10 @@ static char *shacrypt(const char *passwd, const char *magic, const char *salt) if (tmp_buf[0] != 0x72) /* ASCII 'r' */ ebcdic2ascii(tmp_buf, tmp_buf, strlen(tmp_buf)); #endif - OPENSSL_strlcat(out_buf, tmp_buf, sizeof out_buf); - OPENSSL_strlcat(out_buf, ascii_dollar, sizeof out_buf); + OPENSSL_strlcat(out_buf, tmp_buf, sizeof(out_buf)); + OPENSSL_strlcat(out_buf, ascii_dollar, sizeof(out_buf)); } - OPENSSL_strlcat(out_buf, ascii_salt, sizeof out_buf); + OPENSSL_strlcat(out_buf, ascii_salt, sizeof(out_buf)); /* assert "$5$rounds=999999999$......salt......" */ if (strlen(out_buf) > 3 + 17 * rounds_custom + salt_len ) diff --git a/apps/pkcs12.c b/apps/pkcs12.c index 209aa33d1b..6a2f7c0043 100644 --- a/apps/pkcs12.c +++ b/apps/pkcs12.c @@ -319,8 +319,8 @@ int pkcs12_main(int argc, char **argv) /* To avoid bit rot */ if (1) { #ifndef OPENSSL_NO_UI_CONSOLE - if (EVP_read_pw_string - (macpass, sizeof macpass, "Enter MAC Password:", export_cert)) { + if (EVP_read_pw_string( + macpass, sizeof(macpass), "Enter MAC Password:", export_cert)) { BIO_printf(bio_err, "Can't read Password\n"); goto end; } @@ -438,8 +438,8 @@ int pkcs12_main(int argc, char **argv) /* To avoid bit rot */ if (1) { #ifndef OPENSSL_NO_UI_CONSOLE - if (EVP_read_pw_string(pass, sizeof pass, "Enter Export Password:", - 1)) { + if (EVP_read_pw_string(pass, sizeof(pass), + "Enter Export Password:", 1)) { BIO_printf(bio_err, "Can't read Password\n"); goto export_end; } @@ -504,7 +504,7 @@ int pkcs12_main(int argc, char **argv) if (!noprompt) { if (1) { #ifndef OPENSSL_NO_UI_CONSOLE - if (EVP_read_pw_string(pass, sizeof pass, "Enter Import Password:", + if (EVP_read_pw_string(pass, sizeof(pass), "Enter Import Password:", 0)) { BIO_printf(bio_err, "Can't read Password\n"); goto end; @@ -517,7 +517,7 @@ int pkcs12_main(int argc, char **argv) } if (!twopass) - OPENSSL_strlcpy(macpass, pass, sizeof macpass); + OPENSSL_strlcpy(macpass, pass, sizeof(macpass)); if ((options & INFO) && PKCS12_mac_present(p12)) { const ASN1_INTEGER *tmaciter; diff --git a/apps/pkcs8.c b/apps/pkcs8.c index ea0e8567da..dfc23e5b59 100644 --- a/apps/pkcs8.c +++ b/apps/pkcs8.c @@ -245,7 +245,7 @@ int pkcs8_main(int argc, char **argv) #ifndef OPENSSL_NO_UI_CONSOLE p8pass = pass; if (EVP_read_pw_string - (pass, sizeof pass, "Enter Encryption Password:", 1)) { + (pass, sizeof(pass), "Enter Encryption Password:", 1)) { X509_ALGOR_free(pbe); goto end; } @@ -305,7 +305,7 @@ int pkcs8_main(int argc, char **argv) } else if (1) { #ifndef OPENSSL_NO_UI_CONSOLE p8pass = pass; - if (EVP_read_pw_string(pass, sizeof pass, "Enter Password:", 0)) { + if (EVP_read_pw_string(pass, sizeof(pass), "Enter Password:", 0)) { BIO_printf(bio_err, "Can't read Password\n"); goto end; } diff --git a/apps/rand.c b/apps/rand.c index 05b944287a..0ab22a99c8 100644 --- a/apps/rand.c +++ b/apps/rand.c @@ -102,7 +102,7 @@ int rand_main(int argc, char **argv) chunk = num; if (chunk > (int)sizeof(buf)) - chunk = sizeof buf; + chunk = sizeof(buf); r = RAND_bytes(buf, chunk); if (r <= 0) goto end; diff --git a/apps/req.c b/apps/req.c index 79425e5939..8dcfbced23 100644 --- a/apps/req.c +++ b/apps/req.c @@ -1168,7 +1168,7 @@ static int add_DN_object(X509_NAME *n, char *text, const char *def, } else { buf[0] = '\0'; if (!batch) { - if (!fgets(buf, sizeof buf, stdin)) + if (!fgets(buf, sizeof(buf), stdin)) return 0; } else { buf[0] = '\n'; @@ -1228,7 +1228,7 @@ static int add_attribute_object(X509_REQ *req, char *text, const char *def, } else { buf[0] = '\0'; if (!batch) { - if (!fgets(buf, sizeof buf, stdin)) + if (!fgets(buf, sizeof(buf), stdin)) return 0; } else { buf[0] = '\n'; diff --git a/apps/s_server.c b/apps/s_server.c index 5095bab4d3..f61ddd2103 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -2019,7 +2019,7 @@ int s_server_main(int argc, char *argv[]) SSL_CTX_set_verify(ctx, s_server_verify, verify_callback); if (!SSL_CTX_set_session_id_context(ctx, (void *)&s_server_session_id_context, - sizeof s_server_session_id_context)) { + sizeof(s_server_session_id_context))) { BIO_printf(bio_err, "error setting session id context\n"); ERR_print_errors(bio_err); goto end; @@ -2033,7 +2033,7 @@ int s_server_main(int argc, char *argv[]) SSL_CTX_set_verify(ctx2, s_server_verify, verify_callback); if (!SSL_CTX_set_session_id_context(ctx2, (void *)&s_server_session_id_context, - sizeof s_server_session_id_context)) { + sizeof(s_server_session_id_context))) { BIO_printf(bio_err, "error setting session id context\n"); ERR_print_errors(bio_err); goto end; @@ -2812,7 +2812,7 @@ static void print_connection_info(SSL *con) peer = NULL; } - if (SSL_get_shared_ciphers(con, buf, sizeof buf) != NULL) + if (SSL_get_shared_ciphers(con, buf, sizeof(buf)) != NULL) BIO_printf(bio_s_out, "Shared ciphers:%s\n", buf); str = SSL_CIPHER_get_name(SSL_get_current_cipher(con)); ssl_print_sigalgs(bio_s_out, con); diff --git a/apps/speed.c b/apps/speed.c index 8d671e7046..610716d52c 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -3084,7 +3084,7 @@ static char *sstrsep(char **string, const char *delim) if (**string == 0) return NULL; - memset(isdelim, 0, sizeof isdelim); + memset(isdelim, 0, sizeof(isdelim)); isdelim[0] = 1; while (*delim) { @@ -3145,7 +3145,7 @@ static int do_multi(int multi, int size_num) char *p; f = fdopen(fds[n], "r"); - while (fgets(buf, sizeof buf, f)) { + while (fgets(buf, sizeof(buf), f)) { p = strchr(buf, '\n'); if (p) *p = '\0'; diff --git a/apps/vms_term_sock.c b/apps/vms_term_sock.c index 03274376e1..9a90a1e790 100644 --- a/apps/vms_term_sock.c +++ b/apps/vms_term_sock.c @@ -144,7 +144,7 @@ int main (int argc, char *argv[], char *envp[]) ** Process the terminal input */ LogMessage ("Waiting on terminal I/O ...\n"); - len = recv (TermSock, TermBuff, sizeof (TermBuff), 0) ; + len = recv (TermSock, TermBuff, sizeof(TermBuff), 0) ; TermBuff[len] = '\0'; LogMessage ("Received terminal I/O [%s]", TermBuff); @@ -210,7 +210,7 @@ int TerminalSocket (int FunctionCode, int *ReturnSocket) TerminalDeviceAst, 0, TerminalDeviceBuff, - sizeof (TerminalDeviceBuff) - 2, + sizeof(TerminalDeviceBuff) - 2, 0, 0, 0, 0); if (! (status & 1)) { LogMessage ("TerminalSocket: SYS$QIO () - %08X", status); @@ -318,7 +318,7 @@ static int CreateSocketPair (int SocketFamily, /* ** Initialize the socket information */ - slen = sizeof (sin); + slen = sizeof(sin); memset ((char *) &sin, 0, slen); sin.sin_family = SocketFamily; sin.sin_addr.s_addr = inet_addr (LocalHostAddr); @@ -435,12 +435,12 @@ static int CreateSocketPair (int SocketFamily, /* ** Now issue the connect */ - memset ((char *) &sin, 0, sizeof (sin)) ; + memset ((char *) &sin, 0, sizeof(sin)) ; sin.sin_family = SocketFamily; sin.sin_addr.s_addr = inet_addr (LocalHostAddr) ; sin.sin_port = LocalHostPort ; - status = connect (SockDesc2, (struct sockaddr *) &sin, sizeof (sin)); + status = connect (SockDesc2, (struct sockaddr *) &sin, sizeof(sin)); if (status < 0 ) { LogMessage ("CreateSocketPair: connect () - %d", errno); sys$cantim (&sptb, 0); @@ -529,7 +529,7 @@ static int TerminalDeviceAst (int astparm) TerminalDeviceAst, 0, TerminalDeviceBuff, - sizeof (TerminalDeviceBuff) - 1, + sizeof(TerminalDeviceBuff) - 1, 0, 0, 0, 0); /* |