-/* $OpenBSD: crypto.c,v 1.36 2021/11/18 22:59:03 tb Exp $ */
+/* $OpenBSD: crypto.c,v 1.37 2021/11/29 06:43:42 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h> /* roundup */
+#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/uio.h>
-/* $OpenBSD: dh.c,v 1.29 2021/05/28 18:01:39 tobhe Exp $ */
+/* $OpenBSD: dh.c,v 1.30 2021/11/29 06:43:42 deraadt Exp $ */
/*
* Copyright (c) 2010-2014 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h> /* roundup */
-#include <string.h>
+#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/uio.h>
+#include <string.h>
#include <event.h>
#include <imsg.h>
/* "Private use" extensions */
/* PQC KEM */
{ GROUP_SNTRUP761X25519, 1035,
- (MAX(crypto_kem_sntrup761_PUBLICKEYBYTES,
+ (MAXIMUM(crypto_kem_sntrup761_PUBLICKEYBYTES,
crypto_kem_sntrup761_CIPHERTEXTBYTES) +
CURVE25519_SIZE) * 8 }
};
-/* $OpenBSD: iked.h,v 1.199 2021/11/27 21:50:05 tobhe Exp $ */
+/* $OpenBSD: iked.h,v 1.200 2021/11/29 06:43:42 deraadt Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
#include "types.h"
#include "dh.h"
+#define MAXIMUM(a,b) (((a)>(b))?(a):(b))
+#define MINIMUM(a,b) (((a)<(b))?(a):(b))
+#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
+
#ifndef IKED_H
#define IKED_H
-/* $OpenBSD: ikev2.c,v 1.337 2021/11/27 21:50:05 tobhe Exp $ */
+/* $OpenBSD: ikev2.c,v 1.338 2021/11/29 06:43:42 deraadt Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h> /* roundup */
+#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/uio.h>
alen = ibuf_length(a);
blen = ibuf_length(b);
- len = MIN(alen, blen);
+ len = MINIMUM(alen, blen);
ret = memcmp(ibuf_data(a), ibuf_data(b), len);
if (ret == 0)
ret = (alen < blen ? -1 : 1);
-/* $OpenBSD: ikev2_msg.c,v 1.82 2021/11/27 21:50:05 tobhe Exp $ */
+/* $OpenBSD: ikev2_msg.c,v 1.83 2021/11/29 06:43:42 deraadt Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h> /* roundup */
+#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/uio.h>
/* Encrypt message and add as an E payload */
data = ibuf_seek(in, offset, 0);
- if ((e = ibuf_new(data, MIN(left, max_len))) == NULL) {
+ if ((e = ibuf_new(data, MINIMUM(left, max_len))) == NULL) {
goto done;
}
if (ikev2_msg_send(env, &resp) == -1)
goto done;
- offset += MIN(left, max_len);
- left -= MIN(left, max_len);
+ offset += MINIMUM(left, max_len);
+ left -= MINIMUM(left, max_len);
frag_num++;
/* MUST be zero after first fragment */