From 9b88fa46bb727d811d95f7696d91cbc07278f65e Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sat, 8 Jul 2017 17:46:16 -0500 Subject: generate the crypto export symbol list at build time we currently do it at configure time, which makes this a generated source, but generated sources should be cleaned up, which breaks 'make clean; make' --- configure.ac | 24 ++++++--------- crypto/Makefile.am | 74 +++++++++++++++++++++++++++++++++++++++++++++++ m4/check-libc.m4 | 85 ------------------------------------------------------ 3 files changed, 83 insertions(+), 100 deletions(-) diff --git a/configure.ac b/configure.ac index 9fd7c2d..6f98b3e 100644 --- a/configure.ac +++ b/configure.ac @@ -54,8 +54,6 @@ CHECK_CRYPTO_COMPAT CHECK_VA_COPY CHECK_B64_NTOP -GENERATE_CRYPTO_PORTABLE_SYM - AC_ARG_WITH([openssldir], AS_HELP_STRING([--with-openssldir], [Set the default openssl directory]), @@ -80,19 +78,15 @@ AC_TRY_COMPILE([#include "$srcdir/crypto/modes/modes_lcl.h"], BSWAP4=no) CFLAGS="$old_cflags" -case $host_cpu in - *sparc*) - CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT" - ;; - *arm*) - AS_IF([test "x$BSWAP4" = "xyes"],, - CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT") - ;; - *amd64*) - host_cpu=x86_64 - ;; - -esac +AS_CASE([$host_cpu], + [*sparc*], [CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT"], + [*arm*], AS_IF([test "x$BSWAP4" = "xyes"],, + CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT"), + [*amd64*], [host_cpu=x86_64, HOSTARCH=intel], + [i?86], [HOSTARCH=intel], + [x86_64], [HOSTARCH=intel] +) +AM_CONDITIONAL([HOST_CPU_IS_INTEL], [test "x$HOSTARCH" = "xintel"]) AC_MSG_CHECKING([if .gnu.warning accepts long strings]) AC_LINK_IFELSE([AC_LANG_SOURCE([[ diff --git a/crypto/Makefile.am b/crypto/Makefile.am index 701cd4a..046a623 100644 --- a/crypto/Makefile.am +++ b/crypto/Makefile.am @@ -18,6 +18,80 @@ EXTRA_DIST += compat/strcasecmp.c BUILT_SOURCES = crypto_portable.sym CLEANFILES = crypto_portable.sym +crypto_portable.sym: + -echo "generating crypto_portable.sym ..." + -cp $(top_srcdir)/crypto/crypto.sym crypto_portable.sym + -chmod u+w crypto_portable.sym +if !HAVE_ARC4RANDOM_BUF + -echo arc4random >> crypto_portable.sym + -echo arc4random_buf >> crypto_portable.sym + -echo arc4random_uniform >> crypto_portable.sym +if !HAVE_GETENTROPY + -echo getentropy >> crypto_portable.sym +endif +endif +if !HAVE_ASPRINTF + -echo asprintf >> crypto_portable.sym + -echo vasprintf >> crypto_portable.sym +endif +if !HAVE_EXPLICIT_BZERO + -echo explicit_bzero >> crypto_portable.sym +endif +if !HAVE_FREEZERO + -echo freezero >> crypto_portable.sym +endif +if !HAVE_INET_PTON + -echo inet_pton >> crypto_portable.sym +endif +if !HAVE_REALLOCARRAY + -echo reallocarray >> crypto_portable.sym +endif +if !HAVE_RECALLOCARRAY + -echo recallocarray >> crypto_portable.sym +endif +if !HAVE_STRLCAT + -echo strlcat >> crypto_portable.sym +endif +if !HAVE_STRLCPY + -echo strlcpy >> crypto_portable.sym +endif +if !HAVE_STRNDUP + -echo strndup >> crypto_portable.sym +endif +if !HAVE_STRNLEN + -echo strnlen >> crypto_portable.sym +endif +if !HAVE_STRSEP + -echo strsep >> crypto_portable.sym +endif +if !HAVE_TIMEGM + -echo timegm >> crypto_portable.sym +endif +if !HAVE_TIMINGSAFE_BCMP + -echo timingsafe_bcmp >> crypto_portable.sym +endif +if !HAVE_TIMINGSAFE_MEMCMP + -echo timingsafe_memcmp >> crypto_portable.sym +endif +if HOST_CPU_IS_INTEL + -echo OPENSSL_ia32cap_P >> crypto_portable.sym +endif +if HOST_WIN + -echo posix_perror >> crypto_portable.sym + -echo posix_fopen >> crypto_portable.sym + -echo posix_fgets >> crypto_portable.sym + -echo posix_open >> crypto_portable.sym + -echo posix_rename >> crypto_portable.sym + -echo posix_connect >> crypto_portable.sym + -echo posix_close >> crypto_portable.sym + -echo posix_read >> crypto_portable.sym + -echo posix_write >> crypto_portable.sym + -echo posix_getsockopt >> crypto_portable.sym + -echo posix_setsockopt >> crypto_portable.sym + -grep -v BIO_s_log crypto_portable.sym > crypto_portable.sym.tmp + -mv crypto_portable.sym.tmp crypto_portable.sym +endif + libcrypto_la_LDFLAGS = -version-info @LIBCRYPTO_VERSION@ -no-undefined -export-symbols crypto_portable.sym libcrypto_la_LIBADD = libcompat.la if !HAVE_EXPLICIT_BZERO diff --git a/m4/check-libc.m4 b/m4/check-libc.m4 index 0b7ffb0..b1b5ef4 100644 --- a/m4/check-libc.m4 +++ b/m4/check-libc.m4 @@ -148,88 +148,3 @@ if test "x$ac_cv_have___va_copy" = "xyes" ; then AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists]) fi ]) - -AC_DEFUN([GENERATE_CRYPTO_PORTABLE_SYM], [ -AS_CASE([$host_cpu], - [i?86], [HOSTARCH=intel], - [x86_64], [HOSTARCH=intel], - [amd64], [HOSTARCH=intel], -) -AC_SUBST([HOSTARCH]) -crypto_sym=$srcdir/crypto/crypto.sym -crypto_p_sym=./crypto/crypto_portable.sym -echo "generating $crypto_p_sym ..." -mkdir -p ./crypto -cp $crypto_sym $crypto_p_sym -chmod u+w $crypto_p_sym -if test "x$ac_cv_func_arc4random_buf" = "xno" ; then - echo arc4random >> $crypto_p_sym - echo arc4random_buf >> $crypto_p_sym - echo arc4random_uniform >> $crypto_p_sym - if test "x$ac_cv_func_getentropy" = "xno" ; then - echo getentropy >> $crypto_p_sym - fi -fi -if test "x$ac_cv_func_asprintf" = "xno" ; then - echo asprintf >> $crypto_p_sym - echo vasprintf >> $crypto_p_sym -fi -if test "x$ac_cv_func_explicit_bzero" = "xno" ; then - echo explicit_bzero >> $crypto_p_sym -fi -if test "x$ac_cv_func_freezero" = "xno" ; then - echo freezero >> $crypto_p_sym -fi -if test "x$ac_cv_func_inet_pton" = "xno" ; then - echo inet_pton >> $crypto_p_sym -fi -if test "x$ac_cv_func_reallocarray" = "xno" ; then - echo reallocarray >> $crypto_p_sym -fi -if test "x$ac_cv_func_recallocarray" = "xno" ; then - echo recallocarray >> $crypto_p_sym -fi -if test "x$ac_cv_func_strlcat" = "xno" ; then - echo strlcat >> $crypto_p_sym -fi -if test "x$ac_cv_func_strlcpy" = "xno" ; then - echo strlcpy >> $crypto_p_sym -fi -if test "x$ac_cv_func_strndup" = "xno" ; then - echo strndup >> $crypto_p_sym -fi -if test "x$ac_cv_func_strnlen" = "xno" ; then - echo strnlen >> $crypto_p_sym -fi -if test "x$ac_cv_func_strsep" = "xno" ; then - echo strsep >> $crypto_p_sym -fi -if test "x$ac_cv_func_timegm" = "xno" ; then - echo timegm >> $crypto_p_sym -fi -if test "x$ac_cv_func_timingsafe_bcmp" = "xno" ; then - echo timingsafe_bcmp >> $crypto_p_sym -fi -if test "x$ac_cv_func_timingsafe_memcmp" = "xno" ; then - echo timingsafe_memcmp >> $crypto_p_sym -fi -if test "x$HOSTARCH" = "xintel" ; then - echo OPENSSL_ia32cap_P >> $crypto_p_sym -fi -if test "x$HOST_OS" = "xwin" ; then - echo posix_perror >> $crypto_p_sym - echo posix_fopen >> $crypto_p_sym - echo posix_fgets >> $crypto_p_sym - echo posix_open >> $crypto_p_sym - echo posix_rename >> $crypto_p_sym - echo posix_connect >> $crypto_p_sym - echo posix_close >> $crypto_p_sym - echo posix_read >> $crypto_p_sym - echo posix_write >> $crypto_p_sym - echo posix_getsockopt >> $crypto_p_sym - echo posix_setsockopt >> $crypto_p_sym - - grep -v BIO_s_log $crypto_p_sym > $crypto_p_sym.tmp - mv $crypto_p_sym.tmp $crypto_p_sym -fi -]) -- cgit v1.2.3-55-g6feb From e5505342036183ff32a8f537be1a5105d6a1dbaa Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sat, 8 Jul 2017 19:05:35 -0500 Subject: make it easier to swap grep (Solaris grep doesn't support alpha) --- update.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/update.sh b/update.sh index 90dbde6..ec69dfc 100755 --- a/update.sh +++ b/update.sh @@ -63,6 +63,10 @@ do_cp_libc() { CP_LIBC='do_cp_libc' CP='cp -p' +GREP='grep' +if [ -x /opt/csw/bin/ggrep ]; then + GREP='/opt/csw/bin/ggrep' +fi $CP $libssl_src/LICENSE COPYING @@ -152,7 +156,7 @@ done $CP crypto/compat/b_win.c crypto/bio $CP crypto/compat/ui_openssl_win.c crypto/ui # add the libcrypto symbol export list -grep -v OPENSSL_ia32cap_P $libcrypto_src/Symbols.list | grep '^[[:alpha:]]' > crypto/crypto.sym +$GREP -v OPENSSL_ia32cap_P $libcrypto_src/Symbols.list | $GREP '^[[:alpha:]]' > crypto/crypto.sym # generate assembly crypto algorithms asm_src=$libcrypto_src @@ -207,7 +211,7 @@ for i in `awk '/SOURCES|HEADERS/ { print $3 }' tls/Makefile.am` ; do fi done # add the libtls symbol export list -grep '^[[:alpha:]]' < $libtls_src/Symbols.list > tls/tls.sym +$GREP '^[[:alpha:]]' < $libtls_src/Symbols.list > tls/tls.sym mkdir -p libtls-standalone/m4 $CP m4/check*.m4 \ @@ -260,7 +264,7 @@ for i in `awk '/SOURCES|HEADERS/ { print $3 }' ssl/Makefile.am` ; do $CP $libssl_src/$i ssl done # add the libssl symbol export list -grep '^[[:alpha:]]' < $libssl_src/Symbols.list > ssl/ssl.sym +$GREP '^[[:alpha:]]' < $libssl_src/Symbols.list > ssl/ssl.sym # copy libcrypto tests echo "copying tests" @@ -305,7 +309,7 @@ add_man_links() { filter=$1 dest=$2 echo "install-data-hook:" >> $dest - for i in `grep $filter man/links`; do + for i in `$GREP $filter man/links`; do IFS=","; set $i; unset IFS if [ "$2" != "" ]; then echo " ln -sf \"$1\" \"\$(DESTDIR)\$(mandir)/man3/$2\"" >> $dest @@ -313,7 +317,7 @@ add_man_links() { done echo "" >> $dest echo "uninstall-local:" >> $dest - for i in `grep $filter man/links`; do + for i in `$GREP $filter man/links`; do IFS=","; set $i; unset IFS if [ "$2" != "" ]; then echo " -rm -f \"\$(DESTDIR)\$(mandir)/man3/$2\"" >> $dest -- cgit v1.2.3-55-g6feb