Blame SOURCES/1000-DOWNSTREAM-Use-OpenSSL-for-the-obfuscation-code.patch

5cd47f
From 8232c1005e56393422b0b1e6018e308ebc4fb4c1 Mon Sep 17 00:00:00 2001
5cd47f
From: Jakub Hrozek <jhrozek@redhat.com>
5cd47f
Date: Thu, 11 Apr 2019 22:39:03 +0200
5cd47f
Subject: [PATCH] DOWNSTREAM: Use OpenSSL for the obfuscation code
5cd47f
5cd47f
---
5cd47f
 Makefile.am                         | 6 ++++++
5cd47f
 configure.ac                        | 7 +++++++
5cd47f
 src/util/crypto/nss/nss_obfuscate.c | 5 +++++
5cd47f
 3 files changed, 18 insertions(+)
5cd47f
5cd47f
diff --git a/Makefile.am b/Makefile.am
5cd47f
index 0c24ae664..8b1f4f144 100644
5cd47f
--- a/Makefile.am
5cd47f
+++ b/Makefile.am
5cd47f
@@ -954,6 +954,12 @@ else
5cd47f
         $(NULL)
5cd47f
 endif
5cd47f
 
5cd47f
+if OBF_WITH_LIBCRYPTO
5cd47f
+SSS_CRYPT_SOURCES += src/util/crypto/libcrypto/crypto_obfuscate.c
5cd47f
+SSS_CRYPT_CFLAGS += $(CRYPTO_CFLAGS)
5cd47f
+SSS_CRYPT_LIBS += $(CRYPTO_LIBS)
5cd47f
+endif
5cd47f
+
5cd47f
 libsss_crypt_la_SOURCES = \
5cd47f
     $(SSS_CRYPT_SOURCES)
5cd47f
 libsss_crypt_la_CFLAGS = \
5cd47f
diff --git a/configure.ac b/configure.ac
5cd47f
index 9df463d9c..c3b349af4 100644
5cd47f
--- a/configure.ac
5cd47f
+++ b/configure.ac
5cd47f
@@ -391,6 +391,13 @@ if test x$cryptolib = xnss; then
5cd47f
     AM_CHECK_NSS
5cd47f
 fi
5cd47f
 
5cd47f
+dnl RHEL-specific: We always check for libcrypto because the obfuscation
5cd47f
+dnl feature is only implemented with OpenSSL as the NSS version doesn't
5cd47f
+dnl run in FIPS mode
5cd47f
+AM_CHECK_LIBCRYPTO
5cd47f
+AM_CONDITIONAL([OBF_WITH_LIBCRYPTO], [test x == x])
5cd47f
+AC_DEFINE_UNQUOTED(OBF_WITH_LIBCRYPTO, 1, [Build the obfuscation feature with libcrypt crypto back end])
5cd47f
+
5cd47f
 if test x$cryptolib = xlibcrypto; then
5cd47f
     AM_CHECK_LIBCRYPTO
5cd47f
     m4_include([src/external/p11-kit.m4])
5cd47f
diff --git a/src/util/crypto/nss/nss_obfuscate.c b/src/util/crypto/nss/nss_obfuscate.c
5cd47f
index df9c41b3a..bf2a5f418 100644
5cd47f
--- a/src/util/crypto/nss/nss_obfuscate.c
5cd47f
+++ b/src/util/crypto/nss/nss_obfuscate.c
5cd47f
@@ -31,6 +31,9 @@
5cd47f
  */
5cd47f
 
5cd47f
 #include "config.h"
5cd47f
+
5cd47f
+#ifndef OBF_WITH_LIBCRYPTO
5cd47f
+
5cd47f
 #include <prerror.h>
5cd47f
 #include <pk11func.h>
5cd47f
 
5cd47f
@@ -326,3 +329,5 @@ done:
5cd47f
     talloc_free(tmp_ctx);
5cd47f
     return ret;
5cd47f
 }
5cd47f
+
5cd47f
+#endif /* OBF_WITH_LIBCRYPTO */
5cd47f
-- 
5cd47f
2.19.2
5cd47f