diff options
author | kinichiro <kinichiro.inoguchi@gmail.com> | 2017-03-09 22:49:04 +0900 |
---|---|---|
committer | kinichiro <kinichiro.inoguchi@gmail.com> | 2017-03-09 23:00:04 +0900 |
commit | 8877e9bc55fdbdb70c967b7720f57fba148a7dda (patch) | |
tree | 233b458c35130b15172908d6f0e9e99e6a078152 | |
parent | 27f08790305216e5730c5bb5352db9f616c4c56f (diff) | |
download | portable-8877e9bc55fdbdb70c967b7720f57fba148a7dda.tar.gz portable-8877e9bc55fdbdb70c967b7720f57fba148a7dda.tar.bz2 portable-8877e9bc55fdbdb70c967b7720f57fba148a7dda.zip |
Add recallocarray
-rw-r--r-- | crypto/CMakeLists.txt | 5 | ||||
-rw-r--r-- | crypto/Makefile.am | 4 | ||||
-rw-r--r-- | include/compat/stdlib.h | 4 | ||||
-rw-r--r-- | m4/check-libc.m4 | 7 | ||||
-rwxr-xr-x | update.sh | 1 |
5 files changed, 20 insertions, 1 deletions
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 99670f8..cda4fb3 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt | |||
@@ -691,6 +691,11 @@ if(NOT HAVE_REALLOCARRAY) | |||
691 | set(EXTRA_EXPORT ${EXTRA_EXPORT} reallocarray) | 691 | set(EXTRA_EXPORT ${EXTRA_EXPORT} reallocarray) |
692 | endif() | 692 | endif() |
693 | 693 | ||
694 | if(NOT HAVE_RECALLOCARRAY) | ||
695 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/recallocarray.c) | ||
696 | set(EXTRA_EXPORT ${EXTRA_EXPORT} recallocarray) | ||
697 | endif() | ||
698 | |||
694 | if(NOT HAVE_STRCASECMP) | 699 | if(NOT HAVE_STRCASECMP) |
695 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/strcasecmp.c) | 700 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/strcasecmp.c) |
696 | set(EXTRA_EXPORT ${EXTRA_EXPORT} strcasecmp) | 701 | set(EXTRA_EXPORT ${EXTRA_EXPORT} strcasecmp) |
diff --git a/crypto/Makefile.am b/crypto/Makefile.am index 23aaeac..78f3dd8 100644 --- a/crypto/Makefile.am +++ b/crypto/Makefile.am | |||
@@ -93,6 +93,10 @@ if !HAVE_REALLOCARRAY | |||
93 | libcompat_la_SOURCES += compat/reallocarray.c | 93 | libcompat_la_SOURCES += compat/reallocarray.c |
94 | endif | 94 | endif |
95 | 95 | ||
96 | if !HAVE_RECALLOCARRAY | ||
97 | libcompat_la_SOURCES += compat/recallocarray.c | ||
98 | endif | ||
99 | |||
96 | if !HAVE_TIMINGSAFE_MEMCMP | 100 | if !HAVE_TIMINGSAFE_MEMCMP |
97 | libcompat_la_SOURCES += compat/timingsafe_memcmp.c | 101 | libcompat_la_SOURCES += compat/timingsafe_memcmp.c |
98 | endif | 102 | endif |
diff --git a/include/compat/stdlib.h b/include/compat/stdlib.h index 781be77..11f82ba 100644 --- a/include/compat/stdlib.h +++ b/include/compat/stdlib.h | |||
@@ -29,6 +29,10 @@ uint32_t arc4random_uniform(uint32_t upper_bound); | |||
29 | void *reallocarray(void *, size_t, size_t); | 29 | void *reallocarray(void *, size_t, size_t); |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #ifndef HAVE_RECALLOCARRAY | ||
33 | void *recallocarray(void *, size_t, size_t, size_t); | ||
34 | #endif | ||
35 | |||
32 | #ifndef HAVE_STRTONUM | 36 | #ifndef HAVE_STRTONUM |
33 | long long strtonum(const char *nptr, long long minval, | 37 | long long strtonum(const char *nptr, long long minval, |
34 | long long maxval, const char **errstr); | 38 | long long maxval, const char **errstr); |
diff --git a/m4/check-libc.m4 b/m4/check-libc.m4 index c66364e..22f0b35 100644 --- a/m4/check-libc.m4 +++ b/m4/check-libc.m4 | |||
@@ -3,7 +3,8 @@ AC_DEFUN([CHECK_LIBC_COMPAT], [ | |||
3 | AC_CHECK_HEADERS([err.h readpassphrase.h]) | 3 | AC_CHECK_HEADERS([err.h readpassphrase.h]) |
4 | # Check for general libc functions | 4 | # Check for general libc functions |
5 | AC_CHECK_FUNCS([asprintf inet_ntop inet_pton memmem readpassphrase]) | 5 | AC_CHECK_FUNCS([asprintf inet_ntop inet_pton memmem readpassphrase]) |
6 | AC_CHECK_FUNCS([reallocarray strlcat strlcpy strndup strnlen strsep strtonum]) | 6 | AC_CHECK_FUNCS([reallocarray recallocarray]) |
7 | AC_CHECK_FUNCS([strlcat strlcpy strndup strnlen strsep strtonum]) | ||
7 | AC_CHECK_FUNCS([timegm _mkgmtime]) | 8 | AC_CHECK_FUNCS([timegm _mkgmtime]) |
8 | AM_CONDITIONAL([HAVE_ASPRINTF], [test "x$ac_cv_func_asprintf" = xyes]) | 9 | AM_CONDITIONAL([HAVE_ASPRINTF], [test "x$ac_cv_func_asprintf" = xyes]) |
9 | AM_CONDITIONAL([HAVE_INET_NTOP], [test "x$ac_cv_func_inet_ntop" = xyes]) | 10 | AM_CONDITIONAL([HAVE_INET_NTOP], [test "x$ac_cv_func_inet_ntop" = xyes]) |
@@ -11,6 +12,7 @@ AM_CONDITIONAL([HAVE_INET_PTON], [test "x$ac_cv_func_inet_pton" = xyes]) | |||
11 | AM_CONDITIONAL([HAVE_MEMMEM], [test "x$ac_cv_func_memmem" = xyes]) | 12 | AM_CONDITIONAL([HAVE_MEMMEM], [test "x$ac_cv_func_memmem" = xyes]) |
12 | AM_CONDITIONAL([HAVE_READPASSPHRASE], [test "x$ac_cv_func_readpassphrase" = xyes]) | 13 | AM_CONDITIONAL([HAVE_READPASSPHRASE], [test "x$ac_cv_func_readpassphrase" = xyes]) |
13 | AM_CONDITIONAL([HAVE_REALLOCARRAY], [test "x$ac_cv_func_reallocarray" = xyes]) | 14 | AM_CONDITIONAL([HAVE_REALLOCARRAY], [test "x$ac_cv_func_reallocarray" = xyes]) |
15 | AM_CONDITIONAL([HAVE_RECALLOCARRAY], [test "x$ac_cv_func_recallocarray" = xyes]) | ||
14 | AM_CONDITIONAL([HAVE_STRLCAT], [test "x$ac_cv_func_strlcat" = xyes]) | 16 | AM_CONDITIONAL([HAVE_STRLCAT], [test "x$ac_cv_func_strlcat" = xyes]) |
15 | AM_CONDITIONAL([HAVE_STRLCPY], [test "x$ac_cv_func_strlcpy" = xyes]) | 17 | AM_CONDITIONAL([HAVE_STRLCPY], [test "x$ac_cv_func_strlcpy" = xyes]) |
16 | AM_CONDITIONAL([HAVE_STRNDUP], [test "x$ac_cv_func_strndup" = xyes]) | 18 | AM_CONDITIONAL([HAVE_STRNDUP], [test "x$ac_cv_func_strndup" = xyes]) |
@@ -177,6 +179,9 @@ fi | |||
177 | if test "x$ac_cv_func_reallocarray" = "xno" ; then | 179 | if test "x$ac_cv_func_reallocarray" = "xno" ; then |
178 | echo reallocarray >> $crypto_p_sym | 180 | echo reallocarray >> $crypto_p_sym |
179 | fi | 181 | fi |
182 | if test "x$ac_cv_func_recallocarray" = "xno" ; then | ||
183 | echo recallocarray >> $crypto_p_sym | ||
184 | fi | ||
180 | if test "x$ac_cv_func_strlcat" = "xno" ; then | 185 | if test "x$ac_cv_func_strlcat" = "xno" ; then |
181 | echo strlcat >> $crypto_p_sym | 186 | echo strlcat >> $crypto_p_sym |
182 | fi | 187 | fi |
@@ -78,6 +78,7 @@ for i in crypto/compat libtls-standalone/compat; do | |||
78 | $libc_src/crypt/chacha_private.h \ | 78 | $libc_src/crypt/chacha_private.h \ |
79 | $libc_src/net/inet_pton.c \ | 79 | $libc_src/net/inet_pton.c \ |
80 | $libc_src/stdlib/reallocarray.c \ | 80 | $libc_src/stdlib/reallocarray.c \ |
81 | $libc_src/stdlib/recallocarray.c \ | ||
81 | $libc_src/string/explicit_bzero.c \ | 82 | $libc_src/string/explicit_bzero.c \ |
82 | $libc_src/string/strcasecmp.c \ | 83 | $libc_src/string/strcasecmp.c \ |
83 | $libc_src/string/strlcpy.c \ | 84 | $libc_src/string/strlcpy.c \ |