dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

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

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