diff options
| author | Brent Cook <busterb@gmail.com> | 2019-01-31 09:45:56 -0600 |
|---|---|---|
| committer | Brent Cook <busterb@gmail.com> | 2019-01-31 13:56:56 -0600 |
| commit | a6d7ea956290470254e817adb2f6a3fac9397a17 (patch) | |
| tree | e9880ccf45612c854fd97287969b879c9a47e29d /crypto | |
| parent | 495a1b631687f6cc1a1e9fe217aa17184a1b4aff (diff) | |
| download | portable-a6d7ea956290470254e817adb2f6a3fac9397a17.tar.gz portable-a6d7ea956290470254e817adb2f6a3fac9397a17.tar.bz2 portable-a6d7ea956290470254e817adb2f6a3fac9397a17.zip | |
update autoconf for latest compat functions
Diffstat (limited to 'crypto')
| -rw-r--r-- | crypto/Makefile.am | 14 | ||||
| -rw-r--r-- | crypto/compat/getprogname_linux.c | 9 | ||||
| -rw-r--r-- | crypto/compat/getprogname_windows.c | 13 | ||||
| -rw-r--r-- | crypto/compat/posix_win.c | 7 | ||||
| -rw-r--r-- | crypto/compat/syslog_r.c | 19 |
5 files changed, 62 insertions, 0 deletions
diff --git a/crypto/Makefile.am b/crypto/Makefile.am index d2c7431..4bf6b46 100644 --- a/crypto/Makefile.am +++ b/crypto/Makefile.am | |||
| @@ -87,6 +87,7 @@ if HOST_WIN | |||
| 87 | -echo posix_write >> crypto_portable.sym | 87 | -echo posix_write >> crypto_portable.sym |
| 88 | -echo posix_getsockopt >> crypto_portable.sym | 88 | -echo posix_getsockopt >> crypto_portable.sym |
| 89 | -echo posix_setsockopt >> crypto_portable.sym | 89 | -echo posix_setsockopt >> crypto_portable.sym |
| 90 | -echo getuid >> crypto_portable.sym | ||
| 90 | -grep -v BIO_s_log crypto_portable.sym > crypto_portable.sym.tmp | 91 | -grep -v BIO_s_log crypto_portable.sym > crypto_portable.sym.tmp |
| 91 | -mv crypto_portable.sym.tmp crypto_portable.sym | 92 | -mv crypto_portable.sym.tmp crypto_portable.sym |
| 92 | endif | 93 | endif |
| @@ -162,6 +163,15 @@ if !HAVE_GETPAGESIZE | |||
| 162 | libcompat_la_SOURCES += compat/getpagesize.c | 163 | libcompat_la_SOURCES += compat/getpagesize.c |
| 163 | endif | 164 | endif |
| 164 | 165 | ||
| 166 | if !HAVE_GETPROGNAME | ||
| 167 | if HOST_LINUX | ||
| 168 | libcompat_la_SOURCES += compat/getprogname_linux.c | ||
| 169 | endif | ||
| 170 | if HOST_WIN | ||
| 171 | libcompat_la_SOURCES += compat/getprogname_windows.c | ||
| 172 | endif | ||
| 173 | endif | ||
| 174 | |||
| 165 | if !HAVE_TIMEGM | 175 | if !HAVE_TIMEGM |
| 166 | libcompat_la_SOURCES += compat/timegm.c | 176 | libcompat_la_SOURCES += compat/timegm.c |
| 167 | endif | 177 | endif |
| @@ -174,6 +184,10 @@ if !HAVE_RECALLOCARRAY | |||
| 174 | libcompat_la_SOURCES += compat/recallocarray.c | 184 | libcompat_la_SOURCES += compat/recallocarray.c |
| 175 | endif | 185 | endif |
| 176 | 186 | ||
| 187 | if !HAVE_SYSLOG_R | ||
| 188 | libcompat_la_SOURCES += compat/syslog_r.c | ||
| 189 | endif | ||
| 190 | |||
| 177 | if !HAVE_TIMINGSAFE_MEMCMP | 191 | if !HAVE_TIMINGSAFE_MEMCMP |
| 178 | libcompat_la_SOURCES += compat/timingsafe_memcmp.c | 192 | libcompat_la_SOURCES += compat/timingsafe_memcmp.c |
| 179 | endif | 193 | endif |
diff --git a/crypto/compat/getprogname_linux.c b/crypto/compat/getprogname_linux.c new file mode 100644 index 0000000..fefe5ea --- /dev/null +++ b/crypto/compat/getprogname_linux.c | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | #include <stdlib.h> | ||
| 2 | |||
| 3 | #include <errno.h> | ||
| 4 | |||
| 5 | const char * | ||
| 6 | getprogname(void) | ||
| 7 | { | ||
| 8 | return program_invocation_short_name; | ||
| 9 | } | ||
diff --git a/crypto/compat/getprogname_windows.c b/crypto/compat/getprogname_windows.c new file mode 100644 index 0000000..eb04ec0 --- /dev/null +++ b/crypto/compat/getprogname_windows.c | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | #include <stdlib.h> | ||
| 2 | |||
| 3 | #include <windows.h> | ||
| 4 | |||
| 5 | const char * | ||
| 6 | getprogname(void) | ||
| 7 | { | ||
| 8 | static char progname[MAX_PATH + 1]; | ||
| 9 | DWORD length = GetModuleFileName(NULL, progname, sizeof (progname) - 1); | ||
| 10 | if (length < 0) | ||
| 11 | return "?"; | ||
| 12 | return progname; | ||
| 13 | } | ||
diff --git a/crypto/compat/posix_win.c b/crypto/compat/posix_win.c index d6e2dcb..b73f023 100644 --- a/crypto/compat/posix_win.c +++ b/crypto/compat/posix_win.c | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | * BSD socket emulation code for Winsock2 | 4 | * BSD socket emulation code for Winsock2 |
| 5 | * File IO compatibility shims | 5 | * File IO compatibility shims |
| 6 | * Brent Cook <bcook@openbsd.org> | 6 | * Brent Cook <bcook@openbsd.org> |
| 7 | * Kinichiro Inoguchi <inoguchi@openbsd.org> | ||
| 7 | */ | 8 | */ |
| 8 | 9 | ||
| 9 | #define NO_REDEF_POSIX_FUNCTIONS | 10 | #define NO_REDEF_POSIX_FUNCTIONS |
| @@ -208,6 +209,12 @@ posix_setsockopt(int sockfd, int level, int optname, | |||
| 208 | return rc == 0 ? 0 : wsa_errno(WSAGetLastError()); | 209 | return rc == 0 ? 0 : wsa_errno(WSAGetLastError()); |
| 209 | } | 210 | } |
| 210 | 211 | ||
| 212 | uid_t getuid(void) | ||
| 213 | { | ||
| 214 | /* Windows fstat sets 0 as st_uid */ | ||
| 215 | return 0; | ||
| 216 | } | ||
| 217 | |||
| 211 | #ifdef _MSC_VER | 218 | #ifdef _MSC_VER |
| 212 | struct timezone; | 219 | struct timezone; |
| 213 | int gettimeofday(struct timeval * tp, struct timezone * tzp) | 220 | int gettimeofday(struct timeval * tp, struct timezone * tzp) |
diff --git a/crypto/compat/syslog_r.c b/crypto/compat/syslog_r.c new file mode 100644 index 0000000..d68169d --- /dev/null +++ b/crypto/compat/syslog_r.c | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #include <syslog.h> | ||
| 2 | |||
| 3 | void | ||
| 4 | syslog_r(int pri, struct syslog_data *data, const char *fmt, ...) | ||
| 5 | { | ||
| 6 | va_list ap; | ||
| 7 | |||
| 8 | va_start(ap, fmt); | ||
| 9 | vsyslog_r(pri, data, fmt, ap); | ||
| 10 | va_end(ap); | ||
| 11 | } | ||
| 12 | |||
| 13 | void | ||
| 14 | vsyslog_r(int pri, struct syslog_data *data, const char *fmt, va_list ap) | ||
| 15 | { | ||
| 16 | #ifdef HAVE_SYSLOG | ||
| 17 | vsyslog(pri, fmt, ap); | ||
| 18 | #endif | ||
| 19 | } | ||
