Add some casts for %j
authorRich Salz <rsalz@openssl.org>
Mon, 14 Aug 2017 23:59:54 +0000 (19:59 -0400)
committerRich Salz <rsalz@openssl.org>
Mon, 14 Aug 2017 23:59:54 +0000 (19:59 -0400)
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/4160)

apps/enc.c
apps/s_client.c
crypto/asn1/x_int64.c
test/constant_time_test.c

index db5d3a2991effb0c74c41d2ea071fe40265294f1..9729d10710ebbf9902f383998344090caceeb308 100644 (file)
@@ -555,8 +555,10 @@ int enc_main(int argc, char **argv)
 
     ret = 0;
     if (verbose) {
-        BIO_printf(bio_err, "bytes read   : %8ju\n", BIO_number_read(in));
-        BIO_printf(bio_err, "bytes written: %8ju\n", BIO_number_written(out));
+        BIO_printf(bio_err, "bytes read   : %8ju\n",
+                   (uintmax_t)BIO_number_read(in));
+        BIO_printf(bio_err, "bytes written: %8ju\n",
+                   (uintmax_t)BIO_number_written(out));
     }
  end:
     ERR_print_errors(bio_err);
index 45464a4ca981d23e296d984feede74ec8f5cd6c4..c322dee1da31d6d2f6f0cdecc0be3d35c64153dc 100644 (file)
@@ -3118,8 +3118,8 @@ static void print_stuff(BIO *bio, SSL *s, int full)
         BIO_printf(bio,
                    "---\nSSL handshake has read %ju bytes "
                    "and written %ju bytes\n",
-                   BIO_number_read(SSL_get_rbio(s)),
-                   BIO_number_written(SSL_get_wbio(s)));
+                   (uintmax_t)BIO_number_read(SSL_get_rbio(s)),
+                   (uintmax_t)BIO_number_written(SSL_get_wbio(s)));
     }
     print_verify_detail(s, bio);
     BIO_printf(bio, (SSL_session_reused(s) ? "---\nReused, " : "---\nNew, "));
index 714e2f7075057ec2faa86dfe3474bd09fc3879ee..8f06475a93366c0d250cd50b9c438468e665554d 100644 (file)
@@ -102,8 +102,8 @@ static int uint64_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it,
                         int indent, const ASN1_PCTX *pctx)
 {
     if ((it->size & INTxx_FLAG_SIGNED) == INTxx_FLAG_SIGNED)
-        return BIO_printf(out, "%jd\n", **(int64_t **)pval);
-    return BIO_printf(out, "%ju\n", **(uint64_t **)pval);
+        return BIO_printf(out, "%jd\n", (intmax_t)**(int64_t **)pval);
+    return BIO_printf(out, "%ju\n", (uintmax_t)**(uint64_t **)pval);
 }
 
 /* 32-bit variants */
index 8575194e90ae203859ce31c7560bd9edd26884d1..ef391b9d345ed789b3995986b908a27db3b23c6d 100644 (file)
@@ -66,11 +66,11 @@ static int test_binary_op_64(uint64_t (*op)(uint64_t a, uint64_t b),
 
     if (is_true && c != CONSTTIME_TRUE_64) {
         TEST_error("TRUE %s op failed", op_name);
-        BIO_printf(bio_err, "a=%jx b=%jx\n", a, b);
+        BIO_printf(bio_err, "a=%jx b=%jx\n", (uintmax_t)a, (uintmax_t)b);
         return 0;
     } else if (!is_true && c != CONSTTIME_FALSE_64) {
         TEST_error("FALSE %s op failed", op_name);
-        BIO_printf(bio_err, "a=%jx b=%jx\n", a, b);
+        BIO_printf(bio_err, "a=%jx b=%jx\n", (uintmax_t)a, (uintmax_t)b);
         return 0;
     }
     return 1;
@@ -137,12 +137,14 @@ static int test_select_64(uint64_t a, uint64_t b)
 
     if (selected != a) {
         TEST_error("test_select_64 TRUE failed");
-        BIO_printf(bio_err, "a=%jx b=%jx got %jx wanted a\n", a, b, selected);
+        BIO_printf(bio_err, "a=%jx b=%jx got %jx wanted a\n",
+                   (uintmax_t)a, (uintmax_t)b, (uintmax_t)selected);
         return 0;
     }
     selected = constant_time_select_64(CONSTTIME_FALSE_64, a, b);
     if (selected != b) {
-        BIO_printf(bio_err, "a=%jx b=%jx got %jx wanted b\n", a, b, selected);
+        BIO_printf(bio_err, "a=%jx b=%jx got %jx wanted b\n",
+                   (uintmax_t)a, (uintmax_t)b, (uintmax_t)selected);
         return 0;
     }
     return 1;