diff options
author | Brent Cook <bcook@openbsd.org> | 2014-10-29 15:44:36 -0500 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2014-10-30 19:15:11 -0500 |
commit | a4cc953911a745d6e769a03cbe6442ee2fc27cbd (patch) | |
tree | 8c26006db95beb6249b755e108ee1aa317e742bd /crypto | |
parent | 727bccd093eaeac853ac84c7b6f31e67e452cde9 (diff) | |
download | portable-a4cc953911a745d6e769a03cbe6442ee2fc27cbd.tar.gz portable-a4cc953911a745d6e769a03cbe6442ee2fc27cbd.tar.bz2 portable-a4cc953911a745d6e769a03cbe6442ee2fc27cbd.zip |
Improve and simplify function and header detection logic.
Simplify autoconf checks by using AC_CHECK_FUNCS/HEADERS.
Clarify some ambiguous dependencies around strnlen/strndup.
Unconditionally enable pidwraptest for all arc4random implementations.
Remove HAVE_VASPRINTF conditional, since asprintf requires vasprintf.
ok @doug
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/Makefile.am.tpl | 25 | ||||
-rw-r--r-- | crypto/compat/bsd-asprintf.c | 4 |
2 files changed, 14 insertions, 15 deletions
diff --git a/crypto/Makefile.am.tpl b/crypto/Makefile.am.tpl index 04ff7f7..0ace78a 100644 --- a/crypto/Makefile.am.tpl +++ b/crypto/Makefile.am.tpl | |||
@@ -16,7 +16,7 @@ noinst_LTLIBRARIES = libcompat.la libcompatnoopt.la | |||
16 | libcompatnoopt_la_CFLAGS = -O0 | 16 | libcompatnoopt_la_CFLAGS = -O0 |
17 | libcompatnoopt_la_SOURCES = | 17 | libcompatnoopt_la_SOURCES = |
18 | 18 | ||
19 | if NO_EXPLICIT_BZERO | 19 | if !HAVE_EXPLICIT_BZERO |
20 | libcompatnoopt_la_SOURCES += compat/explicit_bzero.c | 20 | libcompatnoopt_la_SOURCES += compat/explicit_bzero.c |
21 | endif | 21 | endif |
22 | 22 | ||
@@ -25,41 +25,42 @@ libcompat_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS) | |||
25 | libcompat_la_SOURCES = | 25 | libcompat_la_SOURCES = |
26 | libcompat_la_LIBADD = $(PLATFORM_LDADD) | 26 | libcompat_la_LIBADD = $(PLATFORM_LDADD) |
27 | 27 | ||
28 | if NO_STRLCAT | 28 | if !HAVE_STRLCAT |
29 | libcompat_la_SOURCES += compat/strlcat.c | 29 | libcompat_la_SOURCES += compat/strlcat.c |
30 | endif | 30 | endif |
31 | 31 | ||
32 | if NO_STRLCPY | 32 | if !HAVE_STRLCPY |
33 | libcompat_la_SOURCES += compat/strlcpy.c | 33 | libcompat_la_SOURCES += compat/strlcpy.c |
34 | endif | 34 | endif |
35 | 35 | ||
36 | if NO_STRNDUP | 36 | if !HAVE_STRNDUP |
37 | libcompat_la_SOURCES += compat/strndup.c | 37 | libcompat_la_SOURCES += compat/strndup.c |
38 | if NO_STRNLEN | 38 | # the only user of strnlen is strndup, so only build it if needed |
39 | if !HAVE_STRNLEN | ||
39 | libcompat_la_SOURCES += compat/strnlen.c | 40 | libcompat_la_SOURCES += compat/strnlen.c |
40 | endif | 41 | endif |
41 | endif | 42 | endif |
42 | 43 | ||
43 | if NO_ASPRINTF | 44 | if !HAVE_ASPRINTF |
44 | libcompat_la_SOURCES += compat/bsd-asprintf.c | 45 | libcompat_la_SOURCES += compat/bsd-asprintf.c |
45 | endif | 46 | endif |
46 | 47 | ||
47 | if NO_REALLOCARRAY | 48 | if !HAVE_REALLOCARRAY |
48 | libcompat_la_SOURCES += compat/reallocarray.c | 49 | libcompat_la_SOURCES += compat/reallocarray.c |
49 | endif | 50 | endif |
50 | 51 | ||
51 | if NO_TIMINGSAFE_MEMCMP | 52 | if !HAVE_TIMINGSAFE_MEMCMP |
52 | libcompat_la_SOURCES += compat/timingsafe_memcmp.c | 53 | libcompat_la_SOURCES += compat/timingsafe_memcmp.c |
53 | endif | 54 | endif |
54 | 55 | ||
55 | if NO_TIMINGSAFE_BCMP | 56 | if !HAVE_TIMINGSAFE_BCMP |
56 | libcompat_la_SOURCES += compat/timingsafe_bcmp.c | 57 | libcompat_la_SOURCES += compat/timingsafe_bcmp.c |
57 | endif | 58 | endif |
58 | 59 | ||
59 | if NO_ARC4RANDOM_BUF | 60 | if !HAVE_ARC4RANDOM_BUF |
60 | libcompat_la_SOURCES += compat/arc4random.c | 61 | libcompat_la_SOURCES += compat/arc4random.c |
61 | 62 | ||
62 | if NO_GETENTROPY | 63 | if !HAVE_GETENTROPY |
63 | if HOST_LINUX | 64 | if HOST_LINUX |
64 | libcompat_la_SOURCES += compat/getentropy_linux.c | 65 | libcompat_la_SOURCES += compat/getentropy_linux.c |
65 | endif | 66 | endif |
@@ -76,7 +77,7 @@ endif | |||
76 | 77 | ||
77 | endif | 78 | endif |
78 | 79 | ||
79 | if NO_ISSETUGID | 80 | if !HAVE_ISSETUGID |
80 | if HOST_LINUX | 81 | if HOST_LINUX |
81 | libcompat_la_SOURCES += compat/issetugid_linux.c | 82 | libcompat_la_SOURCES += compat/issetugid_linux.c |
82 | endif | 83 | endif |
diff --git a/crypto/compat/bsd-asprintf.c b/crypto/compat/bsd-asprintf.c index 8ccfa22..3728bc5 100644 --- a/crypto/compat/bsd-asprintf.c +++ b/crypto/compat/bsd-asprintf.c | |||
@@ -17,7 +17,7 @@ | |||
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef HAVE_VASPRINTF | 20 | #ifndef HAVE_ASPRINTF |
21 | 21 | ||
22 | #include <errno.h> | 22 | #include <errno.h> |
23 | #include <limits.h> /* for INT_MAX */ | 23 | #include <limits.h> /* for INT_MAX */ |
@@ -80,9 +80,7 @@ fail: | |||
80 | errno = ENOMEM; | 80 | errno = ENOMEM; |
81 | return (-1); | 81 | return (-1); |
82 | } | 82 | } |
83 | #endif | ||
84 | 83 | ||
85 | #ifndef HAVE_ASPRINTF | ||
86 | int asprintf(char **str, const char *fmt, ...) | 84 | int asprintf(char **str, const char *fmt, ...) |
87 | { | 85 | { |
88 | va_list ap; | 86 | va_list ap; |