version 1.236, 2016/09/06 09:22:56 |
version 1.237, 2016/09/12 01:22:38 |
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
*/ |
|
|
#include <sys/param.h> /* MIN roundup */ |
|
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/queue.h> |
#include <sys/queue.h> |
#include <sys/socket.h> |
#include <sys/socket.h> |
|
|
else |
else |
*max_blocks = ((u_int64_t)1 << 30) / enc->block_size; |
*max_blocks = ((u_int64_t)1 << 30) / enc->block_size; |
if (state->rekey_limit) |
if (state->rekey_limit) |
*max_blocks = MIN(*max_blocks, |
*max_blocks = MINIMUM(*max_blocks, |
state->rekey_limit / enc->block_size); |
state->rekey_limit / enc->block_size); |
debug("rekey after %llu blocks", (unsigned long long)*max_blocks); |
debug("rekey after %llu blocks", (unsigned long long)*max_blocks); |
return 0; |
return 0; |
|
|
return 1; |
return 1; |
|
|
/* Rekey after (cipher-specific) maxiumum blocks */ |
/* 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); |
state->newkeys[MODE_OUT]->enc.block_size); |
return (state->max_blocks_out && |
return (state->max_blocks_out && |
(state->p_send.blocks + out_blocks > state->max_blocks_out)) || |
(state->p_send.blocks + out_blocks > state->max_blocks_out)) || |
|
|
if (state->extra_pad) { |
if (state->extra_pad) { |
tmp = state->extra_pad; |
tmp = state->extra_pad; |
state->extra_pad = |
state->extra_pad = |
roundup(state->extra_pad, block_size); |
ROUNDUP(state->extra_pad, block_size); |
/* check if roundup overflowed */ |
/* check if roundup overflowed */ |
if (state->extra_pad < tmp) |
if (state->extra_pad < tmp) |
return SSH_ERR_INVALID_ARGUMENT; |
return SSH_ERR_INVALID_ARGUMENT; |