summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2003-07-14 17:31:06 +1000
committerDarren Tucker <dtucker@zip.com.au>2003-07-14 17:31:06 +1000
commit81a0b371f4872b99001e3eb20b0a154714801d15 (patch)
treed5603b27410fd005a1e1fb785d809cb5eada9e32 /packet.c
parent29588616c214e411e1823b2949e5fa9d6a49d75f (diff)
- 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.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/packet.c b/packet.c
index 022212074..4ef639fd6 100644
--- a/packet.c
+++ b/packet.c
@@ -37,7 +37,7 @@
37 */ 37 */
38 38
39#include "includes.h" 39#include "includes.h"
40RCSID("$OpenBSD: packet.c,v 1.108 2003/06/24 08:23:46 markus Exp $"); 40RCSID("$OpenBSD: packet.c,v 1.109 2003/07/10 14:42:28 markus Exp $");
41 41
42#include "openbsd-compat/sys-queue.h" 42#include "openbsd-compat/sys-queue.h"
43 43
@@ -635,7 +635,14 @@ set_newkeys(int mode)
635 buffer_compress_init_recv(); 635 buffer_compress_init_recv();
636 comp->enabled = 1; 636 comp->enabled = 1;
637 } 637 }
638 *max_blocks = ((u_int64_t)1 << (enc->block_size*2)); 638 /*
639 * The 2^(blocksize*2) limit is too expensive for 3DES,
640 * blowfish, etc, so enforce a 1GB limit for small blocksizes.
641 */
642 if (enc->block_size >= 16)
643 *max_blocks = (u_int64_t)1 << (enc->block_size*2);
644 else
645 *max_blocks = ((u_int64_t)1 << 30) / enc->block_size;
639 if (rekey_limit) 646 if (rekey_limit)
640 *max_blocks = MIN(*max_blocks, rekey_limit / enc->block_size); 647 *max_blocks = MIN(*max_blocks, rekey_limit / enc->block_size);
641} 648}