diff options
| author | Brent Cook <bcook@openbsd.org> | 2017-03-16 19:23:36 -0500 |
|---|---|---|
| committer | Brent Cook <bcook@openbsd.org> | 2017-03-16 19:23:36 -0500 |
| commit | d5b247cc4fe0f3dd6cc4f7084af7f290ba41e669 (patch) | |
| tree | ecff511a1a175c88222a9c83872920d512671717 /crypto | |
| parent | 8f69fe98dba08e22dd1341cbaad91745c8bf7ad7 (diff) | |
| parent | c61c9821e8417243a5a0cf691415f5e5626f2b3b (diff) | |
| download | portable-d5b247cc4fe0f3dd6cc4f7084af7f290ba41e669.tar.gz portable-d5b247cc4fe0f3dd6cc4f7084af7f290ba41e669.tar.bz2 portable-d5b247cc4fe0f3dd6cc4f7084af7f290ba41e669.zip | |
Land #297, Add recallocarray
Diffstat (limited to 'crypto')
| -rw-r--r-- | crypto/CMakeLists.txt | 9 | ||||
| -rw-r--r-- | crypto/Makefile.am | 8 | ||||
| -rw-r--r-- | crypto/compat/getpagesize.c | 18 |
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) |
| 682 | endif() | 682 | endif() |
| 683 | 683 | ||
| 684 | if(NOT HAVE_GETPAGESIZE) | ||
| 685 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/getpagesize.c) | ||
| 686 | endif() | ||
| 687 | |||
| 684 | if(NOT HAVE_INET_PTON) | 688 | if(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) |
| 692 | endif() | 696 | endif() |
| 693 | 697 | ||
| 698 | if(NOT HAVE_RECALLOCARRAY) | ||
| 699 | set(CRYPTO_SRC ${CRYPTO_SRC} compat/recallocarray.c) | ||
| 700 | set(EXTRA_EXPORT ${EXTRA_EXPORT} recallocarray) | ||
| 701 | endif() | ||
| 702 | |||
| 694 | if(NOT HAVE_STRCASECMP) | 703 | if(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 | |||
| 81 | libcompat_la_SOURCES += compat/bsd-asprintf.c | 81 | libcompat_la_SOURCES += compat/bsd-asprintf.c |
| 82 | endif | 82 | endif |
| 83 | 83 | ||
| 84 | if !HAVE_GETPAGESIZE | ||
| 85 | libcompat_la_SOURCES += compat/getpagesize.c | ||
| 86 | endif | ||
| 87 | |||
| 84 | if !HAVE_INET_PTON | 88 | if !HAVE_INET_PTON |
| 85 | libcompat_la_SOURCES += compat/inet_pton.c | 89 | libcompat_la_SOURCES += compat/inet_pton.c |
| 86 | endif | 90 | endif |
| @@ -93,6 +97,10 @@ if !HAVE_REALLOCARRAY | |||
| 93 | libcompat_la_SOURCES += compat/reallocarray.c | 97 | libcompat_la_SOURCES += compat/reallocarray.c |
| 94 | endif | 98 | endif |
| 95 | 99 | ||
| 100 | if !HAVE_RECALLOCARRAY | ||
| 101 | libcompat_la_SOURCES += compat/recallocarray.c | ||
| 102 | endif | ||
| 103 | |||
| 96 | if !HAVE_TIMINGSAFE_MEMCMP | 104 | if !HAVE_TIMINGSAFE_MEMCMP |
| 97 | libcompat_la_SOURCES += compat/timingsafe_memcmp.c | 105 | libcompat_la_SOURCES += compat/timingsafe_memcmp.c |
| 98 | endif | 106 | endif |
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 | |||
| 9 | int | ||
| 10 | getpagesize(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 | } | ||
