-/* $OpenBSD: ikev2.c,v 1.375 2023/07/28 07:31:38 claudio Exp $ */
+/* $OpenBSD: ikev2.c,v 1.376 2023/07/28 11:23:03 claudio Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
log_debug("%s: added cookie, len %zu", __func__,
ibuf_size(cookie));
- print_hex(ibuf_data(cookie), 0, ibuf_size(cookie));
+ print_hexbuf(cookie);
if (ikev2_next_payload(pld, len, IKEV2_PAYLOAD_SA) == -1)
goto done;
log_debug("%s: DHSECRET with %zu bytes", SPI_SA(sa, __func__),
ibuf_length(dhsecret));
- print_hex(ibuf_data(dhsecret), 0, ibuf_length(dhsecret));
+ print_hexbuf(dhsecret);
if (!key) {
/*
}
log_debug("%s: S with %zu bytes", SPI_SA(sa, __func__), ibuf_length(s));
- print_hex(ibuf_data(s), 0, ibuf_length(s));
+ print_hexbuf(s);
/*
* Get the size of the key material we need and the number
log_debug("%s: SK_d with %zu bytes", __func__,
ibuf_length(sa->sa_key_d));
- print_hex(ibuf_data(sa->sa_key_d), 0, ibuf_length(sa->sa_key_d));
+ print_hexbuf(sa->sa_key_d);
if (!isaead) {
log_debug("%s: SK_ai with %zu bytes", __func__,
ibuf_length(sa->sa_key_iauth));
- print_hex(ibuf_data(sa->sa_key_iauth), 0,
- ibuf_length(sa->sa_key_iauth));
+ print_hexbuf(sa->sa_key_iauth);
log_debug("%s: SK_ar with %zu bytes", __func__,
ibuf_length(sa->sa_key_rauth));
- print_hex(ibuf_data(sa->sa_key_rauth), 0,
- ibuf_length(sa->sa_key_rauth));
+ print_hexbuf(sa->sa_key_rauth);
}
log_debug("%s: SK_ei with %zu bytes", __func__,
ibuf_length(sa->sa_key_iencr));
- print_hex(ibuf_data(sa->sa_key_iencr), 0,
- ibuf_length(sa->sa_key_iencr));
+ print_hexbuf(sa->sa_key_iencr);
log_debug("%s: SK_er with %zu bytes", __func__,
ibuf_length(sa->sa_key_rencr));
- print_hex(ibuf_data(sa->sa_key_rencr), 0,
- ibuf_length(sa->sa_key_rencr));
+ print_hexbuf(sa->sa_key_rencr);
log_debug("%s: SK_pi with %zu bytes", __func__,
ibuf_length(sa->sa_key_iprf));
- print_hex(ibuf_data(sa->sa_key_iprf), 0, ibuf_length(sa->sa_key_iprf));
+ print_hexbuf(sa->sa_key_iprf);
log_debug("%s: SK_pr with %zu bytes", __func__,
ibuf_length(sa->sa_key_rprf));
- print_hex(ibuf_data(sa->sa_key_rprf), 0, ibuf_length(sa->sa_key_rprf));
+ print_hexbuf(sa->sa_key_rprf);
ret = 0;
log_debug("%s: T%d with %zu bytes", __func__,
pad, ibuf_length(t1));
- print_hex(ibuf_data(t1), 0, ibuf_length(t1));
+ print_hexbuf(t1);
}
log_debug("%s: Tn with %zu bytes", __func__, ibuf_length(t));
- print_hex(ibuf_data(t), 0, ibuf_length(t));
+ print_hexbuf(t);
ibuf_free(t1);
-/* $OpenBSD: ikev2_msg.c,v 1.98 2023/07/28 07:31:38 claudio Exp $ */
+/* $OpenBSD: ikev2_msg.c,v 1.99 2023/07/28 11:23:03 claudio Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
goto done;
log_debug("%s: padded length %zu", __func__, ibuf_size(src));
- print_hex(ibuf_data(src), 0, ibuf_size(src));
+ print_hexbuf(src);
cipher_setkey(sa->sa_encr, ibuf_data(encr), ibuf_length(encr));
cipher_setiv(sa->sa_encr, NULL, 0); /* XXX ivlen */
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));
+ print_hexbuf(dst);
ibuf_free(src);
ibuf_free(out);
uint8_t *ptr;
log_debug("%s: message length %zu", __func__, ibuf_size(src));
- print_hex(ibuf_data(src), 0, ibuf_size(src));
+ print_hexbuf(src);
if (sa == NULL ||
sa->sa_encr == NULL ||
goto done;
memcpy(ptr, ibuf_data(tmp), integrlen);
- print_hex(ibuf_data(tmp), 0, ibuf_size(tmp));
+ print_hexbuf(tmp);
ret = 0;
done:
sa->sa_encr == NULL ||
sa->sa_integr == NULL) {
log_debug("%s: invalid SA", __func__);
- print_hex(ibuf_data(src), 0, ibuf_size(src));
+ print_hexbuf(src);
goto done;
}
log_debug("%s: decrypted payload length %zd/%zd padding %d",
__func__, outlen, encrlen, pad);
- print_hex(ibuf_data(out), 0, ibuf_size(out));
+ print_hexbuf(out);
/* Strip padding and padding length */
if (ibuf_setsize(out, outlen - pad - 1) != 0)
log_debug("%s: Fragment %zu of %zu has size of %zu bytes.",
__func__, frag_num, frag_total,
ibuf_size(buf) - sizeof(*hdr));
- print_hex(ibuf_data(buf), 0, ibuf_size(buf));
+ print_hexbuf(buf);
resp.msg_data = buf;
resp.msg_sa = sa;
log_debug("%s: %s auth data length %zu",
__func__, response ? "responder" : "initiator",
ibuf_size(authmsg));
- print_hex(ibuf_data(authmsg), 0, ibuf_size(authmsg));
+ print_hexbuf(authmsg);
return (authmsg);