-/* $OpenBSD: ikev2.c,v 1.308 2021/02/18 21:30:52 tobhe Exp $ */
+/* $OpenBSD: ikev2.c,v 1.309 2021/02/18 22:00:31 tobhe Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
return (-1);
}
ibuf_release(sa->sa_rnonce);
- sa->sa_rnonce = ibuf_dup(msg->msg_nonce);
+ sa->sa_rnonce = msg->msg_nonce;
+ msg->msg_nonce = NULL;
if (csa && (ni = sa->sa_simult) != NULL) {
log_info("%s: resolving simultaneous CHILD SA rekeying",
goto fail;
}
ibuf_release(kex->kex_inonce);
- kex->kex_inonce = ibuf_dup(msg->msg_nonce);
+ kex->kex_inonce = msg->msg_nonce;
+ msg->msg_nonce = NULL;
/* Generate new responder's nonce */
if ((nonce = ibuf_random(IKED_NONCE_SIZE)) == NULL)
SPI_SA(sa, __func__));
return (-1);
}
- if ((sa->sa_rnonce = ibuf_dup(msg->msg_nonce)) == NULL) {
- log_info("%s: failed to get peer nonce",
- SPI_SA(sa, __func__));
- return (-1);
- }
+ sa->sa_rnonce = msg->msg_nonce;
+ msg->msg_nonce = NULL;
}
if (ikev2_sa_negotiate_common(env, sa, msg) != 0)
}
if (!ibuf_length(sa->sa_inonce) &&
- ((ibuf_length(msg->msg_nonce) < IKED_NONCE_MIN) ||
- (sa->sa_inonce = ibuf_dup(msg->msg_nonce)) == NULL)) {
+ (ibuf_length(msg->msg_nonce) < IKED_NONCE_MIN)) {
log_debug("%s: failed to get peer nonce", __func__);
return (-1);
}
+ sa->sa_inonce = msg->msg_nonce;
+ msg->msg_nonce = NULL;
if (ikev2_sa_negotiate_common(env, sa, msg) != 0)
return (-1);