Page MenuHome GnuPG

add configure check for zlib to ntbtls
Open, NormalPublic

Description

"ntbtls-0.1.2" downloaded from "https://www.gnupg.org/download/index.html"

Operated on "CentOS Linux release 7.7.1908 (Core)"

Here the protocol:

[patzelt@centos7 ntbtls-0.1.2]$ make
make all-recursive
make[1]: Entering directory `/home/patzelt/Schreibtisch/GnupgWRK/ntbtls-0.1.2'
Making all in src
make[2]: Entering directory `/home/patzelt/Schreibtisch/GnupgWRK/ntbtls-0.1.2/src'
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -I/usr/local/include -g -O2 -fvisibility=hidden -Wall -Wno-pointer-sign -Wpointer-arith -MT visibility.lo -MD -MP -MF .deps/visibility.Tpo -c -o visibility.lo visibility.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -I/usr/local/include -g -O2 -fvisibility=hidden -Wall -Wno-pointer-sign -Wpointer-arith -MT visibility.lo -MD -MP -MF .deps/visibility.Tpo -c visibility.c -fPIC -DPIC -o .libs/visibility.o
In file included from ntbtls-int.h:251:0,

from visibility.h:24,
from visibility.c:24:

context.h:24:18: fatal error: zlib.h: No such file or directory
#include <zlib.h>

^

compilation terminated.
make[2]: * [visibility.lo] Fehler 1
make[2]: Leaving directory `/home/patzelt/Schreibtisch/GnupgWRK/ntbtls-0.1.2/src'
make[1]:
* [all-recursive] Fehler 1
make[1]: Leaving directory `/home/patzelt/Schreibtisch/GnupgWRK/ntbtls-0.1.2'
make: *** [all] Fehler 2
[patzelt@centos7 ntbtls-0.1.2]$

What's to do?

Event Timeline

werner triaged this task as Normal priority.Feb 6 2020, 9:21 PM
werner added a project: ntbtls.
werner added a subscriber: werner.

Install the zlib development package, its name is often "zlib1g-dev". The source requires the header because we plan to eventually support compression.

We need to add a configure check. though.

werner renamed this task from "make" with "ntbtls-0.1.2" failed to add configure check for zlib to ntbtls.Feb 6 2020, 9:21 PM

Actually, configure already has the check.
If it's really needed to build without zlib, you can use this patch:

From 76920ac034490e4860ad6abe9891e3b1c0813363 Mon Sep 17 00:00:00 2001
From: NIIBE Yutaka <gniibe@fsij.org>
Date: Fri, 28 Aug 2020 11:02:13 +0900
Subject: [PATCH] Until compression is implemented, build with no ZLIB can be
 done.

* src/context.h [HAVE_ZIP]: Support without ZLIB.
* src/protocol.c [HAVE_ZIP]: Support without ZLIB.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
---
 src/context.h  | 5 ++++-
 src/protocol.c | 8 ++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/context.h b/src/context.h
index 9cd0dc9..b71bd66 100644
--- a/src/context.h
+++ b/src/context.h
@@ -21,8 +21,9 @@
 #ifndef NTBTLS_CONTEXT_H
 #define NTBTLS_CONTEXT_H
 
+#ifdef HAVE_ZIP
 #include <zlib.h>
-
+#endif
 
 typedef enum gcry_md_algos md_algo_t;
 typedef enum gcry_mac_algos mac_algo_t;
@@ -182,11 +183,13 @@ struct _ntbtls_transform_s
   gcry_cipher_hd_t cipher_ctx_dec; /* Decryption context.     */
   cipher_mode_t    cipher_mode_dec;/* Mode for encryption.    */
 
+#ifdef HAVE_ZIP
   /*
    * Session specific compression layer
    */
   z_stream ctx_deflate;         /*!<  compression context     */
   z_stream ctx_inflate;         /*!<  decompression context   */
+#endif
 };
 
 typedef struct _ntbtls_transform_s *transform_t;
diff --git a/src/protocol.c b/src/protocol.c
index 8ffaf70..21da87c 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -1327,6 +1327,7 @@ ssl_compress_buf (ntbtls_t ssl)
   debug_buf (4, "before compression: output payload",
              ssl->out_msg, ssl->out_msglen);
 
+#ifdef HAVE_ZIP
   ssl->transform_out->ctx_deflate.next_in = msg_pre;
   ssl->transform_out->ctx_deflate.avail_in = len_pre;
   ssl->transform_out->ctx_deflate.next_out = msg_post;
@@ -1342,6 +1343,9 @@ ssl_compress_buf (ntbtls_t ssl)
 
   ssl->out_msglen = (TLS_BUFFER_LEN
                      - ssl->transform_out->ctx_deflate.avail_out);
+#else
+  return gpg_error (GPG_ERR_COMPR_FAILED);
+#endif
 
   debug_msg (3, "after compression: msglen = %zu, ", ssl->out_msglen);
 
@@ -1371,6 +1375,7 @@ ssl_decompress_buf (ntbtls_t ssl)
   debug_buf (4, "before decompression: input payload",
              ssl->in_msg, ssl->in_msglen);
 
+#ifdef HAVE_ZIP
   ssl->transform_in->ctx_inflate.next_in = msg_pre;
   ssl->transform_in->ctx_inflate.avail_in = len_pre;
   ssl->transform_in->ctx_inflate.next_out = msg_post;
@@ -1386,6 +1391,9 @@ ssl_decompress_buf (ntbtls_t ssl)
 
   ssl->in_msglen = (TLS_MAX_CONTENT_LEN
                     - ssl->transform_in->ctx_inflate.avail_out);
+#else
+  return gpg_error (GPG_ERR_COMPR_FAILED);
+#endif
 
   debug_msg (3, "after decompression: msglen = %zu, ", ssl->in_msglen);
 
-- 
2.20.1

I think we should make zlib a mandatory dependency.