summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2017-12-07 13:39:34 -0500
committerRich Salz <rsalz@openssl.org>2017-12-07 19:11:49 -0500
commitcbe2964821bb063f61ed2544cfce196ec1c0d62b (patch)
tree098cdc33d8174fffae52bd8885e384ef86570c25
parente7a206694451be19432d079691610994473f53b7 (diff)
Consistent formatting for sizeof(foo)
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4872)
-rw-r--r--apps/apps.c48
-rw-r--r--apps/ciphers.c2
-rw-r--r--apps/dhparam.c4
-rw-r--r--apps/dsaparam.c6
-rw-r--r--apps/ecparam.c12
-rw-r--r--apps/enc.c18
-rw-r--r--apps/errstr.c2
-rw-r--r--apps/ocsp.c4
-rw-r--r--apps/openssl.c2
-rw-r--r--apps/opt.c18
-rw-r--r--apps/passwd.c42
-rw-r--r--apps/pkcs12.c12
-rw-r--r--apps/pkcs8.c4
-rw-r--r--apps/rand.c2
-rw-r--r--apps/req.c4
-rw-r--r--apps/s_server.c6
-rw-r--r--apps/speed.c4
-rw-r--r--apps/vms_term_sock.c12
-rw-r--r--crypto/asn1/a_object.c4
-rw-r--r--crypto/asn1/a_strex.c8
-rw-r--r--crypto/asn1/tasn_prn.c2
-rw-r--r--crypto/async/async.c6
-rw-r--r--crypto/async/async_wait.c2
-rw-r--r--crypto/bio/b_addr.c2
-rw-r--r--crypto/bio/b_print.c4
-rw-r--r--crypto/des/fcrypt.c2
-rw-r--r--crypto/des/set_key.c2
-rw-r--r--crypto/ec/ec_mult.c12
-rw-r--r--crypto/ec/ecp_nistp224.c6
-rw-r--r--crypto/ec/ecp_nistp256.c6
-rw-r--r--crypto/ec/ecp_nistp521.c6
-rw-r--r--crypto/ec/ecp_smpl.c2
-rw-r--r--crypto/err/err_prn.c2
-rw-r--r--crypto/evp/evp_enc.c6
-rw-r--r--crypto/evp/p5_crpt2.c2
-rw-r--r--crypto/init.c2
-rw-r--r--crypto/mem_sec.c6
-rw-r--r--crypto/rsa/rsa_pss.c4
-rw-r--r--crypto/x509/t_x509.c4
-rw-r--r--crypto/x509v3/v3_admis.c2
-rw-r--r--crypto/x509v3/v3_info.c2
-rw-r--r--ssl/record/rec_layer_d1.c2
-rw-r--r--ssl/record/rec_layer_s3.c6
-rw-r--r--ssl/s3_lib.c4
-rw-r--r--ssl/ssl_cert.c6
-rw-r--r--ssl/ssl_lib.c6
-rw-r--r--ssl/ssl_sess.c6
-rw-r--r--ssl/statem/statem_clnt.c2
-rw-r--r--test/bftest.c2
-rw-r--r--test/d2i_test.c2
-rw-r--r--test/ectest.c12
-rw-r--r--test/igetest.c138
-rw-r--r--test/sanitytest.c2
-rw-r--r--test/ssltest_old.c22
54 files changed, 253 insertions, 253 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) {