diff options
| author | Brent Cook <bcook@openbsd.org> | 2017-07-08 17:46:16 -0500 |
|---|---|---|
| committer | Brent Cook <bcook@openbsd.org> | 2017-07-08 17:46:16 -0500 |
| commit | 9b88fa46bb727d811d95f7696d91cbc07278f65e (patch) | |
| tree | e2ce2533d826ca4507ddbdfad1f2a2f3f27f065b | |
| parent | 334245374a084ba175225c209ac9e18af5a60150 (diff) | |
| download | portable-9b88fa46bb727d811d95f7696d91cbc07278f65e.tar.gz portable-9b88fa46bb727d811d95f7696d91cbc07278f65e.tar.bz2 portable-9b88fa46bb727d811d95f7696d91cbc07278f65e.zip | |
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'
| -rw-r--r-- | configure.ac | 24 | ||||
| -rw-r--r-- | crypto/Makefile.am | 74 | ||||
| -rw-r--r-- | 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 | |||
| 54 | CHECK_VA_COPY | 54 | CHECK_VA_COPY |
| 55 | CHECK_B64_NTOP | 55 | CHECK_B64_NTOP |
| 56 | 56 | ||
| 57 | GENERATE_CRYPTO_PORTABLE_SYM | ||
| 58 | |||
| 59 | AC_ARG_WITH([openssldir], | 57 | AC_ARG_WITH([openssldir], |
| 60 | AS_HELP_STRING([--with-openssldir], | 58 | AS_HELP_STRING([--with-openssldir], |
| 61 | [Set the default openssl directory]), | 59 | [Set the default openssl directory]), |
| @@ -80,19 +78,15 @@ AC_TRY_COMPILE([#include "$srcdir/crypto/modes/modes_lcl.h"], | |||
| 80 | BSWAP4=no) | 78 | BSWAP4=no) |
| 81 | CFLAGS="$old_cflags" | 79 | CFLAGS="$old_cflags" |
| 82 | 80 | ||
| 83 | case $host_cpu in | 81 | AS_CASE([$host_cpu], |
| 84 | *sparc*) | 82 | [*sparc*], [CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT"], |
| 85 | CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT" | 83 | [*arm*], AS_IF([test "x$BSWAP4" = "xyes"],, |
| 86 | ;; | 84 | CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT"), |
| 87 | *arm*) | 85 | [*amd64*], [host_cpu=x86_64, HOSTARCH=intel], |
| 88 | AS_IF([test "x$BSWAP4" = "xyes"],, | 86 | [i?86], [HOSTARCH=intel], |
| 89 | CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT") | 87 | [x86_64], [HOSTARCH=intel] |
| 90 | ;; | 88 | ) |
| 91 | *amd64*) | 89 | AM_CONDITIONAL([HOST_CPU_IS_INTEL], [test "x$HOSTARCH" = "xintel"]) |
| 92 | host_cpu=x86_64 | ||
| 93 | ;; | ||
| 94 | |||
| 95 | esac | ||
| 96 | 90 | ||
| 97 | AC_MSG_CHECKING([if .gnu.warning accepts long strings]) | 91 | AC_MSG_CHECKING([if .gnu.warning accepts long strings]) |
| 98 | AC_LINK_IFELSE([AC_LANG_SOURCE([[ | 92 | 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 | |||
| 18 | BUILT_SOURCES = crypto_portable.sym | 18 | BUILT_SOURCES = crypto_portable.sym |
| 19 | CLEANFILES = crypto_portable.sym | 19 | CLEANFILES = crypto_portable.sym |
| 20 | 20 | ||
| 21 | crypto_portable.sym: | ||
| 22 | -echo "generating crypto_portable.sym ..." | ||
| 23 | -cp $(top_srcdir)/crypto/crypto.sym crypto_portable.sym | ||
| 24 | -chmod u+w crypto_portable.sym | ||
| 25 | if !HAVE_ARC4RANDOM_BUF | ||
| 26 | -echo arc4random >> crypto_portable.sym | ||
| 27 | -echo arc4random_buf >> crypto_portable.sym | ||
| 28 | -echo arc4random_uniform >> crypto_portable.sym | ||
| 29 | if !HAVE_GETENTROPY | ||
| 30 | -echo getentropy >> crypto_portable.sym | ||
| 31 | endif | ||
| 32 | endif | ||
| 33 | if !HAVE_ASPRINTF | ||
| 34 | -echo asprintf >> crypto_portable.sym | ||
| 35 | -echo vasprintf >> crypto_portable.sym | ||
| 36 | endif | ||
| 37 | if !HAVE_EXPLICIT_BZERO | ||
| 38 | -echo explicit_bzero >> crypto_portable.sym | ||
| 39 | endif | ||
| 40 | if !HAVE_FREEZERO | ||
| 41 | -echo freezero >> crypto_portable.sym | ||
| 42 | endif | ||
| 43 | if !HAVE_INET_PTON | ||
| 44 | -echo inet_pton >> crypto_portable.sym | ||
| 45 | endif | ||
| 46 | if !HAVE_REALLOCARRAY | ||
| 47 | -echo reallocarray >> crypto_portable.sym | ||
| 48 | endif | ||
| 49 | if !HAVE_RECALLOCARRAY | ||
| 50 | -echo recallocarray >> crypto_portable.sym | ||
| 51 | endif | ||
| 52 | if !HAVE_STRLCAT | ||
| 53 | -echo strlcat >> crypto_portable.sym | ||
| 54 | endif | ||
| 55 | if !HAVE_STRLCPY | ||
| 56 | -echo strlcpy >> crypto_portable.sym | ||
| 57 | endif | ||
| 58 | if !HAVE_STRNDUP | ||
| 59 | -echo strndup >> crypto_portable.sym | ||
| 60 | endif | ||
| 61 | if !HAVE_STRNLEN | ||
| 62 | -echo strnlen >> crypto_portable.sym | ||
| 63 | endif | ||
| 64 | if !HAVE_STRSEP | ||
| 65 | -echo strsep >> crypto_portable.sym | ||
| 66 | endif | ||
| 67 | if !HAVE_TIMEGM | ||
| 68 | -echo timegm >> crypto_portable.sym | ||
| 69 | endif | ||
| 70 | if !HAVE_TIMINGSAFE_BCMP | ||
| 71 | -echo timingsafe_bcmp >> crypto_portable.sym | ||
| 72 | endif | ||
| 73 | if !HAVE_TIMINGSAFE_MEMCMP | ||
| 74 | -echo timingsafe_memcmp >> crypto_portable.sym | ||
| 75 | endif | ||
| 76 | if HOST_CPU_IS_INTEL | ||
| 77 | -echo OPENSSL_ia32cap_P >> crypto_portable.sym | ||
| 78 | endif | ||
| 79 | if HOST_WIN | ||
| 80 | -echo posix_perror >> crypto_portable.sym | ||
| 81 | -echo posix_fopen >> crypto_portable.sym | ||
| 82 | -echo posix_fgets >> crypto_portable.sym | ||
| 83 | -echo posix_open >> crypto_portable.sym | ||
| 84 | -echo posix_rename >> crypto_portable.sym | ||
| 85 | -echo posix_connect >> crypto_portable.sym | ||
| 86 | -echo posix_close >> crypto_portable.sym | ||
| 87 | -echo posix_read >> crypto_portable.sym | ||
| 88 | -echo posix_write >> crypto_portable.sym | ||
| 89 | -echo posix_getsockopt >> crypto_portable.sym | ||
| 90 | -echo posix_setsockopt >> crypto_portable.sym | ||
| 91 | -grep -v BIO_s_log crypto_portable.sym > crypto_portable.sym.tmp | ||
| 92 | -mv crypto_portable.sym.tmp crypto_portable.sym | ||
| 93 | endif | ||
| 94 | |||
| 21 | libcrypto_la_LDFLAGS = -version-info @LIBCRYPTO_VERSION@ -no-undefined -export-symbols crypto_portable.sym | 95 | libcrypto_la_LDFLAGS = -version-info @LIBCRYPTO_VERSION@ -no-undefined -export-symbols crypto_portable.sym |
| 22 | libcrypto_la_LIBADD = libcompat.la | 96 | libcrypto_la_LIBADD = libcompat.la |
| 23 | if !HAVE_EXPLICIT_BZERO | 97 | 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 | |||
| 148 | AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists]) | 148 | AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists]) |
| 149 | fi | 149 | fi |
| 150 | ]) | 150 | ]) |
| 151 | |||
| 152 | AC_DEFUN([GENERATE_CRYPTO_PORTABLE_SYM], [ | ||
| 153 | AS_CASE([$host_cpu], | ||
| 154 | [i?86], [HOSTARCH=intel], | ||
| 155 | [x86_64], [HOSTARCH=intel], | ||
| 156 | [amd64], [HOSTARCH=intel], | ||
| 157 | ) | ||
| 158 | AC_SUBST([HOSTARCH]) | ||
| 159 | crypto_sym=$srcdir/crypto/crypto.sym | ||
| 160 | crypto_p_sym=./crypto/crypto_portable.sym | ||
| 161 | echo "generating $crypto_p_sym ..." | ||
| 162 | mkdir -p ./crypto | ||
| 163 | cp $crypto_sym $crypto_p_sym | ||
| 164 | chmod u+w $crypto_p_sym | ||
| 165 | if test "x$ac_cv_func_arc4random_buf" = "xno" ; then | ||
| 166 | echo arc4random >> $crypto_p_sym | ||
| 167 | echo arc4random_buf >> $crypto_p_sym | ||
| 168 | echo arc4random_uniform >> $crypto_p_sym | ||
| 169 | if test "x$ac_cv_func_getentropy" = "xno" ; then | ||
| 170 | echo getentropy >> $crypto_p_sym | ||
| 171 | fi | ||
| 172 | fi | ||
| 173 | if test "x$ac_cv_func_asprintf" = "xno" ; then | ||
| 174 | echo asprintf >> $crypto_p_sym | ||
| 175 | echo vasprintf >> $crypto_p_sym | ||
| 176 | fi | ||
| 177 | if test "x$ac_cv_func_explicit_bzero" = "xno" ; then | ||
| 178 | echo explicit_bzero >> $crypto_p_sym | ||
| 179 | fi | ||
| 180 | if test "x$ac_cv_func_freezero" = "xno" ; then | ||
| 181 | echo freezero >> $crypto_p_sym | ||
| 182 | fi | ||
| 183 | if test "x$ac_cv_func_inet_pton" = "xno" ; then | ||
| 184 | echo inet_pton >> $crypto_p_sym | ||
| 185 | fi | ||
| 186 | if test "x$ac_cv_func_reallocarray" = "xno" ; then | ||
| 187 | echo reallocarray >> $crypto_p_sym | ||
| 188 | fi | ||
| 189 | if test "x$ac_cv_func_recallocarray" = "xno" ; then | ||
| 190 | echo recallocarray >> $crypto_p_sym | ||
| 191 | fi | ||
| 192 | if test "x$ac_cv_func_strlcat" = "xno" ; then | ||
| 193 | echo strlcat >> $crypto_p_sym | ||
| 194 | fi | ||
| 195 | if test "x$ac_cv_func_strlcpy" = "xno" ; then | ||
| 196 | echo strlcpy >> $crypto_p_sym | ||
| 197 | fi | ||
| 198 | if test "x$ac_cv_func_strndup" = "xno" ; then | ||
| 199 | echo strndup >> $crypto_p_sym | ||
| 200 | fi | ||
| 201 | if test "x$ac_cv_func_strnlen" = "xno" ; then | ||
| 202 | echo strnlen >> $crypto_p_sym | ||
| 203 | fi | ||
| 204 | if test "x$ac_cv_func_strsep" = "xno" ; then | ||
| 205 | echo strsep >> $crypto_p_sym | ||
| 206 | fi | ||
| 207 | if test "x$ac_cv_func_timegm" = "xno" ; then | ||
| 208 | echo timegm >> $crypto_p_sym | ||
| 209 | fi | ||
| 210 | if test "x$ac_cv_func_timingsafe_bcmp" = "xno" ; then | ||
| 211 | echo timingsafe_bcmp >> $crypto_p_sym | ||
| 212 | fi | ||
| 213 | if test "x$ac_cv_func_timingsafe_memcmp" = "xno" ; then | ||
| 214 | echo timingsafe_memcmp >> $crypto_p_sym | ||
| 215 | fi | ||
| 216 | if test "x$HOSTARCH" = "xintel" ; then | ||
| 217 | echo OPENSSL_ia32cap_P >> $crypto_p_sym | ||
| 218 | fi | ||
| 219 | if test "x$HOST_OS" = "xwin" ; then | ||
| 220 | echo posix_perror >> $crypto_p_sym | ||
| 221 | echo posix_fopen >> $crypto_p_sym | ||
| 222 | echo posix_fgets >> $crypto_p_sym | ||
| 223 | echo posix_open >> $crypto_p_sym | ||
| 224 | echo posix_rename >> $crypto_p_sym | ||
| 225 | echo posix_connect >> $crypto_p_sym | ||
| 226 | echo posix_close >> $crypto_p_sym | ||
| 227 | echo posix_read >> $crypto_p_sym | ||
| 228 | echo posix_write >> $crypto_p_sym | ||
| 229 | echo posix_getsockopt >> $crypto_p_sym | ||
| 230 | echo posix_setsockopt >> $crypto_p_sym | ||
| 231 | |||
| 232 | grep -v BIO_s_log $crypto_p_sym > $crypto_p_sym.tmp | ||
| 233 | mv $crypto_p_sym.tmp $crypto_p_sym | ||
| 234 | fi | ||
| 235 | ]) | ||
