aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorBrent Cook <busterb@gmail.com>2019-01-31 09:45:56 -0600
committerBrent Cook <busterb@gmail.com>2019-01-31 13:56:56 -0600
commita6d7ea956290470254e817adb2f6a3fac9397a17 (patch)
treee9880ccf45612c854fd97287969b879c9a47e29d /crypto
parent495a1b631687f6cc1a1e9fe217aa17184a1b4aff (diff)
downloadportable-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.am14
-rw-r--r--crypto/compat/getprogname_linux.c9
-rw-r--r--crypto/compat/getprogname_windows.c13
-rw-r--r--crypto/compat/posix_win.c7
-rw-r--r--crypto/compat/syslog_r.c19
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
92endif 93endif
@@ -162,6 +163,15 @@ if !HAVE_GETPAGESIZE
162libcompat_la_SOURCES += compat/getpagesize.c 163libcompat_la_SOURCES += compat/getpagesize.c
163endif 164endif
164 165
166if !HAVE_GETPROGNAME
167if HOST_LINUX
168libcompat_la_SOURCES += compat/getprogname_linux.c
169endif
170if HOST_WIN
171libcompat_la_SOURCES += compat/getprogname_windows.c
172endif
173endif
174
165if !HAVE_TIMEGM 175if !HAVE_TIMEGM
166libcompat_la_SOURCES += compat/timegm.c 176libcompat_la_SOURCES += compat/timegm.c
167endif 177endif
@@ -174,6 +184,10 @@ if !HAVE_RECALLOCARRAY
174libcompat_la_SOURCES += compat/recallocarray.c 184libcompat_la_SOURCES += compat/recallocarray.c
175endif 185endif
176 186
187if !HAVE_SYSLOG_R
188libcompat_la_SOURCES += compat/syslog_r.c
189endif
190
177if !HAVE_TIMINGSAFE_MEMCMP 191if !HAVE_TIMINGSAFE_MEMCMP
178libcompat_la_SOURCES += compat/timingsafe_memcmp.c 192libcompat_la_SOURCES += compat/timingsafe_memcmp.c
179endif 193endif
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
5const char *
6getprogname(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
5const char *
6getprogname(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
212uid_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
212struct timezone; 219struct timezone;
213int gettimeofday(struct timeval * tp, struct timezone * tzp) 220int 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
3void
4syslog_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
13void
14vsyslog_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}