]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
crypt: Use NSPR header files in addition to NSS header files [BZ #17956]
authorGuido Trentalancia <guido@trentalancia.net>
Sat, 18 Nov 2017 18:26:57 +0000 (19:26 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Sat, 18 Nov 2017 18:26:57 +0000 (19:26 +0100)
When configuring and building GNU libc using the Mozilla NSS library
for cryptography (--enable-nss-crypt option), also include the
NSPR header files along with the Mozilla NSS library header files.

Finally, when running the check-local-headers test, ignore the
Mozilla NSPR library header files (used by the Mozilla NSS library).

(cherry picked from commit 57b4af1955e28c1623c98397b8597847d16bdd8c)

ChangeLog
NEWS
configure
configure.ac
crypt/Makefile
scripts/check-local-headers.sh

index d67ad031bc77e3b5eacb1d265aaf84cd3d400c06..0693e834ddf835796e3fe9cc274fbe44ebe82213 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2017-10-04  Guido Trentalancia  <guido@trentalancia.net>
+
+       [BZ #17956]
+       * configure.ac (--enable-nss-crypt): Use NSPR include directory.
+       * configure: Regenerate.
+       * crypt/Makefile (nss-cpp-flags): New variable.
+       (CPPFLAGS-sha256-crypt.c, CPPFLAGS-sha512-crypt.c)
+       (CPPFLAGS-md5-crypt.c): Use it.
+       * scripts/check-local-headers.sh: Ignore nspr header file
+       directory.
+
 2017-10-18  Wilco Dijkstra  <wdijkstr@arm.com>
 
        * malloc/malloc.c (malloc_state): Use int for have_fastchunks since
diff --git a/NEWS b/NEWS
index ea1c1f1c0472140694d12c3b7d7e8571bd0abb3a..e7b62a8d463db38eefe237076c990faf8a7c4ff4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,7 @@ Security related changes:
 The following bugs are resolved with this release:
 
   [16750] ldd: Never run file directly.
+  [17956] crypt: Use NSPR header files in addition to NSS header files
   [21242] assert: Suppress pedantic warning caused by statement expression
   [21265] x86-64: Use fxsave/xsave/xsavec in _dl_runtime_resolve
   [21780] posix: Set p{read,write}v2 to return ENOTSUP
index d8e1c50e11183975d123ac5a9ac28ddd2659b934..47d8c75248a926ef7171361b9aaeb04632af8fec 100755 (executable)
--- a/configure
+++ b/configure
@@ -3547,8 +3547,12 @@ if test x$nss_crypt = xyes; then
   if test $? -ne 0; then
     as_fn_error $? "cannot find include directory with nss-config" "$LINENO" 5
   fi
+  nspr_includes=-I$(nspr-config --includedir 2>/dev/null)
+  if test $? -ne 0; then
+    as_fn_error $? "cannot find include directory with nspr-config" "$LINENO" 5
+  fi
   old_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS $nss_includes"
+  CFLAGS="$CFLAGS $nss_includes $nspr_includes"
 
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
index 77456aa8d9d35ae557f7cfc4aa98ffd1349e0066..e8a1ab35622357533348a2e5f4decb9401cd3fda 100644 (file)
@@ -330,8 +330,12 @@ if test x$nss_crypt = xyes; then
   if test $? -ne 0; then
     AC_MSG_ERROR([cannot find include directory with nss-config])
   fi
+  nspr_includes=-I$(nspr-config --includedir 2>/dev/null)
+  if test $? -ne 0; then
+    AC_MSG_ERROR([cannot find include directory with nspr-config])
+  fi
   old_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS $nss_includes"
+  CFLAGS="$CFLAGS $nss_includes $nspr_includes"
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
 #include <hasht.h>
 #include <nsslowhash.h>
index 0280fba8a712a29dd4ed98357e27ee646fa7ff4a..8bbbf2a1215602f880052e3a084c32d648936353 100644 (file)
@@ -37,9 +37,11 @@ routines += $(libcrypt-routines)
 endif
 
 ifeq ($(nss-crypt),yes)
-CPPFLAGS-sha256-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir)
-CPPFLAGS-sha512-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir)
-CPPFLAGS-md5-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir)
+nss-cpp-flags := -DUSE_NSS \
+  -I$(shell nss-config --includedir) -I$(shell nspr-config --includedir)
+CPPFLAGS-sha256-crypt.c = $(nss-cpp-flags)
+CPPFLAGS-sha512-crypt.c = $(nss-cpp-flags)
+CPPFLAGS-md5-crypt.c = $(nss-cpp-flags)
 LDLIBS-crypt.so = -lfreebl3
 else
 libcrypt-routines += md5 sha256 sha512
index 7859f613b2ed222f82a4021b2834310cf12caf4f..46923616867df295788cb2a054dfd2d382aa452e 100755 (executable)
@@ -33,7 +33,7 @@ exec ${AWK} -v includedir="$includedir" '
 BEGIN {
   status = 0
   exclude = "^" includedir \
-    "/(.*-.*-.*/|.*-.*/|)(asm[-/]|arch|linux/|selinux/|mach/|mach_debug/|device/|hurd/(((hurd|ioctl)_types|paths)\\.h|ioctls\\.defs|ihash\\.h)|cthreads\\.h|gd|nss3/|c\\+\\+/|sys/(capability|sdt(|-config))\\.h|libaudit\\.h)"
+    "/(.*-.*-.*/|.*-.*/|)(asm[-/]|arch|linux/|selinux/|mach/|mach_debug/|device/|hurd/(((hurd|ioctl)_types|paths)\\.h|ioctls\\.defs|ihash\\.h)|cthreads\\.h|gd|nss3/|nspr/|c\\+\\+/|sys/(capability|sdt(|-config))\\.h|libaudit\\.h)"
 }
 /^[^ ]/ && $1 ~ /.*:/ { obj = $1 }
 {