summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2017-02-03 02:56:00 +0000
committerDarren Tucker <dtucker@zip.com.au>2017-02-03 14:34:25 +1100
commitc998bf0afa1a01257a53793eba57941182e9e0b7 (patch)
treeac760850c4433e2bcde4a91acc9a1d22796c6a11 /packet.c
parent3ec5fa4ba97d4c4853620daea26a33b9f1fe3422 (diff)
upstream commit
Make ssh_packet_set_rekey_limits take u32 for the number of seconds until rekeying (negative values are rejected at config parse time). This allows the removal of some casts and a signed vs unsigned comparison warning. rekey_time is cast to int64 for the comparison which is a no-op on OpenBSD, but should also do the right thing in -portable on anything still using 32bit time_t (until the system time actually wraps, anyway). some early guidance deraadt@, ok djm@ Upstream-ID: c9f18613afb994a07e7622eb326f49de3d123b6c
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/packet.c b/packet.c
index ad1f6b497..6b9d3525b 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.243 2016/10/11 21:47:45 djm Exp $ */ 1/* $OpenBSD: packet.c,v 1.244 2017/02/03 02:56:00 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
@@ -1049,7 +1049,7 @@ ssh_packet_need_rekeying(struct ssh *ssh, u_int outbound_packet_len)
1049 1049
1050 /* Time-based rekeying */ 1050 /* Time-based rekeying */
1051 if (state->rekey_interval != 0 && 1051 if (state->rekey_interval != 0 &&
1052 state->rekey_time + state->rekey_interval <= monotime()) 1052 (int64_t)state->rekey_time + state->rekey_interval <= monotime())
1053 return 1; 1053 return 1;
1054 1054
1055 /* Always rekey when MAX_PACKETS sent in either direction */ 1055 /* Always rekey when MAX_PACKETS sent in either direction */
@@ -2396,10 +2396,10 @@ ssh_packet_send_ignore(struct ssh *ssh, int nbytes)
2396} 2396}
2397 2397
2398void 2398void
2399ssh_packet_set_rekey_limits(struct ssh *ssh, u_int64_t bytes, time_t seconds) 2399ssh_packet_set_rekey_limits(struct ssh *ssh, u_int64_t bytes, u_int32_t seconds)
2400{ 2400{
2401 debug3("rekey after %llu bytes, %d seconds", (unsigned long long)bytes, 2401 debug3("rekey after %llu bytes, %u seconds", (unsigned long long)bytes,
2402 (int)seconds); 2402 (unsigned int)seconds);
2403 ssh->state->rekey_limit = bytes; 2403 ssh->state->rekey_limit = bytes;
2404 ssh->state->rekey_interval = seconds; 2404 ssh->state->rekey_interval = seconds;
2405} 2405}