Skip to content

Commit aa5383c

Browse files
committed
I think this takes care of the memory issues. However,
it looks like there might be something going on with the aes-ctr-mt cipher. It seems to be slower than the default cipher. I need to verify that.
1 parent b9bfb5d commit aa5383c

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

packet.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ ssh_set_newkeys(struct ssh *ssh, int mode)
961961
comp->enabled = 1;
962962
}
963963

964-
/* get the maximum number of blocks the cipher can
964+
/* get the maximum number of blocks the cipher can
965965
* handle safely */
966966
*max_blocks = cipher_rekey_blocks(enc->cipher);
967967

@@ -2236,11 +2236,19 @@ ssh_packet_set_server(struct ssh *ssh)
22362236
ssh->kex->server = 1; /* XXX unify? */
22372237
}
22382238

2239+
/* Set the state of the connection to post auth
2240+
* While we are here also decrease the size of
2241+
* packet_max_size to something more reasonable.
2242+
* In this case thats 33k. Which is the size of
2243+
* the largest packet we expect to see and some space
2244+
* for overhead. This reduces memory usage in high
2245+
* BDP environments without impacting performance
2246+
* -cjr 4/11/23 */
22392247
void
22402248
ssh_packet_set_authenticated(struct ssh *ssh)
22412249
{
22422250
ssh->state->after_authentication = 1;
2243-
packet_max_size = 256 * 1024;
2251+
packet_max_size = SSH_IOBUFSZ + 1024;
22442252
}
22452253

22462254
void *

sshbuf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define SSHBUF_INTERNAL
2828
#include "sshbuf.h"
2929
#include "misc.h"
30-
#include "log.h"
30+
/* #include "log.h" */
3131

3232
#define BUF_WATERSHED 256*1024
3333

@@ -425,8 +425,8 @@ sshbuf_allocate(struct sshbuf *buf, size_t len)
425425
* up being somewhat overallocated but works quickly */
426426
need = (4*1024*1024);
427427
rlen = ROUNDUP(buf->alloc + need, SSHBUF_SIZE_INC);
428-
debug_f ("Post: label: %s, %p, rlen is %zu need is %zu win_max is %zu max_size is %zu",
429-
buf->label, buf, rlen, need, buf->window_max, buf->max_size);
428+
/* debug_f ("Post: label: %s, %p, rlen is %zu need is %zu win_max is %zu max_size is %zu", */
429+
/* buf->label, buf, rlen, need, buf->window_max, buf->max_size); */
430430
}
431431
SSHBUF_DBG(("need %zu initial rlen %zu", need, rlen));
432432

0 commit comments

Comments
 (0)