diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-02-17 11:00:15 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-02-17 11:00:15 +0000 |
commit | 2dd585deb6ddaa6ed66998abca285823ba099be1 (patch) | |
tree | 202f14d08e6b8853b4e5b310341e98b96cacb9ca | |
parent | 3115262ad87bc3b9d3f32c3f58f8ea380681ebaf (diff) |
Fix compiler warnings in the format strings: use %zd for ssize_t and
%zu for size_t.
From Andre de Oliveira
With input and OK from blambert@ markus@
-rw-r--r-- | sbin/iked/ca.c | 6 | ||||
-rw-r--r-- | sbin/iked/crypto.c | 4 | ||||
-rw-r--r-- | sbin/iked/eap.c | 12 | ||||
-rw-r--r-- | sbin/iked/ikev1.c | 4 | ||||
-rw-r--r-- | sbin/iked/ikev2.c | 50 | ||||
-rw-r--r-- | sbin/iked/ikev2_msg.c | 24 | ||||
-rw-r--r-- | sbin/iked/ikev2_pld.c | 18 |
7 files changed, 59 insertions, 59 deletions
diff --git a/sbin/iked/ca.c b/sbin/iked/ca.c index a36ab7cd52c..703a595f51f 100644 --- a/sbin/iked/ca.c +++ b/sbin/iked/ca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ca.c,v 1.24 2013/11/28 20:21:17 markus Exp $ */ +/* $OpenBSD: ca.c,v 1.25 2014/02/17 11:00:14 reyk Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -310,7 +310,7 @@ ca_setauth(struct iked *env, struct iked_sa *sa, else { iov[2].iov_base = ibuf_data(authmsg); iov[2].iov_len = ibuf_size(authmsg); - log_debug("%s: auth length %d", __func__, ibuf_size(authmsg)); + log_debug("%s: auth length %zu", __func__, ibuf_size(authmsg)); } if (proc_composev_imsg(env, id, IMSG_AUTH, -1, iov, iovcnt) == -1) @@ -607,7 +607,7 @@ ca_reload(struct iked *env) iov[1].iov_base = ibuf_data(env->sc_certreq); iov[1].iov_len = ibuf_length(env->sc_certreq); - log_debug("%s: loaded %d ca certificate%s", __func__, + log_debug("%s: loaded %zu ca certificate%s", __func__, ibuf_length(env->sc_certreq) / SHA_DIGEST_LENGTH, ibuf_length(env->sc_certreq) == SHA_DIGEST_LENGTH ? "" : "s"); diff --git a/sbin/iked/crypto.c b/sbin/iked/crypto.c index 05514ac8dd1..d78c3119d27 100644 --- a/sbin/iked/crypto.c +++ b/sbin/iked/crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.c,v 1.12 2014/01/24 07:29:17 markus Exp $ */ +/* $OpenBSD: crypto.c,v 1.13 2014/02/17 11:00:14 reyk Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -328,7 +328,7 @@ cipher_setiv(struct iked_cipher *encr, void *iv, size_t len) ibuf_release(encr->encr_iv); if (iv != NULL) { if (len < encr->encr_ivlength) { - log_debug("%s: invalid IV length %d", __func__, len); + log_debug("%s: invalid IV length %zu", __func__, len); return (NULL); } encr->encr_iv = ibuf_new(iv, encr->encr_ivlength); diff --git a/sbin/iked/eap.c b/sbin/iked/eap.c index b41cfe0e5cc..371c17046eb 100644 --- a/sbin/iked/eap.c +++ b/sbin/iked/eap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eap.c,v 1.9 2013/03/21 04:30:14 deraadt Exp $ */ +/* $OpenBSD: eap.c,v 1.10 2014/02/17 11:00:14 reyk Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -77,11 +77,11 @@ eap_identity_response(struct eap_message *eap) ptr += sizeof(*eap); if (len == 0 || (str = get_string(ptr, len)) == NULL) { - log_info("%s: invalid identity response, length %d", + log_info("%s: invalid identity response, length %zu", __func__, len); return (NULL); } - log_debug("%s: identity '%s' length %d", __func__, str, len); + log_debug("%s: identity '%s' length %zd", __func__, str, len); return (str); } @@ -397,7 +397,7 @@ eap_parse(struct iked *env, struct iked_sa *sa, void *data, int response) return (-1); } log_info("%s: %s %s id %d " - "length %d valuesize %d name '%s' length %d", + "length %d valuesize %d name '%s' length %zu", __func__, print_map(eap->eap_type, eap_type_map), print_map(ms->ms_opcode, eap_msopcode_map), @@ -418,7 +418,7 @@ eap_parse(struct iked *env, struct iked_sa *sa, void *data, int response) return (-1); } log_info("%s: %s %s id %d " - "length %d valuesize %d name '%s' name-length %d", + "length %d valuesize %d name '%s' name-length %zu", __func__, print_map(eap->eap_type, eap_type_map), print_map(ms->ms_opcode, eap_msopcode_map), @@ -440,7 +440,7 @@ eap_parse(struct iked *env, struct iked_sa *sa, void *data, int response) return (-1); } log_info("%s: %s %s request id %d " - "length %d message '%s' message-len %d", + "length %d message '%s' message-len %zu", __func__, print_map(eap->eap_type, eap_type_map), print_map(ms->ms_opcode, eap_msopcode_map), diff --git a/sbin/iked/ikev1.c b/sbin/iked/ikev1.c index eec134d73d3..da152ccb33d 100644 --- a/sbin/iked/ikev1.c +++ b/sbin/iked/ikev1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikev1.c,v 1.13 2013/03/21 04:30:14 deraadt Exp $ */ +/* $OpenBSD: ikev1.c,v 1.14 2014/02/17 11:00:14 reyk Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -108,7 +108,7 @@ ikev1_dispatch_ikev2(int fd, struct privsep_proc *p, struct imsg *imsg) return (0); } - log_debug("%s: message length %d", __func__, len); + log_debug("%s: message length %zd", __func__, len); ikev1_recv(env, &msg); ikev2_msg_cleanup(env, &msg); diff --git a/sbin/iked/ikev2.c b/sbin/iked/ikev2.c index 8c61528f8a6..95bb8f5a2c6 100644 --- a/sbin/iked/ikev2.c +++ b/sbin/iked/ikev2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikev2.c,v 1.92 2014/02/14 09:00:03 markus Exp $ */ +/* $OpenBSD: ikev2.c,v 1.93 2014/02/17 11:00:14 reyk Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -177,7 +177,7 @@ ikev2_dispatch_ikev1(int fd, struct privsep_proc *p, struct imsg *imsg) return (0); } - log_debug("%s: message length %d", __func__, len); + log_debug("%s: message length %zd", __func__, len); ikev2_recv(env, &msg); ikev2_msg_cleanup(env, &msg); @@ -214,7 +214,7 @@ ikev2_dispatch_cert(int fd, struct privsep_proc *p, struct imsg *imsg) env->sc_certreq = ibuf_new(ptr, IMSG_DATA_SIZE(imsg) - sizeof(type)); - log_debug("%s: updated local CERTREQ type %s length %d", + log_debug("%s: updated local CERTREQ type %s length %zu", __func__, print_map(type, ikev2_cert_map), ibuf_length(env->sc_certreq)); @@ -257,7 +257,7 @@ ikev2_dispatch_cert(int fd, struct privsep_proc *p, struct imsg *imsg) type == IKEV2_CERT_NONE) ignore = 1; - log_debug("%s: cert type %s length %d, %s", __func__, + log_debug("%s: cert type %s length %zu, %s", __func__, print_map(type, ikev2_cert_map), len, ignore ? "ignored" : "ok"); @@ -292,7 +292,7 @@ ikev2_dispatch_cert(int fd, struct privsep_proc *p, struct imsg *imsg) break; } - log_debug("%s: AUTH type %d len %d", __func__, type, len); + log_debug("%s: AUTH type %d len %zu", __func__, type, len); id = &sa->sa_localauth; id->id_type = type; @@ -338,7 +338,7 @@ ikev2_getimsgdata(struct iked *env, struct imsg *imsg, struct iked_sahdr *sh, sa = sa_lookup(env, sh->sh_ispi, sh->sh_rspi, sh->sh_initiator); log_debug("%s: imsg %d rspi %s ispi %s initiator %d sa %s" - " type %d data length %d", + " type %d data length %zd", __func__, imsg->hdr.type, print_spi(sh->sh_rspi, 8), print_spi(sh->sh_ispi, 8), @@ -1128,7 +1128,7 @@ ikev2_policy2id(struct iked_static_id *polid, struct iked_id *id, int srcid) if (ikev2_print_id(id, idstr, sizeof(idstr)) == -1) return (-1); - log_debug("%s: %s %s length %d", __func__, + log_debug("%s: %s %s length %zu", __func__, srcid ? "srcid" : "dstid", idstr, ibuf_size(id->id_buf)); @@ -1350,7 +1350,7 @@ ikev2_add_certreq(struct ibuf *e, struct ikev2_payload **pld, ssize_t len, len += ibuf_size(certreq); } - log_debug("%s: type %s length %d", __func__, + log_debug("%s: type %s length %zd", __func__, print_map(type, ikev2_cert_map), len); return (len); @@ -1418,7 +1418,7 @@ ikev2_next_payload(struct ikev2_payload *pld, size_t length, return (-1); } - log_debug("%s: length %d nextpayload %s", + log_debug("%s: length %zu nextpayload %s", __func__, pldlength, print_map(nextpayload, ikev2_payload_map)); pld->pld_length = htobe16(pldlength); @@ -1718,7 +1718,7 @@ ikev2_add_proposals(struct iked *env, struct iked_sa *sa, struct ibuf *buf, length += saplength; } - log_debug("%s: length %d", __func__, length); + log_debug("%s: length %zd", __func__, length); return (length); } @@ -2764,7 +2764,7 @@ ikev2_ike_sa_alive(struct iked *env, void *arg) continue; gettimeofday(&tv, NULL); diff = (u_int32_t)(tv.tv_sec - last_used); - log_debug("%s: %s CHILD SA spi %s last used %u second(s) ago", + log_debug("%s: %s CHILD SA spi %s last used %llu second(s) ago", __func__, csa->csa_dir == IPSP_DIRECTION_IN ? "incoming" : "outgoing", print_spi(csa->csa_spi.spi, csa->csa_spi.spi_size), diff); @@ -3379,7 +3379,7 @@ ikev2_sa_keys(struct iked *env, struct iked_sa *sa, struct ibuf *key) if (dh_create_shared(group, dhsecret->buf, sa->sa_dhpeer->buf) == -1) { log_debug("%s: failed to get dh secret" - " group %d len %d secret %d exchange %d", __func__, + " group %d len %d secret %zu exchange %zu", __func__, group->id, dh_getlen(group), ibuf_length(dhsecret), ibuf_length(sa->sa_dhpeer)); goto done; @@ -3423,7 +3423,7 @@ ikev2_sa_keys(struct iked *env, struct iked_sa *sa, struct ibuf *key) hash_update(prf, dhsecret->buf, ibuf_length(dhsecret)); hash_final(prf, skeyseed->buf, &tmplen); - log_debug("%s: SKEYSEED with %d bytes", __func__, tmplen); + log_debug("%s: SKEYSEED with %zu bytes", __func__, tmplen); print_hex(skeyseed->buf, 0, tmplen); if (ibuf_setsize(skeyseed, tmplen) == -1) { @@ -3451,7 +3451,7 @@ ikev2_sa_keys(struct iked *env, struct iked_sa *sa, struct ibuf *key) goto done; } - log_debug("%s: S with %d bytes", __func__, ibuf_length(s)); + log_debug("%s: S with %zu bytes", __func__, ibuf_length(s)); print_hex(s->buf, 0, ibuf_length(s)); /* @@ -3483,25 +3483,25 @@ ikev2_sa_keys(struct iked *env, struct iked_sa *sa, struct ibuf *key) goto done; } - log_debug("%s: SK_d with %d bytes", __func__, + log_debug("%s: SK_d with %zu bytes", __func__, ibuf_length(sa->sa_key_d)); print_hex(sa->sa_key_d->buf, 0, ibuf_length(sa->sa_key_d)); - log_debug("%s: SK_ai with %d bytes", __func__, + log_debug("%s: SK_ai with %zu bytes", __func__, ibuf_length(sa->sa_key_iauth)); print_hex(sa->sa_key_iauth->buf, 0, ibuf_length(sa->sa_key_iauth)); - log_debug("%s: SK_ar with %d bytes", __func__, + log_debug("%s: SK_ar with %zu bytes", __func__, ibuf_length(sa->sa_key_rauth)); print_hex(sa->sa_key_rauth->buf, 0, ibuf_length(sa->sa_key_rauth)); - log_debug("%s: SK_ei with %d bytes", __func__, + log_debug("%s: SK_ei with %zu bytes", __func__, ibuf_length(sa->sa_key_iencr)); print_hex(sa->sa_key_iencr->buf, 0, ibuf_length(sa->sa_key_iencr)); - log_debug("%s: SK_er with %d bytes", __func__, + log_debug("%s: SK_er with %zu bytes", __func__, ibuf_length(sa->sa_key_rencr)); print_hex(sa->sa_key_rencr->buf, 0, ibuf_length(sa->sa_key_rencr)); - log_debug("%s: SK_pi with %d bytes", __func__, + log_debug("%s: SK_pi with %zu bytes", __func__, ibuf_length(sa->sa_key_iprf)); print_hex(sa->sa_key_iprf->buf, 0, ibuf_length(sa->sa_key_iprf)); - log_debug("%s: SK_pr with %d bytes", __func__, + log_debug("%s: SK_pr with %zu bytes", __func__, ibuf_length(sa->sa_key_rprf)); print_hex(sa->sa_key_rprf->buf, 0, ibuf_length(sa->sa_key_rprf)); @@ -3570,12 +3570,12 @@ ikev2_prfplus(struct iked_hash *prf, struct ibuf *key, struct ibuf *seed, ibuf_release(t2); ibuf_add(t, t1->buf, ibuf_length(t1)); - log_debug("%s: T%d with %d bytes", __func__, + log_debug("%s: T%d with %zu bytes", __func__, pad, ibuf_length(t1)); print_hex(t1->buf, 0, ibuf_length(t1)); } - log_debug("%s: Tn with %d bytes", __func__, ibuf_length(t)); + log_debug("%s: Tn with %zu bytes", __func__, ibuf_length(t)); print_hex(t->buf, 0, ibuf_length(t)); ibuf_release(t1); @@ -3661,7 +3661,7 @@ ikev2_sa_tag(struct iked_sa *sa, struct iked_id *id) } } - log_debug("%s: %s (%d)", __func__, sa->sa_tag, strlen(sa->sa_tag)); + log_debug("%s: %s (%zu)", __func__, sa->sa_tag, strlen(sa->sa_tag)); ret = 0; fail: @@ -3730,7 +3730,7 @@ ikev2_childsa_negotiate(struct iked *env, struct iked_sa *sa, int initiator) /* double key material length for inbound/outbound */ ilen *= 2; - log_debug("%s: key material length %d", __func__, ilen); + log_debug("%s: key material length %zu", __func__, ilen); if ((seed = ibuf_dup(sa->sa_inonce)) == NULL || ibuf_cat(seed, sa->sa_rnonce) != 0 || diff --git a/sbin/iked/ikev2_msg.c b/sbin/iked/ikev2_msg.c index cd606802e7a..ade5b51be72 100644 --- a/sbin/iked/ikev2_msg.c +++ b/sbin/iked/ikev2_msg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikev2_msg.c,v 1.28 2014/01/24 05:58:52 mikeb Exp $ */ +/* $OpenBSD: ikev2_msg.c,v 1.29 2014/02/17 11:00:14 reyk Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -334,7 +334,7 @@ ikev2_msg_encrypt(struct iked *env, struct iked_sa *sa, struct ibuf *src) buf = ibuf_data(src); len = ibuf_size(src); - log_debug("%s: decrypted length %d", __func__, len); + log_debug("%s: decrypted length %zu", __func__, len); print_hex(buf, 0, len); if (sa == NULL || @@ -366,7 +366,7 @@ ikev2_msg_encrypt(struct iked *env, struct iked_sa *sa, struct ibuf *src) if (ibuf_add(src, &pad, sizeof(pad)) != 0) goto done; - log_debug("%s: padded length %d", __func__, ibuf_size(src)); + log_debug("%s: padded length %zu", __func__, ibuf_size(src)); print_hex(ibuf_data(src), 0, ibuf_size(src)); cipher_setkey(sa->sa_encr, encr->buf, ibuf_length(encr)); @@ -391,7 +391,7 @@ ikev2_msg_encrypt(struct iked *env, struct iked_sa *sa, struct ibuf *src) goto done; bzero(ptr, integrlen); - log_debug("%s: length %d, padding %d, output length %d", + log_debug("%s: length %zu, padding %d, output length %zu", __func__, len + sizeof(pad), pad, ibuf_size(dst)); print_hex(ibuf_data(dst), 0, ibuf_size(dst)); @@ -413,7 +413,7 @@ ikev2_msg_integr(struct iked *env, struct iked_sa *sa, struct ibuf *src) struct ibuf *integr, *tmp = NULL; u_int8_t *ptr; - log_debug("%s: message length %d", __func__, ibuf_size(src)); + log_debug("%s: message length %zu", __func__, ibuf_size(src)); print_hex(ibuf_data(src), 0, ibuf_size(src)); if (sa == NULL || @@ -429,7 +429,7 @@ ikev2_msg_integr(struct iked *env, struct iked_sa *sa, struct ibuf *src) integrlen = hash_length(sa->sa_integr); - log_debug("%s: integrity checksum length %d", __func__, + log_debug("%s: integrity checksum length %zu", __func__, integrlen); /* @@ -502,11 +502,11 @@ ikev2_msg_decrypt(struct iked *env, struct iked_sa *sa, goto done; } - log_debug("%s: IV length %d", __func__, ivlen); + log_debug("%s: IV length %zd", __func__, ivlen); print_hex(ibuf_data(src), 0, ivlen); - log_debug("%s: encrypted payload length %d", __func__, encrlen); + log_debug("%s: encrypted payload length %zd", __func__, encrlen); print_hex(ibuf_data(src), encroff, encrlen); - log_debug("%s: integrity checksum length %d", __func__, integrlen); + log_debug("%s: integrity checksum length %zd", __func__, integrlen); print_hex(ibuf_data(src), integroff, integrlen); /* @@ -556,7 +556,7 @@ ikev2_msg_decrypt(struct iked *env, struct iked_sa *sa, pad = *ptr; } - log_debug("%s: decrypted payload length %d/%d padding %d", + log_debug("%s: decrypted payload length %zd/%zd padding %d", __func__, outlen, encrlen, pad); print_hex(ibuf_data(out), 0, ibuf_size(out)); @@ -681,7 +681,7 @@ ikev2_msg_auth(struct iked *env, struct iked_sa *sa, int response) if (tmplen != hash_length(sa->sa_prf)) goto fail; - log_debug("%s: %s auth data length %d", + log_debug("%s: %s auth data length %zu", __func__, response ? "responder" : "initiator", ibuf_size(authmsg)); print_hex(ibuf_data(authmsg), 0, ibuf_size(authmsg)); @@ -739,7 +739,7 @@ ikev2_msg_authverify(struct iked *env, struct iked_sa *sa, break; } - log_debug("%s: method %s keylen %d type %s", __func__, + log_debug("%s: method %s keylen %zd type %s", __func__, print_map(auth->auth_method, ikev2_auth_map), keylen, print_map(id->id_type, ikev2_cert_map)); diff --git a/sbin/iked/ikev2_pld.c b/sbin/iked/ikev2_pld.c index df5ca6a5fc2..4ec1c5ae6be 100644 --- a/sbin/iked/ikev2_pld.c +++ b/sbin/iked/ikev2_pld.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikev2_pld.c,v 1.37 2014/02/14 09:00:03 markus Exp $ */ +/* $OpenBSD: ikev2_pld.c,v 1.38 2014/02/17 11:00:14 reyk Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -453,7 +453,7 @@ ikev2_pld_id(struct iked *env, struct ikev2_payload *pld, return (-1); } - log_debug("%s: id %s length %d", __func__, idstr, len); + log_debug("%s: id %s length %zu", __func__, idstr, len); if (!ikev2_msg_frompeer(msg)) { ibuf_release(idb.id_buf); @@ -495,7 +495,7 @@ ikev2_pld_cert(struct iked *env, struct ikev2_payload *pld, buf = msgbuf + offset; len = betoh16(pld->pld_length) - sizeof(*pld) - sizeof(cert); - log_debug("%s: type %s length %d", + log_debug("%s: type %s length %zu", __func__, print_map(cert.cert_type, ikev2_cert_map), len); print_hex(buf, 0, len); @@ -535,7 +535,7 @@ ikev2_pld_certreq(struct iked *env, struct ikev2_payload *pld, buf = msgbuf + offset; len = betoh16(pld->pld_length) - sizeof(*pld) - sizeof(cert); - log_debug("%s: type %s length %d", + log_debug("%s: type %s length %zd", __func__, print_map(cert.cert_type, ikev2_cert_map), len); if (len < 0) { @@ -587,7 +587,7 @@ ikev2_pld_auth(struct iked *env, struct ikev2_payload *pld, buf = msgbuf + offset; len = betoh16(pld->pld_length) - sizeof(*pld) - sizeof(auth); - log_debug("%s: method %s length %d", + log_debug("%s: method %s length %zu", __func__, print_map(auth.auth_method, ikev2_auth_map), len); print_hex(buf, 0, len); @@ -763,7 +763,7 @@ ikev2_pld_notify(struct iked *env, struct ikev2_payload *pld, } memcpy(&cpi, buf, sizeof(cpi)); memcpy(&transform, buf + sizeof(cpi), sizeof(transform)); - log_debug("%s: cpi 0x%x, transform %s, len %d", __func__, + log_debug("%s: cpi 0x%x, transform %s, len %zu", __func__, betoh16(cpi), print_map(transform, ikev2_ipcomp_map), len); /* we only support deflate */ if ((msg->msg_policy->pol_flags & IKED_POLICY_IPCOMP) && @@ -924,7 +924,7 @@ ikev2_pld_delete(struct iked *env, struct ikev2_payload *pld, } } - log_warnx("%s: deleted %d spis", __func__, found); + log_warnx("%s: deleted %zu spis", __func__, found); } if (found) { @@ -962,7 +962,7 @@ ikev2_pld_ts(struct iked *env, struct ikev2_payload *pld, len = betoh16(pld->pld_length) - sizeof(*pld) - sizeof(tsp); - log_debug("%s: count %d length %d", __func__, + log_debug("%s: count %d length %zu", __func__, tsp.tsp_count, len); for (i = 0; i < tsp.tsp_count; i++) { @@ -1081,7 +1081,7 @@ ikev2_pld_cp(struct iked *env, struct ikev2_payload *pld, buf = msgbuf + offset; len = betoh16(pld->pld_length) - sizeof(*pld) - sizeof(cp); - log_debug("%s: type %s length %d", + log_debug("%s: type %s length %zu", __func__, print_map(cp.cp_type, ikev2_cp_map), len); print_hex(buf, 0, len); |