aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorBrent Cook <bcook@openbsd.org>2017-03-16 19:23:36 -0500
committerBrent Cook <bcook@openbsd.org>2017-03-16 19:23:36 -0500
commitd5b247cc4fe0f3dd6cc4f7084af7f290ba41e669 (patch)
treeecff511a1a175c88222a9c83872920d512671717 /crypto
parent8f69fe98dba08e22dd1341cbaad91745c8bf7ad7 (diff)
parentc61c9821e8417243a5a0cf691415f5e5626f2b3b (diff)
downloadportable-d5b247cc4fe0f3dd6cc4f7084af7f290ba41e669.tar.gz
portable-d5b247cc4fe0f3dd6cc4f7084af7f290ba41e669.tar.bz2
portable-d5b247cc4fe0f3dd6cc4f7084af7f290ba41e669.zip
Land #297, Add recallocarray
Diffstat (limited to 'crypto')
-rw-r--r--crypto/CMakeLists.txt9
-rw-r--r--crypto/Makefile.am8
-rw-r--r--crypto/compat/getpagesize.c18
3 files changed, 35 insertions, 0 deletions
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt
index 47f0077..d7b65e2 100644
--- a/crypto/CMakeLists.txt
+++ b/crypto/CMakeLists.txt
@@ -681,6 +681,10 @@ if(NOT HAVE_ASPRINTF)
681 set(EXTRA_EXPORT ${EXTRA_EXPORT} vasprintf) 681 set(EXTRA_EXPORT ${EXTRA_EXPORT} vasprintf)
682endif() 682endif()
683 683
684if(NOT HAVE_GETPAGESIZE)
685 set(CRYPTO_SRC ${CRYPTO_SRC} compat/getpagesize.c)
686endif()
687
684if(NOT HAVE_INET_PTON) 688if(NOT HAVE_INET_PTON)
685 set(CRYPTO_SRC ${CRYPTO_SRC} compat/inet_pton.c) 689 set(CRYPTO_SRC ${CRYPTO_SRC} compat/inet_pton.c)
686 set(EXTRA_EXPORT ${EXTRA_EXPORT} inet_pton) 690 set(EXTRA_EXPORT ${EXTRA_EXPORT} inet_pton)
@@ -691,6 +695,11 @@ if(NOT HAVE_REALLOCARRAY)
691 set(EXTRA_EXPORT ${EXTRA_EXPORT} reallocarray) 695 set(EXTRA_EXPORT ${EXTRA_EXPORT} reallocarray)
692endif() 696endif()
693 697
698if(NOT HAVE_RECALLOCARRAY)
699 set(CRYPTO_SRC ${CRYPTO_SRC} compat/recallocarray.c)
700 set(EXTRA_EXPORT ${EXTRA_EXPORT} recallocarray)
701endif()
702
694if(NOT HAVE_STRCASECMP) 703if(NOT HAVE_STRCASECMP)
695 set(CRYPTO_SRC ${CRYPTO_SRC} compat/strcasecmp.c) 704 set(CRYPTO_SRC ${CRYPTO_SRC} compat/strcasecmp.c)
696 set(EXTRA_EXPORT ${EXTRA_EXPORT} strcasecmp) 705 set(EXTRA_EXPORT ${EXTRA_EXPORT} strcasecmp)
diff --git a/crypto/Makefile.am b/crypto/Makefile.am
index 23aaeac..dc94a8c 100644
--- a/crypto/Makefile.am
+++ b/crypto/Makefile.am
@@ -81,6 +81,10 @@ if !HAVE_ASPRINTF
81libcompat_la_SOURCES += compat/bsd-asprintf.c 81libcompat_la_SOURCES += compat/bsd-asprintf.c
82endif 82endif
83 83
84if !HAVE_GETPAGESIZE
85libcompat_la_SOURCES += compat/getpagesize.c
86endif
87
84if !HAVE_INET_PTON 88if !HAVE_INET_PTON
85libcompat_la_SOURCES += compat/inet_pton.c 89libcompat_la_SOURCES += compat/inet_pton.c
86endif 90endif
@@ -93,6 +97,10 @@ if !HAVE_REALLOCARRAY
93libcompat_la_SOURCES += compat/reallocarray.c 97libcompat_la_SOURCES += compat/reallocarray.c
94endif 98endif
95 99
100if !HAVE_RECALLOCARRAY
101libcompat_la_SOURCES += compat/recallocarray.c
102endif
103
96if !HAVE_TIMINGSAFE_MEMCMP 104if !HAVE_TIMINGSAFE_MEMCMP
97libcompat_la_SOURCES += compat/timingsafe_memcmp.c 105libcompat_la_SOURCES += compat/timingsafe_memcmp.c
98endif 106endif
diff --git a/crypto/compat/getpagesize.c b/crypto/compat/getpagesize.c
new file mode 100644
index 0000000..098efa9
--- /dev/null
+++ b/crypto/compat/getpagesize.c
@@ -0,0 +1,18 @@
1/* $OpenBSD$ */
2
3#include <unistd.h>
4
5#ifdef _MSC_VER
6#include <windows.h>
7#endif
8
9int
10getpagesize(void) {
11#ifdef _MSC_VER
12 SYSTEM_INFO system_info;
13 GetSystemInfo(&system_info);
14 return system_info.dwPageSize;
15#else
16 return sysconf(_SC_PAGESIZE);
17#endif
18}