summaryrefslogtreecommitdiffstats
path: root/packet.c
diff options
context:
space:
mode:
authorderaadt@openbsd.org <deraadt@openbsd.org>2016-09-12 01:22:38 +0000
committerDarren Tucker <dtucker@zip.com.au>2016-09-12 13:46:29 +1000
commit9136ec134c97a8aff2917760c03134f52945ff3c (patch)
treebfcab357e6e0f510d9b63bac43b18097e89fa58a /packet.c
parentf219fc8f03caca7ac82a38ed74bbd6432a1195e7 (diff)
upstream commit
Add MAXIMUM(), MINIMUM(), and ROUNDUP() to misc.h, then use those definitions rather than pulling <sys/param.h> and unknown namespace pollution. ok djm markus dtucker Upstream-ID: 712cafa816c9f012a61628b66b9fbd5687223fb8
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/packet.c b/packet.c
index 9ee23147..711091da 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.236 2016/09/06 09:22:56 markus Exp $ */
+/* $OpenBSD: packet.c,v 1.237 2016/09/12 01:22:38 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -38,8 +38,7 @@
*/
#include "includes.h"
-
-#include <sys/param.h> /* MIN roundup */
+
#include <sys/types.h>
#include "openbsd-compat/sys-queue.h"
#include <sys/socket.h>
@@ -1069,7 +1068,7 @@ ssh_set_newkeys(struct ssh *ssh, int mode)
else
*max_blocks = ((u_int64_t)1 << 30) / enc->block_size;
if (state->rekey_limit)
- *max_blocks = MIN(*max_blocks,
+ *max_blocks = MINIMUM(*max_blocks,
state->rekey_limit / enc->block_size);
debug("rekey after %llu blocks", (unsigned long long)*max_blocks);
return 0;
@@ -1112,7 +1111,7 @@ ssh_packet_need_rekeying(struct ssh *ssh, u_int outbound_packet_len)
return 1;
/* Rekey after (cipher-specific) maxiumum blocks */
- out_blocks = roundup(outbound_packet_len,
+ out_blocks = ROUNDUP(outbound_packet_len,
state->newkeys[MODE_OUT]->enc.block_size);
return (state->max_blocks_out &&
(state->p_send.blocks + out_blocks > state->max_blocks_out)) ||
@@ -1240,7 +1239,7 @@ ssh_packet_send2_wrapped(struct ssh *ssh)
if (state->extra_pad) {
tmp = state->extra_pad;
state->extra_pad =
- roundup(state->extra_pad, block_size);
+ ROUNDUP(state->extra_pad, block_size);
/* check if roundup overflowed */
if (state->extra_pad < tmp)
return SSH_ERR_INVALID_ARGUMENT;