diff options
author | William Ahern (william@25thandclement.com) <wahern@aix7.polarhome.com> | 2014-07-18 02:21:21 +0200 |
---|---|---|
committer | William Ahern (william@25thandclement.com) <wahern@aix7.polarhome.com> | 2014-07-18 02:21:21 +0200 |
commit | 9157308b90ea7df405ed9b22f1801f3f70f2e30b (patch) | |
tree | af5ade3770609332d9561a3ca39fb0e12a64f4da | |
parent | f026c11953f5a3b3e7285a08829f5777cfe31331 (diff) | |
download | luaossl-rel-20140718.tar.gz luaossl-rel-20140718.tar.bz2 luaossl-rel-20140718.zip |
patches to build on AIXrel-20140718
-rw-r--r-- | src/GNUmakefile | 6 | ||||
-rw-r--r-- | src/openssl.c | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/GNUmakefile b/src/GNUmakefile index f988855..ee263b0 100644 --- a/src/GNUmakefile +++ b/src/GNUmakefile | |||
@@ -17,7 +17,7 @@ include $(d)/../GNUmakefile | |||
17 | # C O M P I L A T I O N F L A G S | 17 | # C O M P I L A T I O N F L A G S |
18 | # | 18 | # |
19 | OS_$(d) = $(shell $(d)/../mk/vendor.os) | 19 | OS_$(d) = $(shell $(d)/../mk/vendor.os) |
20 | CC_$(d) = $(shell $(d)/../mk/vendor.cc) | 20 | CC_$(d) = $(shell env CC="$(CC) "$(d)/../mk/vendor.cc) |
21 | LUAPATH_$(d) = $(shell env CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(<D)/../mk/lua.path -krxm3 -I$(DESTDIR)$(includedir) -I/usr/include -I/usr/local/include -P$(DESTDIR)$(bindir) -P$(bindir) -L$(DESTDIR)$(libdir) -L$(libdir) -v$(1) $(2)) | 21 | LUAPATH_$(d) = $(shell env CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(<D)/../mk/lua.path -krxm3 -I$(DESTDIR)$(includedir) -I/usr/include -I/usr/local/include -P$(DESTDIR)$(bindir) -P$(bindir) -L$(DESTDIR)$(libdir) -L$(libdir) -v$(1) $(2)) |
22 | 22 | ||
23 | CPPFLAGS_$(d) = $(CPPFLAGS_$(abspath $(@D)/../..)) | 23 | CPPFLAGS_$(d) = $(CPPFLAGS_$(abspath $(@D)/../..)) |
@@ -29,7 +29,7 @@ ifeq ($(CC_$(d)), sunpro) | |||
29 | CPPFLAGS_$(d) += -DOPENSSL_NO_EC | 29 | CPPFLAGS_$(d) += -DOPENSSL_NO_EC |
30 | endif | 30 | endif |
31 | 31 | ||
32 | LDFLAGS_$(d) += -lssl -lcrypto -lpthread | 32 | LDFLAGS_$(d) += -lssl -lcrypto -lpthread -lm |
33 | 33 | ||
34 | # NetBSD, FreeBSD, OpenBSD (and presumably descendants) lack any libdl; | 34 | # NetBSD, FreeBSD, OpenBSD (and presumably descendants) lack any libdl; |
35 | # dlopen, et al are part of libc. | 35 | # dlopen, et al are part of libc. |
@@ -109,7 +109,7 @@ MODS$(1)_$(d) = \ | |||
109 | 109 | ||
110 | $$(DESTDIR)$(2)/_openssl.so: $$(d)/$(1)/openssl.so | 110 | $$(DESTDIR)$(2)/_openssl.so: $$(d)/$(1)/openssl.so |
111 | $$(MKDIR) -p $$(@D) | 111 | $$(MKDIR) -p $$(@D) |
112 | $$(CP) -p $$< $$@ | 112 | $$(CP) -fp $$< $$@ |
113 | 113 | ||
114 | $$(DESTDIR)$(3)/openssl/%.lua: $$(d)/openssl.%.lua | 114 | $$(DESTDIR)$(3)/openssl/%.lua: $$(d)/openssl.%.lua |
115 | $$(LUAC$(1)_$(d)) -p $$< | 115 | $$(LUAC$(1)_$(d)) -p $$< |
diff --git a/src/openssl.c b/src/openssl.c index 76a409e..7985b1f 100644 --- a/src/openssl.c +++ b/src/openssl.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <errno.h> /* errno */ | 36 | #include <errno.h> /* errno */ |
37 | 37 | ||
38 | #include <sys/types.h> /* ssize_t pid_t */ | 38 | #include <sys/types.h> /* ssize_t pid_t */ |
39 | #if !defined __sun | 39 | #if !defined __sun && !defined _AIX |
40 | #include <sys/sysctl.h> /* CTL_KERN KERN_RANDOM RANDOM_UUID KERN_URND KERN_ARND sysctl(2) */ | 40 | #include <sys/sysctl.h> /* CTL_KERN KERN_RANDOM RANDOM_UUID KERN_URND KERN_ARND sysctl(2) */ |
41 | #endif | 41 | #endif |
42 | #include <sys/time.h> /* struct timeval gettimeofday(2) */ | 42 | #include <sys/time.h> /* struct timeval gettimeofday(2) */ |
@@ -4646,7 +4646,7 @@ static int randL_stir(struct randL_state *st, unsigned rqstd) { | |||
4646 | #endif | 4646 | #endif |
4647 | 4647 | ||
4648 | if (count < rqstd) { | 4648 | if (count < rqstd) { |
4649 | #if defined O_CLOEXEC | 4649 | #if defined O_CLOEXEC && (!defined _AIX /* O_CLOEXEC overflows int */) |
4650 | int fd = open("/dev/urandom", O_RDONLY|O_CLOEXEC); | 4650 | int fd = open("/dev/urandom", O_RDONLY|O_CLOEXEC); |
4651 | #else | 4651 | #else |
4652 | int fd = open("/dev/urandom", O_RDONLY); | 4652 | int fd = open("/dev/urandom", O_RDONLY); |
@@ -4938,6 +4938,10 @@ int luaopen__openssl_rand(lua_State *L) { | |||
4938 | * | 4938 | * |
4939 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | 4939 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
4940 | 4940 | ||
4941 | #ifndef HAVE_DLADDR | ||
4942 | #define HAVE_DLADDR (!defined _AIX) | ||
4943 | #endif | ||
4944 | |||
4941 | static struct { | 4945 | static struct { |
4942 | pthread_mutex_t *lock; | 4946 | pthread_mutex_t *lock; |
4943 | int nlock; | 4947 | int nlock; |
@@ -5022,6 +5026,7 @@ static int mt_init(void) { | |||
5022 | * Prevent loader from unlinking us if we've registered a callback | 5026 | * Prevent loader from unlinking us if we've registered a callback |
5023 | * with OpenSSL by taking another reference to ourselves. | 5027 | * with OpenSSL by taking another reference to ourselves. |
5024 | */ | 5028 | */ |
5029 | #if HAVE_DLADDR | ||
5025 | if (bound && !mt_state.dlref) { | 5030 | if (bound && !mt_state.dlref) { |
5026 | Dl_info info; | 5031 | Dl_info info; |
5027 | 5032 | ||
@@ -5035,6 +5040,7 @@ static int mt_init(void) { | |||
5035 | goto leave; | 5040 | goto leave; |
5036 | } | 5041 | } |
5037 | } | 5042 | } |
5043 | #endif | ||
5038 | 5044 | ||
5039 | leave: | 5045 | leave: |
5040 | pthread_mutex_unlock(&mutex); | 5046 | pthread_mutex_unlock(&mutex); |