7ad97ba
This patch creates a crypt-glibc subdirectory which builds the
7ad97ba
libgcrypt files, but this time against the glibc sources.
7ad97ba
7ad97ba
The default subdirs list does not include this subdirectory because
7ad97ba
the file names conflict with the crypt directory.  The spec file does
7ad97ba
not use the install target to install the built libcrypt.so file,
7ad97ba
either.
7ad97ba
7ad97ba
Index: b/crypt-glibc/Makefile
7ad97ba
===================================================================
7ad97ba
--- /dev/null
7ad97ba
+++ b/crypt-glibc/Makefile
fbc4236
@@ -0,0 +1,61 @@
7ad97ba
+# Build libcrypt against internal cryptographic algorithms.
7ad97ba
+# Copyright (C) 1996-2016 Free Software Foundation, Inc.
7ad97ba
+# This file is part of the GNU C Library.
7ad97ba
+
7ad97ba
+# The GNU C Library is free software; you can redistribute it and/or
7ad97ba
+# modify it under the terms of the GNU Lesser General Public
7ad97ba
+# License as published by the Free Software Foundation; either
7ad97ba
+# version 2.1 of the License, or (at your option) any later version.
7ad97ba
+
7ad97ba
+# The GNU C Library is distributed in the hope that it will be useful,
7ad97ba
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7ad97ba
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7ad97ba
+# Lesser General Public License for more details.
7ad97ba
+
7ad97ba
+# You should have received a copy of the GNU Lesser General Public
7ad97ba
+# License along with the GNU C Library; if not, see
7ad97ba
+# <http://www.gnu.org/licenses/>.
7ad97ba
+
7ad97ba
+#
7ad97ba
+#	Sub-makefile for crypt() portion of the library.
7ad97ba
+#
7ad97ba
+subdir	:= crypt-glibc
7ad97ba
+
7ad97ba
+include ../Makeconfig
7ad97ba
+
7ad97ba
+extra-libs := libcrypt
7ad97ba
+extra-libs-others := $(extra-libs)
7ad97ba
+
7ad97ba
+# Use the sources in the crypt subdirectory.
7ad97ba
+vpath %.c ../crypt
fbc4236
+vpath %.input ../crypt
7ad97ba
+
7ad97ba
+libcrypt-routines := \
7ad97ba
+  crypt-entry md5-crypt sha256-crypt sha512-crypt crypt crypt_util
7ad97ba
+
7ad97ba
+tests := cert md5c-test sha256c-test sha512c-test badsalttest
7ad97ba
+
7ad97ba
+libcrypt-routines += md5 sha256 sha512
7ad97ba
+
7ad97ba
+tests += md5test sha256test sha512test
7ad97ba
+
7ad97ba
+# The test md5test-giant uses up to 400 MB of RSS and runs on a fast
7ad97ba
+# machine over a minute.
7ad97ba
+xtests = md5test-giant
7ad97ba
+
7ad97ba
+include ../Rules
7ad97ba
+
b8b6a43
+md5-routines := md5 $(filter md5%,$(libcrypt-sysdep_routines))
b8b6a43
+sha256-routines := sha256 $(filter sha256%,$(libcrypt-sysdep_routines))
b8b6a43
+sha512-routines := sha512 $(filter sha512%,$(libcrypt-sysdep_routines))
b8b6a43
+
b8b6a43
+$(objpfx)md5test: $(patsubst %, $(objpfx)%.o,$(md5-routines))
b8b6a43
+$(objpfx)md5test-giant: $(patsubst %, $(objpfx)%.o,$(md5-routines))
b8b6a43
+$(objpfx)sha256test: $(patsubst %, $(objpfx)%.o,$(sha256-routines))
b8b6a43
+$(objpfx)sha512test: $(patsubst %, $(objpfx)%.o,$(sha512-routines))
b8b6a43
+
7ad97ba
+ifeq (yes,$(build-shared))
7ad97ba
+$(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.so
7ad97ba
+else
7ad97ba
+$(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.a
7ad97ba
+endif
7ad97ba
Index: b/crypt/md5.c
7ad97ba
===================================================================
7ad97ba
--- a/crypt/md5.c
7ad97ba
+++ b/crypt/md5.c
7ad97ba
@@ -270,4 +270,4 @@ md5_process_bytes (const void *buffer, s
7ad97ba
     }
7ad97ba
 }
7ad97ba
 
7ad97ba
-#include <md5-block.c>
7ad97ba
+#include "md5-block.c"
7ad97ba
Index: b/crypt/sha256.c
7ad97ba
===================================================================
7ad97ba
--- a/crypt/sha256.c
7ad97ba
+++ b/crypt/sha256.c
fbc4236
@@ -211,4 +211,4 @@ __sha256_process_bytes (const void *buff
7ad97ba
     }
7ad97ba
 }
7ad97ba
 
7ad97ba
-#include <sha256-block.c>
7ad97ba
+#include "sha256-block.c"
7ad97ba
Index: b/crypt/sha512.c
7ad97ba
===================================================================
7ad97ba
--- a/crypt/sha512.c
7ad97ba
+++ b/crypt/sha512.c
7ad97ba
@@ -235,4 +235,4 @@ __sha512_process_bytes (const void *buff
7ad97ba
     }
7ad97ba
 }
7ad97ba
 
7ad97ba
-#include <sha512-block.c>
7ad97ba
+#include "sha512-block.c"
7ad97ba
Index: b/crypt-glibc/Versions
7ad97ba
===================================================================
7ad97ba
--- /dev/null
7ad97ba
+++ b/crypt-glibc/Versions
7ad97ba
@@ -0,0 +1,5 @@
7ad97ba
+libcrypt {
7ad97ba
+  GLIBC_2.0 {
7ad97ba
+    crypt; crypt_r; encrypt; encrypt_r; fcrypt; setkey; setkey_r;
7ad97ba
+  }
7ad97ba
+}