1
0
mirror of https://github.com/libssh2/libssh2.git synced 2026-10-24 03:48:58 +03:00

comp: mitigate potential side-channel attack by disabling LZ77 in zlib compression

Note, this change lowers the compression level from 6 (default) to 1
(best speed).

Refs:
https://arxiv.org/pdf/2609.07709
https://www.openssh.org/txt/release-10.6
1d5340fce2
OpenBSD-Commit-ID: 839e5e53ad76786d0e90bed530304e4e13acbba0

Discovered-by: Fabian Bäumer
Discovered-by: Marcus Brinkmann
Based-on-patch-by: Job Snijders

Closes #2658
This commit is contained in:
Viktor Szakats
2026-10-06 18:27:27 +02:00
parent 5d27ee28ed
commit d4e5780315

View File

@@ -142,7 +142,8 @@ static int comp_method_zlib_init(LIBSSH2_SESSION *session, int compr,
strm->zalloc = (alloc_func)comp_method_zlib_alloc;
strm->zfree = (free_func)comp_method_zlib_free;
if(compr)
status = deflateInit(strm, Z_DEFAULT_COMPRESSION);
status = deflateInit2(strm, Z_BEST_SPEED, Z_DEFLATED, 15, 8,
Z_HUFFMAN_ONLY);
else
status = inflateInit(strm);