diff options
author | J.W. Jagersma <jwjagersma@gmail.com> | 2022-10-01 18:41:44 +0200 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-12-08 11:09:12 +1100 |
commit | 2ce940e54e9a1bbe1d99aa655567c91d715f74ab (patch) | |
tree | 0291360b5ae520b48cbc9d50547c213b0ecf7ab9 | |
parent | f3e9308fe1b692c424feaa256fbecce958cef1f4 (diff) |
Cast values to match printf format strings.
For some reason djgpp uses '(unsigned) long int' for (u)int32_t. This
causes errors with -Werror=format, even though these types are in
practice identical.
Obvious solution: cast to the types indicated by the format string.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19843)
-rw-r--r-- | crypto/asn1/x_int64.c | 4 | ||||
-rw-r--r-- | ssl/ssl_ciph.c | 15 | ||||
-rw-r--r-- | ssl/ssl_txt.c | 2 | ||||
-rw-r--r-- | ssl/t1_trce.c | 2 | ||||
-rw-r--r-- | test/ssl_cert_table_internal_test.c | 3 |
5 files changed, 16 insertions, 10 deletions
diff --git a/crypto/asn1/x_int64.c b/crypto/asn1/x_int64.c index eb78c7e367..c15857cc55 100644 --- a/crypto/asn1/x_int64.c +++ b/crypto/asn1/x_int64.c @@ -224,8 +224,8 @@ static int uint32_print(BIO *out, const 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, "%d\n", **(int32_t **)pval); - return BIO_printf(out, "%u\n", **(uint32_t **)pval); + return BIO_printf(out, "%d\n", (int)**(int32_t **)pval); + return BIO_printf(out, "%u\n", (unsigned int)**(uint32_t **)pval); } diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c index 73a821289d..93de9cf8fd 100644 --- a/ssl/ssl_ciph.c +++ b/ssl/ssl_ciph.c @@ -819,8 +819,9 @@ static void ssl_cipher_apply_rule(uint32_t cipher_id, uint32_t alg_mkey, OSSL_TRACE_BEGIN(TLS_CIPHER){ BIO_printf(trc_out, "Applying rule %d with %08x/%08x/%08x/%08x/%08x %08x (%d)\n", - rule, alg_mkey, alg_auth, alg_enc, alg_mac, min_tls, - algo_strength, strength_bits); + rule, (unsigned int)alg_mkey, (unsigned int)alg_auth, + (unsigned int)alg_enc, (unsigned int)alg_mac, min_tls, + (unsigned int)algo_strength, (int)strength_bits); } if (rule == CIPHER_DEL || rule == CIPHER_BUMP) @@ -864,9 +865,13 @@ static void ssl_cipher_apply_rule(uint32_t cipher_id, uint32_t alg_mkey, BIO_printf(trc_out, "\nName: %s:" "\nAlgo = %08x/%08x/%08x/%08x/%08x Algo_strength = %08x\n", - cp->name, cp->algorithm_mkey, cp->algorithm_auth, - cp->algorithm_enc, cp->algorithm_mac, cp->min_tls, - cp->algo_strength); + cp->name, + (unsigned int)cp->algorithm_mkey, + (unsigned int)cp->algorithm_auth, + (unsigned int)cp->algorithm_enc, + (unsigned int)cp->algorithm_mac, + cp->min_tls, + (unsigned int)cp->algo_strength); } if (cipher_id != 0 && (cipher_id != cp->id)) continue; diff --git a/ssl/ssl_txt.c b/ssl/ssl_txt.c index 212fe00962..2be08e37fa 100644 --- a/ssl/ssl_txt.c +++ b/ssl/ssl_txt.c @@ -151,7 +151,7 @@ int SSL_SESSION_print(BIO *bp, const SSL_SESSION *x) if (istls13) { if (BIO_printf(bp, " Max Early Data: %u\n", - x->ext.max_early_data) <= 0) + (unsigned int)x->ext.max_early_data) <= 0) goto err; } diff --git a/ssl/t1_trce.c b/ssl/t1_trce.c index e311b3c74a..c1f3d9107a 100644 --- a/ssl/t1_trce.c +++ b/ssl/t1_trce.c @@ -884,7 +884,7 @@ static int ssl_print_extension(BIO *bio, int indent, int server, | ((unsigned int)ext[2] << 8) | (unsigned int)ext[3]; BIO_indent(bio, indent + 2, 80); - BIO_printf(bio, "max_early_data=%u\n", max_early_data); + BIO_printf(bio, "max_early_data=%u\n", (unsigned int)max_early_data); break; default: diff --git a/test/ssl_cert_table_internal_test.c b/test/ssl_cert_table_internal_test.c index 1dc09c013c..397834a8f1 100644 --- a/test/ssl_cert_table_internal_test.c +++ b/test/ssl_cert_table_internal_test.c @@ -35,7 +35,8 @@ static int do_test_cert_table(int nid, uint32_t amask, size_t idx, TEST_note("Expected %s, got %s\n", OBJ_nid2sn(nid), OBJ_nid2sn(clu->nid)); if (clu->amask != amask) - TEST_note("Expected auth mask 0x%x, got 0x%x\n", amask, clu->amask); + TEST_note("Expected auth mask 0x%x, got 0x%x\n", + (unsigned int)amask, (unsigned int)clu->amask); return 0; } |