summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packet.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/packet.c b/packet.c
index 9cf200cc3..ffcd8eab9 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.222 2016/01/14 16:17:40 markus Exp $ */ 1/* $OpenBSD: packet.c,v 1.223 2016/01/29 02:42:46 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2251,16 +2251,21 @@ int
2251ssh_packet_need_rekeying(struct ssh *ssh) 2251ssh_packet_need_rekeying(struct ssh *ssh)
2252{ 2252{
2253 struct session_state *state = ssh->state; 2253 struct session_state *state = ssh->state;
2254 u_int32_t buf_in, buf_out;
2254 2255
2255 if (ssh->compat & SSH_BUG_NOREKEY) 2256 if (ssh->compat & SSH_BUG_NOREKEY)
2256 return 0; 2257 return 0;
2258 buf_in = roundup(sshbuf_len(state->input),
2259 state->newkeys[MODE_IN]->enc.block_size);
2260 buf_out = roundup(sshbuf_len(state->output),
2261 state->newkeys[MODE_OUT]->enc.block_size);
2257 return 2262 return
2258 (state->p_send.packets > MAX_PACKETS) || 2263 (state->p_send.packets > MAX_PACKETS) ||
2259 (state->p_read.packets > MAX_PACKETS) || 2264 (state->p_read.packets > MAX_PACKETS) ||
2260 (state->max_blocks_out && 2265 (state->max_blocks_out &&
2261 (state->p_send.blocks > state->max_blocks_out)) || 2266 (state->p_send.blocks + buf_out > state->max_blocks_out)) ||
2262 (state->max_blocks_in && 2267 (state->max_blocks_in &&
2263 (state->p_read.blocks > state->max_blocks_in)) || 2268 (state->p_read.blocks + buf_in > state->max_blocks_in)) ||
2264 (state->rekey_interval != 0 && state->rekey_time + 2269 (state->rekey_interval != 0 && state->rekey_time +
2265 state->rekey_interval <= monotime()); 2270 state->rekey_interval <= monotime());
2266} 2271}