|
Lines 176-182
struct session_state {
Link Here
|
| 176 |
|
176 |
|
| 177 |
/* Volume-based rekeying */ |
177 |
/* Volume-based rekeying */ |
| 178 |
u_int64_t max_blocks_in, max_blocks_out; |
178 |
u_int64_t max_blocks_in, max_blocks_out; |
| 179 |
u_int32_t rekey_limit; |
179 |
u_int64_t rekey_limit; |
| 180 |
|
180 |
|
| 181 |
/* Time-based rekeying */ |
181 |
/* Time-based rekeying */ |
| 182 |
u_int32_t rekey_interval; /* how often in seconds */ |
182 |
u_int32_t rekey_interval; /* how often in seconds */ |
|
Lines 943-949
ssh_set_newkeys(struct ssh *ssh, int mod
Link Here
|
| 943 |
max_blocks = &state->max_blocks_in; |
943 |
max_blocks = &state->max_blocks_in; |
| 944 |
} |
944 |
} |
| 945 |
if (state->newkeys[mode] != NULL) { |
945 |
if (state->newkeys[mode] != NULL) { |
| 946 |
debug("set_newkeys: rekeying"); |
946 |
debug("set_newkeys: rekeying, input %llu bytes %llu blocks, " |
|
|
947 |
"output %llu bytes %llu blocks", |
| 948 |
state->p_read.bytes, state->p_read.blocks, |
| 949 |
state->p_send.bytes, state->p_send.blocks); |
| 947 |
if ((r = cipher_cleanup(cc)) != 0) |
950 |
if ((r = cipher_cleanup(cc)) != 0) |
| 948 |
return r; |
951 |
return r; |
| 949 |
enc = &state->newkeys[mode]->enc; |
952 |
enc = &state->newkeys[mode]->enc; |
|
Lines 1011-1016
ssh_set_newkeys(struct ssh *ssh, int mod
Link Here
|
| 1011 |
if (state->rekey_limit) |
1014 |
if (state->rekey_limit) |
| 1012 |
*max_blocks = MIN(*max_blocks, |
1015 |
*max_blocks = MIN(*max_blocks, |
| 1013 |
state->rekey_limit / enc->block_size); |
1016 |
state->rekey_limit / enc->block_size); |
|
|
1017 |
debug("rekey after %llu blocks", *max_blocks); |
| 1014 |
return 0; |
1018 |
return 0; |
| 1015 |
} |
1019 |
} |
| 1016 |
|
1020 |
|
|
Lines 2252-2260
ssh_packet_need_rekeying(struct ssh *ssh
Link Here
|
| 2252 |
} |
2256 |
} |
| 2253 |
|
2257 |
|
| 2254 |
void |
2258 |
void |
| 2255 |
ssh_packet_set_rekey_limits(struct ssh *ssh, u_int32_t bytes, time_t seconds) |
2259 |
ssh_packet_set_rekey_limits(struct ssh *ssh, u_int64_t bytes, time_t seconds) |
| 2256 |
{ |
2260 |
{ |
| 2257 |
debug3("rekey after %lld bytes, %d seconds", (long long)bytes, |
2261 |
debug3("rekey after %llu bytes, %d seconds", (unsigned long long)bytes, |
| 2258 |
(int)seconds); |
2262 |
(int)seconds); |
| 2259 |
ssh->state->rekey_limit = bytes; |
2263 |
ssh->state->rekey_limit = bytes; |
| 2260 |
ssh->state->rekey_interval = seconds; |
2264 |
ssh->state->rekey_interval = seconds; |
|
Lines 2464-2470
ssh_packet_get_state(struct ssh *ssh, st
Link Here
|
| 2464 |
if ((r = kex_to_blob(m, ssh->kex)) != 0 || |
2468 |
if ((r = kex_to_blob(m, ssh->kex)) != 0 || |
| 2465 |
(r = newkeys_to_blob(m, ssh, MODE_OUT)) != 0 || |
2469 |
(r = newkeys_to_blob(m, ssh, MODE_OUT)) != 0 || |
| 2466 |
(r = newkeys_to_blob(m, ssh, MODE_IN)) != 0 || |
2470 |
(r = newkeys_to_blob(m, ssh, MODE_IN)) != 0 || |
| 2467 |
(r = sshbuf_put_u32(m, state->rekey_limit)) != 0 || |
2471 |
(r = sshbuf_put_u64(m, state->rekey_limit)) != 0 || |
| 2468 |
(r = sshbuf_put_u32(m, state->rekey_interval)) != 0 || |
2472 |
(r = sshbuf_put_u32(m, state->rekey_interval)) != 0 || |
| 2469 |
(r = sshbuf_put_u32(m, state->p_send.seqnr)) != 0 || |
2473 |
(r = sshbuf_put_u32(m, state->p_send.seqnr)) != 0 || |
| 2470 |
(r = sshbuf_put_u64(m, state->p_send.blocks)) != 0 || |
2474 |
(r = sshbuf_put_u64(m, state->p_send.blocks)) != 0 || |
|
Lines 2649-2655
ssh_packet_set_state(struct ssh *ssh, st
Link Here
|
| 2649 |
if ((r = kex_from_blob(m, &ssh->kex)) != 0 || |
2653 |
if ((r = kex_from_blob(m, &ssh->kex)) != 0 || |
| 2650 |
(r = newkeys_from_blob(m, ssh, MODE_OUT)) != 0 || |
2654 |
(r = newkeys_from_blob(m, ssh, MODE_OUT)) != 0 || |
| 2651 |
(r = newkeys_from_blob(m, ssh, MODE_IN)) != 0 || |
2655 |
(r = newkeys_from_blob(m, ssh, MODE_IN)) != 0 || |
| 2652 |
(r = sshbuf_get_u32(m, &state->rekey_limit)) != 0 || |
2656 |
(r = sshbuf_get_u64(m, &state->rekey_limit)) != 0 || |
| 2653 |
(r = sshbuf_get_u32(m, &state->rekey_interval)) != 0 || |
2657 |
(r = sshbuf_get_u32(m, &state->rekey_interval)) != 0 || |
| 2654 |
(r = sshbuf_get_u32(m, &state->p_send.seqnr)) != 0 || |
2658 |
(r = sshbuf_get_u32(m, &state->p_send.seqnr)) != 0 || |
| 2655 |
(r = sshbuf_get_u64(m, &state->p_send.blocks)) != 0 || |
2659 |
(r = sshbuf_get_u64(m, &state->p_send.blocks)) != 0 || |