dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

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

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