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
This commit is contained in:
parent
3ec5fa4ba9
commit
c998bf0afa
10
packet.c
10
packet.c
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: packet.c,v 1.243 2016/10/11 21:47:45 djm Exp $ */
|
/* $OpenBSD: packet.c,v 1.244 2017/02/03 02:56:00 dtucker Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* 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)
|
||||||
|
|
||||||
/* Time-based rekeying */
|
/* Time-based rekeying */
|
||||||
if (state->rekey_interval != 0 &&
|
if (state->rekey_interval != 0 &&
|
||||||
state->rekey_time + state->rekey_interval <= monotime())
|
(int64_t)state->rekey_time + state->rekey_interval <= monotime())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Always rekey when MAX_PACKETS sent in either direction */
|
/* Always rekey when MAX_PACKETS sent in either direction */
|
||||||
|
@ -2396,10 +2396,10 @@ ssh_packet_send_ignore(struct ssh *ssh, int nbytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ssh_packet_set_rekey_limits(struct ssh *ssh, u_int64_t bytes, time_t seconds)
|
ssh_packet_set_rekey_limits(struct ssh *ssh, u_int64_t bytes, u_int32_t seconds)
|
||||||
{
|
{
|
||||||
debug3("rekey after %llu bytes, %d seconds", (unsigned long long)bytes,
|
debug3("rekey after %llu bytes, %u seconds", (unsigned long long)bytes,
|
||||||
(int)seconds);
|
(unsigned int)seconds);
|
||||||
ssh->state->rekey_limit = bytes;
|
ssh->state->rekey_limit = bytes;
|
||||||
ssh->state->rekey_interval = seconds;
|
ssh->state->rekey_interval = seconds;
|
||||||
}
|
}
|
||||||
|
|
4
packet.h
4
packet.h
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: packet.h,v 1.74 2016/10/11 21:47:45 djm Exp $ */
|
/* $OpenBSD: packet.h,v 1.75 2017/02/03 02:56:00 dtucker Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
|
@ -154,7 +154,7 @@ int ssh_remote_port(struct ssh *);
|
||||||
const char *ssh_local_ipaddr(struct ssh *);
|
const char *ssh_local_ipaddr(struct ssh *);
|
||||||
int ssh_local_port(struct ssh *);
|
int ssh_local_port(struct ssh *);
|
||||||
|
|
||||||
void ssh_packet_set_rekey_limits(struct ssh *, u_int64_t, time_t);
|
void ssh_packet_set_rekey_limits(struct ssh *, u_int64_t, u_int32_t);
|
||||||
time_t ssh_packet_get_rekey_timeout(struct ssh *);
|
time_t ssh_packet_get_rekey_timeout(struct ssh *);
|
||||||
|
|
||||||
void *ssh_packet_get_input(struct ssh *);
|
void *ssh_packet_get_input(struct ssh *);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: sshconnect2.c,v 1.253 2017/01/30 00:32:28 djm Exp $ */
|
/* $OpenBSD: sshconnect2.c,v 1.254 2017/02/03 02:56:00 dtucker Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000 Markus Friedl. All rights reserved.
|
* Copyright (c) 2000 Markus Friedl. All rights reserved.
|
||||||
* Copyright (c) 2008 Damien Miller. All rights reserved.
|
* Copyright (c) 2008 Damien Miller. All rights reserved.
|
||||||
|
@ -193,8 +193,8 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.rekey_limit || options.rekey_interval)
|
if (options.rekey_limit || options.rekey_interval)
|
||||||
packet_set_rekey_limits((u_int32_t)options.rekey_limit,
|
packet_set_rekey_limits(options.rekey_limit,
|
||||||
(time_t)options.rekey_interval);
|
options.rekey_interval);
|
||||||
|
|
||||||
/* start key exchange */
|
/* start key exchange */
|
||||||
if ((r = kex_setup(active_state, myproposal)) != 0)
|
if ((r = kex_setup(active_state, myproposal)) != 0)
|
||||||
|
|
4
sshd.c
4
sshd.c
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: sshd.c,v 1.480 2016/12/09 03:04:29 djm Exp $ */
|
/* $OpenBSD: sshd.c,v 1.481 2017/02/03 02:56:00 dtucker Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
|
@ -2154,7 +2154,7 @@ do_ssh2_kex(void)
|
||||||
|
|
||||||
if (options.rekey_limit || options.rekey_interval)
|
if (options.rekey_limit || options.rekey_interval)
|
||||||
packet_set_rekey_limits(options.rekey_limit,
|
packet_set_rekey_limits(options.rekey_limit,
|
||||||
(time_t)options.rekey_interval);
|
options.rekey_interval);
|
||||||
|
|
||||||
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = compat_pkalg_proposal(
|
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = compat_pkalg_proposal(
|
||||||
list_hostkey_types());
|
list_hostkey_types());
|
||||||
|
|
Loading…
Reference in New Issue