-/* $OpenBSD: eap.c,v 1.24 2023/05/23 13:57:14 claudio Exp $ */
+/* $OpenBSD: eap.c,v 1.25 2023/07/18 15:07:41 claudio Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
if ((pld = ikev2_add_payload(e)) == NULL)
goto done;
firstpayload = IKEV2_PAYLOAD_IDr;
- if (ibuf_cat(e, id->id_buf) != 0)
+ if (ibuf_add_buf(e, id->id_buf) != 0)
goto done;
len = ibuf_size(id->id_buf);
if ((cert = ibuf_reserve(e, sizeof(*cert))) == NULL)
goto done;
cert->cert_type = certid->id_type;
- if (ibuf_cat(e, certid->id_buf) != 0)
+ if (ibuf_add_buf(e, certid->id_buf) != 0)
goto done;
len = ibuf_size(certid->id_buf) + sizeof(*cert);
if ((cert = ibuf_reserve(e, sizeof(*cert))) == NULL)
goto done;
cert->cert_type = sa->sa_scert[i].id_type;
- if (ibuf_cat(e, sa->sa_scert[i].id_buf) != 0)
+ if (ibuf_add_buf(e, sa->sa_scert[i].id_buf) != 0)
goto done;
len = ibuf_size(sa->sa_scert[i].id_buf) + sizeof(*cert);
}
if ((auth = ibuf_reserve(e, sizeof(*auth))) == NULL)
goto done;
auth->auth_method = sa->sa_localauth.id_type;
- if (ibuf_cat(e, sa->sa_localauth.id_buf) != 0)
+ if (ibuf_add_buf(e, sa->sa_localauth.id_buf) != 0)
goto done;
len = ibuf_size(sa->sa_localauth.id_buf) + sizeof(*auth);
-/* $OpenBSD: ikev2.c,v 1.373 2023/07/16 15:21:46 claudio Exp $ */
+/* $OpenBSD: ikev2.c,v 1.374 2023/07/18 15:07:41 claudio Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
if ((pld = ikev2_add_payload(e)) == NULL)
goto done;
firstpayload = IKEV2_PAYLOAD_IDi;
- if (ibuf_cat(e, id->id_buf) != 0)
+ if (ibuf_add_buf(e, id->id_buf) != 0)
goto done;
len = ibuf_size(id->id_buf);
goto done;
if ((pld = ikev2_add_payload(e)) == NULL)
goto done;
- if (ibuf_cat(e, peerid.id_buf) != 0)
+ if (ibuf_add_buf(e, peerid.id_buf) != 0)
goto done;
len = ibuf_size(peerid.id_buf);
}
if ((cert = ibuf_reserve(e, sizeof(*cert))) == NULL)
goto done;
cert->cert_type = certid->id_type;
- if (ibuf_cat(e, certid->id_buf) != 0)
+ if (ibuf_add_buf(e, certid->id_buf) != 0)
goto done;
len = ibuf_size(certid->id_buf) + sizeof(*cert);
if ((cert = ibuf_reserve(e, sizeof(*cert))) == NULL)
goto done;
cert->cert_type = sa->sa_scert[i].id_type;
- if (ibuf_cat(e, sa->sa_scert[i].id_buf) != 0)
+ if (ibuf_add_buf(e, sa->sa_scert[i].id_buf) != 0)
goto done;
len = ibuf_size(sa->sa_scert[i].id_buf) + sizeof(*cert);
}
if ((auth = ibuf_reserve(e, sizeof(*auth))) == NULL)
goto done;
auth->auth_method = sa->sa_localauth.id_type;
- if (ibuf_cat(e, sa->sa_localauth.id_buf) != 0)
+ if (ibuf_add_buf(e, sa->sa_localauth.id_buf) != 0)
goto done;
len = ibuf_size(sa->sa_localauth.id_buf) + sizeof(*auth);
return (-1);
if ((*pld = ikev2_add_payload(e)) == NULL)
return (-1);
- if (ibuf_cat(e, id) == -1)
+ if (ibuf_add_buf(e, id) == -1)
return (-1);
return (ibuf_length(id));
if ((pld = ikev2_add_payload(e)) == NULL)
goto done;
firstpayload = IKEV2_PAYLOAD_IDr;
- if (ibuf_cat(e, id->id_buf) != 0)
+ if (ibuf_add_buf(e, id->id_buf) != 0)
goto done;
len = ibuf_size(id->id_buf);
if ((cert = ibuf_reserve(e, sizeof(*cert))) == NULL)
goto done;
cert->cert_type = certid->id_type;
- if (ibuf_cat(e, certid->id_buf) != 0)
+ if (ibuf_add_buf(e, certid->id_buf) != 0)
goto done;
len = ibuf_size(certid->id_buf) + sizeof(*cert);
sizeof(*cert))) == NULL)
goto done;
cert->cert_type = sa->sa_scert[i].id_type;
- if (ibuf_cat(e, sa->sa_scert[i].id_buf) != 0)
+ if (ibuf_add_buf(e, sa->sa_scert[i].id_buf) !=
+ 0)
goto done;
len = ibuf_size(sa->sa_scert[i].id_buf)
+ sizeof(*cert);
if ((auth = ibuf_reserve(e, sizeof(*auth))) == NULL)
goto done;
auth->auth_method = sa->sa_localauth.id_type;
- if (ibuf_cat(e, sa->sa_localauth.id_buf) != 0)
+ if (ibuf_add_buf(e, sa->sa_localauth.id_buf) != 0)
goto done;
len = ibuf_size(sa->sa_localauth.id_buf) + sizeof(*auth);
goto done;
if (buf) {
- if (ibuf_cat(e, buf) != 0)
+ if (ibuf_add_buf(e, buf) != 0)
goto done;
if (ikev2_next_payload(pld, ibuf_size(buf),
log_debug("%s: encryption failed", __func__);
goto done;
}
- if (ibuf_cat(buf, e) != 0)
+ if (ibuf_add_buf(buf, e) != 0)
goto done;
if (ikev2_next_payload(pld, ibuf_size(e),
IKEV2_PAYLOAD_NOTIFY) == -1)
IKEV2_PAYLOAD_NOTIFY, IKEV2_EXCHANGE_INFORMATIONAL,
0)) == NULL)
goto done;
- if (ibuf_cat(buf, e) != 0)
+ if (ibuf_add_buf(buf, e) != 0)
goto done;
if (ikev2_set_header(hdr, ibuf_size(buf) - sizeof(*hdr)) == -1)
goto done;
ibuf_length(kex->kex_dhpeer));
goto done;
}
- if (ibuf_cat(seed, dhsecret) != 0) {
+ if (ibuf_add_buf(seed, dhsecret) != 0) {
log_debug("%s: failed to set dh secret", __func__);
goto done;
}
}
- if (ibuf_cat(seed, kex->kex_inonce) != 0 ||
- ibuf_cat(seed, kex->kex_rnonce) != 0 ||
+ if (ibuf_add_buf(seed, kex->kex_inonce) != 0 ||
+ ibuf_add_buf(seed, kex->kex_rnonce) != 0 ||
(keymat = ikev2_prfplus(sa->sa_prf,
sa->sa_key_d, seed, ilen)) == NULL) {
log_debug("%s: failed to get IKE SA key material", __func__);
-/* $OpenBSD: ikev2_msg.c,v 1.96 2023/06/28 14:10:24 tobhe Exp $ */
+/* $OpenBSD: ikev2_msg.c,v 1.97 2023/07/18 15:07:41 claudio Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
log_debug("%s: failed to set NAT-T", __func__);
return (-1);
}
- if (ibuf_cat(new, buf) == -1) {
+ if (ibuf_add_buf(new, buf) == -1) {
ibuf_free(new);
log_debug("%s: failed to set NAT-T", __func__);
return (-1);
log_debug("%s: encryption failed", __func__);
goto done;
}
- if (ibuf_cat(buf, e) != 0)
+ if (ibuf_add_buf(buf, e) != 0)
goto done;
/* Add integrity checksum (HMAC) */
log_debug("%s: encryption failed", __func__);
goto done;
}
- if (ibuf_cat(buf, e) != 0)
+ if (ibuf_add_buf(buf, e) != 0)
goto done;
/* Add integrity checksum (HMAC) */
if ((authmsg = ibuf_dup(buf)) == NULL)
return (NULL);
- if (ibuf_cat(authmsg, nonce) != 0)
+ if (ibuf_add_buf(authmsg, nonce) != 0)
goto fail;
if ((hash_setkey(sa->sa_prf, ibuf_data(prfkey),