File s390-tools-sles15sp1-0002-zkey-Add-build-dependency-to-OpenSSL-libcrypto.patch of Package s390-tools.14220

Subject: zkey: Add build dependency to OpenSSL (libcrypto)
From: Philipp Rudo <prudo@linux.ibm.com>

Summary:     zkey: Add support of protected key crypto for dm-crypt.
Description: Support the usage of protected key crypto for dm-crypt disks in
             plain format by providing a tool to manage a key repository
             allowing to associate secure keys with disk partitions or logical
             volumes.
Upstream-ID: 5e24f74fdefc5fe7d315df080832f1b059485f0f
Problem-ID:  SEC1800

Upstream-Description:

             zkey: Add build dependency to OpenSSL (libcrypto)

             The integrity support for the properties file routines use
             SHA-256 to build a hash of the keys and values of a property file.
             The codes uses the EVP_DigestInit_ex, EVP_DigestUpdate, and
             EVP_DigestFinal from the libcrypto library (OpenSSL).

             Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
             Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
             Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>


Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
---
 README.md     |    6 ++++++
 zkey/Makefile |   21 ++++++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)

--- a/README.md
+++ b/README.md
@@ -263,6 +263,7 @@ build options:
 | ncurses    | `HAVE_NCURSES` | hyptop                                |
 | pfm        | `HAVE_PFM`     | cpacfstats                            |
 | net-snmp   | `HAVE_SNMP`    | osasnmpd                              |
+| openssl    | `HAVE_OPENSSL` | zkey                                  |
 
 This table lists additional build or install options:
 
@@ -365,3 +366,8 @@ the different tools are provided:
   For running znetconf these programs are required:
   - modprobe (kmod)
   - vmcp (s390-tools)
+
+* zkey:
+  For building the zkey tools you need openssl version 0.9.7 or newer installed
+  (openssl-devel.rpm). Tip: you may skip the zkey build by adding
+  `HAVE_OPENSSL=0` to the make invocation.
--- a/zkey/Makefile
+++ b/zkey/Makefile
@@ -1,9 +1,26 @@
 include ../common.mak
 
+ifeq (${HAVE_OPENSSL},0)
+
+all:
+	$(SKIP) HAVE_OPENSSL=0
+
+install:
+	$(SKIP) HAVE_OPENSSL=0
+
+else
+
+check_dep:
+	$(call check_dep, \
+		"zkey", \
+		"openssl/evp.h", \
+		"openssl-devel", \
+		"HAVE_OPENSSL=0")
+
 CPPFLAGS += -I../include
 LDLIBS += -ldl -lcrypto
 
-all: zkey
+all: check_dep zkey
 
 libs = $(rootdir)/libutil/libutil.a
 
@@ -18,6 +35,8 @@ install: all
 	$(INSTALL) -d -m 755 $(DESTDIR)$(MANDIR)/man1
 	$(INSTALL) -m 644 -c zkey.1 $(DESTDIR)$(MANDIR)/man1
 
+endif
+
 clean:
 	rm -f *.o zkey
 
openSUSE Build Service is sponsored by