zlib: Move conditional compilation inside of the gzip.c

This implements stub for the compression functions and includes the
gzip.c in the compilation target uncoditionally, keeping the WITH_ZLIB
conditional compilation only in the gzip.c

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 0cd749a533)
This commit is contained in:
Jakub Jelen
2025-01-14 14:43:22 +01:00
parent 2e5b6beec7
commit 39aefd479f
4 changed files with 28 additions and 14 deletions

View File

@@ -26,13 +26,15 @@
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
#include "libssh/buffer.h"
#include "libssh/crypto.h"
#include "libssh/priv.h"
#include "libssh/session.h"
#ifdef WITH_ZLIB
#include <zlib.h>
#ifndef BLOCKSIZE
#define BLOCKSIZE 4092
#endif
@@ -274,3 +276,27 @@ compress_cleanup(struct ssh_crypto_struct *crypto)
}
SAFE_FREE(crypto->compress_in_ctx);
}
#else /* WITH_ZLIB */
int
compress_buffer(UNUSED_PARAM(ssh_session session), UNUSED_PARAM(ssh_buffer buf))
{
/* without zlib compiled in, this should never happen */
return -1;
}
int
decompress_buffer(UNUSED_PARAM(ssh_session session),
UNUSED_PARAM(ssh_buffer buf),
UNUSED_PARAM(size_t maxlen))
{
/* without zlib compiled in, this should never happen */
return -1;
}
void
compress_cleanup(UNUSED_PARAM(struct ssh_crypto_struct *crypto))
{
/* no-op */
}
#endif /* WITH_ZLIB */