Revert "Remove zlib"

This reverts commit d874a1fd14bdf3df8ee232f539ac613adaae648c.

Conflicts:
* CMakeLists.txt:
  * ENABLE_ZLIB_SUPPORT: there has been a change immediately after
    where it was removed. Just re-add what was removed.
* tests/CMakeLists.txt:
  * ENABLE_ZLIB_SUPPORT: there has been a change immediately after
    where it was removed. Just re-add what was removed.
diff --git a/programs/Makefile b/programs/Makefile
index c5ac767..65a31b1 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -44,6 +44,11 @@
 SHARED_SUFFIX=
 endif
 
+# Zlib shared library extensions:
+ifdef ZLIB
+LOCAL_LDFLAGS += -lz
+endif
+
 APPS = \
 	aes/aescrypt2$(EXEXT) \
 	aes/crypt_and_hash$(EXEXT) \
diff --git a/programs/test/CMakeLists.txt b/programs/test/CMakeLists.txt
index 59f8d54..0d2b946 100644
--- a/programs/test/CMakeLists.txt
+++ b/programs/test/CMakeLists.txt
@@ -2,6 +2,10 @@
     mbedtls
 )
 
+if(ENABLE_ZLIB_SUPPORT)
+    set(libs ${libs} ${ZLIB_LIBRARIES})
+endif(ENABLE_ZLIB_SUPPORT)
+
 add_executable(selftest selftest.c)
 target_link_libraries(selftest ${libs})