wolfSSL / wolfssh

wolfSSH is a small, fast, portable SSH implementation, including support for SCP and SFTP.
https://www.wolfssl.com
367 stars 88 forks source link

Reduce SCP Allocations #717

Closed ejohnstown closed 1 month ago

ejohnstown commented 2 months ago

DESCRIPTION

wolfSCP allocates a few buffers as needed and frees them immediately when done. It also checks at shutdown if the buffers need to be freed and frees them. When copying a large file (sink action), it will alloc and free the file buffer for each chunk of file sent by the peer. This could lead to fragmentation. Change the file receive and command buffers to be allocated when needed, and don't free them until cleanup.

TESTING

./examples/scpclient/wolfscp -u john -i ~/.ssh/id_ecdsa -j ~/.ssh/id_ecdsa.pub -S $PWD/configure:$HOME/configure -p 22
sha256sum configure ~/configure