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 /include | |
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 'include')
-rw-r--r-- | include/stdio.h | 2 | ||||
-rw-r--r-- | include/stdlib.h | 6 | ||||
-rw-r--r-- | include/string.h | 17 | ||||
-rw-r--r-- | include/unistd.h | 4 |
4 files changed, 15 insertions, 14 deletions
diff --git a/include/stdio.h b/include/stdio.h index fffa170..4a40f6a 100644 --- a/include/stdio.h +++ b/include/stdio.h | |||
@@ -3,7 +3,7 @@ | |||
3 | #ifndef LIBCRYPTOCOMPAT_STDIO_H | 3 | #ifndef LIBCRYPTOCOMPAT_STDIO_H |
4 | #define LIBCRYPTOCOMPAT_STDIO_H | 4 | #define LIBCRYPTOCOMPAT_STDIO_H |
5 | 5 | ||
6 | #ifdef NO_ASPRINTF | 6 | #ifndef HAVE_ASPRINTF |
7 | #include <stdarg.h> | 7 | #include <stdarg.h> |
8 | int vasprintf(char **str, const char *fmt, va_list ap); | 8 | int vasprintf(char **str, const char *fmt, va_list ap); |
9 | int asprintf(char **str, const char *fmt, ...); | 9 | int asprintf(char **str, const char *fmt, ...); |
diff --git a/include/stdlib.h b/include/stdlib.h index c314f38..1a1cb6c 100644 --- a/include/stdlib.h +++ b/include/stdlib.h | |||
@@ -7,16 +7,16 @@ | |||
7 | #include <sys/time.h> | 7 | #include <sys/time.h> |
8 | #include <stdint.h> | 8 | #include <stdint.h> |
9 | 9 | ||
10 | #ifdef NO_ARC4RANDOM_BUF | 10 | #ifndef HAVE_ARC4RANDOM_BUF |
11 | uint32_t arc4random(void); | 11 | uint32_t arc4random(void); |
12 | void arc4random_buf(void *_buf, size_t n); | 12 | void arc4random_buf(void *_buf, size_t n); |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | #ifdef NO_REALLOCARRAY | 15 | #ifndef HAVE_REALLOCARRAY |
16 | void *reallocarray(void *, size_t, size_t); | 16 | void *reallocarray(void *, size_t, size_t); |
17 | #endif | 17 | #endif |
18 | 18 | ||
19 | #ifdef NO_STRTONUM | 19 | #ifndef HAVE_STRTONUM |
20 | long long strtonum(const char *nptr, long long minval, | 20 | long long strtonum(const char *nptr, long long minval, |
21 | long long maxval, const char **errstr); | 21 | long long maxval, const char **errstr); |
22 | #endif | 22 | #endif |
diff --git a/include/string.h b/include/string.h index f092477..47ada28 100644 --- a/include/string.h +++ b/include/string.h | |||
@@ -12,34 +12,35 @@ | |||
12 | #include <strings.h> | 12 | #include <strings.h> |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | #ifdef NO_STRLCPY | 15 | #ifndef HAVE_STRLCPY |
16 | size_t strlcpy(char *dst, const char *src, size_t siz); | 16 | size_t strlcpy(char *dst, const char *src, size_t siz); |
17 | #endif | 17 | #endif |
18 | 18 | ||
19 | #ifdef NO_STRLCAT | 19 | #ifndef HAVE_STRLCAT |
20 | size_t strlcat(char *dst, const char *src, size_t siz); | 20 | size_t strlcat(char *dst, const char *src, size_t siz); |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #ifdef NO_STRNDUP | 23 | #ifndef HAVE_STRNDUP |
24 | char * strndup(const char *str, size_t maxlen); | 24 | char * strndup(const char *str, size_t maxlen); |
25 | #ifdef NO_STRNLEN | 25 | /* the only user of strnlen is strndup, so only build it if needed */ |
26 | #ifndef HAVE_STRNLEN | ||
26 | size_t strnlen(const char *str, size_t maxlen); | 27 | size_t strnlen(const char *str, size_t maxlen); |
27 | #endif | 28 | #endif |
28 | #endif | 29 | #endif |
29 | 30 | ||
30 | #ifdef NO_EXPLICIT_BZERO | 31 | #ifndef HAVE_EXPLICIT_BZERO |
31 | void explicit_bzero(void *, size_t); | 32 | void explicit_bzero(void *, size_t); |
32 | #endif | 33 | #endif |
33 | 34 | ||
34 | #ifdef NO_TIMINGSAFE_BCMP | 35 | #ifndef HAVE_TIMINGSAFE_BCMP |
35 | int timingsafe_bcmp(const void *b1, const void *b2, size_t n); | 36 | int timingsafe_bcmp(const void *b1, const void *b2, size_t n); |
36 | #endif | 37 | #endif |
37 | 38 | ||
38 | #ifdef NO_TIMINGSAFE_MEMCMP | 39 | #ifndef HAVE_TIMINGSAFE_MEMCMP |
39 | int timingsafe_memcmp(const void *b1, const void *b2, size_t len); | 40 | int timingsafe_memcmp(const void *b1, const void *b2, size_t len); |
40 | #endif | 41 | #endif |
41 | 42 | ||
42 | #ifdef NO_MEMMEM | 43 | #ifndef HAVE_MEMMEM |
43 | void * memmem(const void *big, size_t big_len, const void *little, | 44 | void * memmem(const void *big, size_t big_len, const void *little, |
44 | size_t little_len); | 45 | size_t little_len); |
45 | #endif | 46 | #endif |
diff --git a/include/unistd.h b/include/unistd.h index 037b11a..38caeb1 100644 --- a/include/unistd.h +++ b/include/unistd.h | |||
@@ -3,11 +3,11 @@ | |||
3 | #ifndef LIBCRYPTOCOMPAT_UNISTD_H | 3 | #ifndef LIBCRYPTOCOMPAT_UNISTD_H |
4 | #define LIBCRYPTOCOMPAT_UNISTD_H | 4 | #define LIBCRYPTOCOMPAT_UNISTD_H |
5 | 5 | ||
6 | #ifdef NO_GETENTROPY | 6 | #ifndef HAVE_GETENTROPY |
7 | int getentropy(void *buf, size_t buflen); | 7 | int getentropy(void *buf, size_t buflen); |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | #ifdef NO_ISSETUGID | 10 | #ifndef HAVE_ISSETUGID |
11 | int issetugid(void); | 11 | int issetugid(void); |
12 | #endif | 12 | #endif |
13 | 13 | ||