summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander M Pickering <alex@cogarr.net>2024-12-19 00:44:25 -0600
committerAlexander M Pickering <alex@cogarr.net>2024-12-19 00:44:25 -0600
commita030fd39f012b22705704905c534f4fda4ffdc55 (patch)
treedb60572ceb98ef39008239e4eb4f464bde8b9210
parent18b46d73b800272186d72a604bd50c921ff16bee (diff)
downloadluaossl-packaging-a030fd39f012b22705704905c534f4fda4ffdc55.tar.gz
luaossl-packaging-a030fd39f012b22705704905c534f4fda4ffdc55.tar.bz2
luaossl-packaging-a030fd39f012b22705704905c534f4fda4ffdc55.zip
work
-rwxr-xr-xinit5
-rw-r--r--luaossl-git-0.rockspec46
-rw-r--r--openssl.c.patch46
3 files changed, 55 insertions, 42 deletions
diff --git a/init b/init
index 12517f5..7d3a888 100755
--- a/init
+++ b/init
@@ -1,7 +1,12 @@
1#!/bin/sh -ex 1#!/bin/sh -ex
2 2
3cp luaossl-packaging/luaossl-git-0.rockspec luaossl 3cp luaossl-packaging/luaossl-git-0.rockspec luaossl
4tar -xvzf include.tar.gz
5mkdir lib
6cp libcrypto.a lib
4cd luaossl 7cd luaossl
8git apply /root/luaossl-packaging/openssl.c.patch
9
5luarocks config variables.CFLAGS " $CFLAGS" 10luarocks config variables.CFLAGS " $CFLAGS"
6luarocks make --pack-binary-rock luaossl-git-0.rockspec 11luarocks make --pack-binary-rock luaossl-git-0.rockspec
7obj="luaossl-git.$(luarocks config arch).rock" 12obj="luaossl-git.$(luarocks config arch).rock"
diff --git a/luaossl-git-0.rockspec b/luaossl-git-0.rockspec
index dc740b7..1727cf8 100644
--- a/luaossl-git-0.rockspec
+++ b/luaossl-git-0.rockspec
@@ -24,16 +24,6 @@ external_dependencies = {
24 header = "openssl/crypto.h"; 24 header = "openssl/crypto.h";
25 library = "crypto"; 25 library = "crypto";
26 }; 26 };
27 platforms = {
28 windows = {
29 OPENSSL = {
30 library = "libeay32"
31 };
32 CRYPTO = {
33 library = "ssleay32"
34 };
35 }
36 };
37} 27}
38build = { 28build = {
39 type = "builtin"; 29 type = "builtin";
@@ -87,42 +77,15 @@ build = {
87 ["openssl.x509.verify_param"] = "src/openssl.x509.verify_param.lua"; 77 ["openssl.x509.verify_param"] = "src/openssl.x509.verify_param.lua";
88 }; 78 };
89 platforms = { 79 platforms = {
90 -- Unixy systems need to link with pthreads and libm.
91 -- We also define _GNU_SOURCE in the hope for extra functionality
92 unix = {
93 modules = {
94 ["_openssl"] = {
95 libraries = {
96 nil, nil;
97 "pthread";
98 "m";
99 };
100 defines = {
101 nil, nil, nil;
102 "_GNU_SOURCE";
103 }
104 };
105 };
106 };
107 -- Only linux needs to link with libdl
108 linux = {
109 modules = {
110 ["_openssl"] = {
111 libraries = {
112 nil, nil, nil, nil;
113 "dl";
114 };
115 };
116 };
117 };
118 -- On windows, OpenSSL libraries are named differently 80 -- On windows, OpenSSL libraries are named differently
119 -- We also have to guide autoguess around some incorrect assumptions 81 -- We also have to guide autoguess around some incorrect assumptions
120 win32 = { 82 linux = {
121 modules = { 83 modules = {
122 ["_openssl"] = { 84 ["_openssl"] = {
123 libraries = { 85 libraries = {
124 "libeay32"; 86 nil, nil,
125 "ssleay32"; 87 "pthread";
88 "dl";
126 "ws2_32"; 89 "ws2_32";
127 "advapi32"; 90 "advapi32";
128 "kernel32"; 91 "kernel32";
@@ -130,7 +93,6 @@ build = {
130 defines = { 93 defines = {
131 nil, nil, nil; 94 nil, nil, nil;
132 "HAVE_SYS_PARAM_H=0"; 95 "HAVE_SYS_PARAM_H=0";
133 "HAVE_DLFCN_H=0";
134 -- Need to set version to at least Vista to get inet_pton 96 -- Need to set version to at least Vista to get inet_pton
135 "_WIN32_WINNT=0x0600"; 97 "_WIN32_WINNT=0x0600";
136 }; 98 };
diff --git a/openssl.c.patch b/openssl.c.patch
new file mode 100644
index 0000000..efc28f6
--- /dev/null
+++ b/openssl.c.patch
@@ -0,0 +1,46 @@
1diff --git a/src/openssl.c b/src/openssl.c
2index fd7d28e..5e89f2a 100644
3--- a/src/openssl.c
4+++ b/src/openssl.c
5@@ -40,13 +40,21 @@
6 #include <sys/types.h> /* ssize_t pid_t */
7 #include <sys/time.h> /* struct timeval gettimeofday(2) */
8 #include <sys/stat.h> /* struct stat stat(2) */
9+#ifdef _WIN32_WINNT
10+#include <winsock2.h> /* struct in_addr */
11+#include <windows.h>
12+#include <ws2def.h> /* AF_INET AF_INET6 */
13+#include <in6addr.h> /* struct in6_addr */
14+#include <ws2tcpip.h> /* inet_pton */
15+#else
16 #include <sys/socket.h> /* AF_INET AF_INET6 */
17 #include <sys/resource.h> /* RUSAGE_SELF struct rusage getrusage(2) */
18 #include <sys/utsname.h> /* struct utsname uname(3) */
19-#include <fcntl.h> /* O_RDONLY O_CLOEXEC open(2) */
20-#include <unistd.h> /* close(2) getpid(2) */
21 #include <netinet/in.h> /* struct in_addr struct in6_addr */
22 #include <arpa/inet.h> /* inet_pton(3) */
23+#endif
24+#include <fcntl.h> /* O_RDONLY O_CLOEXEC open(2) */
25+#include <unistd.h> /* close(2) getpid(2) */
26 #include <pthread.h> /* pthread_mutex_init(3) pthread_mutex_lock(3) pthread_mutex_unlock(3) */
27 #include <dlfcn.h> /* dladdr(3) dlopen(3) */
28
29@@ -10082,8 +10090,6 @@ error:;
30 struct {
31 struct timeval tv;
32 pid_t pid;
33- struct rusage ru;
34- struct utsname un;
35 uintptr_t aslr;
36 #if defined __APPLE__
37 uint64_t mt;
38@@ -10094,8 +10100,6 @@ error:;
39
40 gettimeofday(&junk.tv, NULL);
41 junk.pid = getpid();
42- getrusage(RUSAGE_SELF, &junk.ru);
43- uname(&junk.un);
44 junk.aslr = (uintptr_t)&strcpy ^ (uintptr_t)&randL_stir;
45 #if defined __APPLE__
46 junk.mt = mach_absolute_time();