diff options
author | Darren Tucker <dtucker@zip.com.au> | 2003-07-14 09:31:06 +0200 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2003-07-14 09:31:06 +0200 |
commit | 81a0b371f4872b99001e3eb20b0a154714801d15 (patch) | |
tree | d5603b27410fd005a1e1fb785d809cb5eada9e32 /packet.c | |
parent | - avsm@cvs.openbsd.org 2003/07/09 13:58:19 (diff) | |
download | openssh-81a0b371f4872b99001e3eb20b0a154714801d15.tar.xz openssh-81a0b371f4872b99001e3eb20b0a154714801d15.zip |
- markus@cvs.openbsd.org 2003/07/10 14:42:28
[packet.c]
the 2^(blocksize*2) rekeying limit is too expensive for 3DES,
blowfish, etc, so enforce a 1GB limit for small blocksizes.
Diffstat (limited to 'packet.c')
-rw-r--r-- | packet.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -37,7 +37,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: packet.c,v 1.108 2003/06/24 08:23:46 markus Exp $"); +RCSID("$OpenBSD: packet.c,v 1.109 2003/07/10 14:42:28 markus Exp $"); #include "openbsd-compat/sys-queue.h" @@ -635,7 +635,14 @@ set_newkeys(int mode) buffer_compress_init_recv(); comp->enabled = 1; } - *max_blocks = ((u_int64_t)1 << (enc->block_size*2)); + /* + * The 2^(blocksize*2) limit is too expensive for 3DES, + * blowfish, etc, so enforce a 1GB limit for small blocksizes. + */ + if (enc->block_size >= 16) + *max_blocks = (u_int64_t)1 << (enc->block_size*2); + else + *max_blocks = ((u_int64_t)1 << 30) / enc->block_size; if (rekey_limit) *max_blocks = MIN(*max_blocks, rekey_limit / enc->block_size); } |