-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlibressl-2.2.5-patch
218 lines (201 loc) · 5.27 KB
/
libressl-2.2.5-patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
diff --git a/Makefile.am b/Makefile.am
index 0804984..0bda277 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,8 @@
-SUBDIRS = crypto ssl tls include apps tests man
+SUBDIRS = crypto include
ACLOCAL_AMFLAGS = -I m4
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libcrypto.pc libssl.pc libtls.pc openssl.pc
+pkgconfig_DATA = libcrypto.pc
EXTRA_DIST = README.md README.windows VERSION config scripts
EXTRA_DIST += CMakeLists.txt
diff --git a/Makefile.am.common b/Makefile.am.common
index 49019ec..1e5d1f8 100644
--- a/Makefile.am.common
+++ b/Makefile.am.common
@@ -1,2 +1,2 @@
AM_CFLAGS =
-AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/compat -DLIBRESSL_INTERNAL
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/compat -DLIBRESSL_INTERNAL -I$PNACL_ROOT/include/pnacl -I$PNACL_ROOT/usr/include/pnacl -DSSIZE_MAX=LONG_MAX -DNO_SYSLOG
diff --git a/configure.ac b/configure.ac
index 91ae7ce..0cae214 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,11 @@ AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# This must be saved before AC_PROG_CC
-USER_CFLAGS="$CFLAGS"
+#CC=$PNACL_ROOT$PNACL_TOOLCHAIN/bin/pnacl-clang
+#CXX=$PNACL_ROOT$PNACL_TOOLCHAIN/bin/pnacl-clang++
+#LD=$PNACL_ROOT$PNACL_TOOLCHAIN/bin/pnacl-ld
+#AR=$PNACL_ROOT$PNACL_TOOLCHAIN/bin/pnacl-ar
+USER_CFLAGS="-I$PNACL_ROOT/include/pnacl -I$PNACL_ROOT/usr/include/pnacl -DSSIZE_MAX=LONG_MAX -DNO_SYSLOG"
AC_PROG_CC
AC_PROG_CC_STDC
@@ -67,7 +71,7 @@ AC_ARG_ENABLE([extratests],
AM_CONDITIONAL([ENABLE_EXTRATESTS], [test "x$enable_extratests" = xyes])
# Add CPU-specific alignment flags
-old_cflags=$CFLAGS
+old_cflags=$CFLAGS $USER_CFLAGS
CFLAGS="$CFLAGS -I$srcdir/include"
AC_MSG_CHECKING([if BSWAP4 builds without __STRICT_ALIGNMENT])
AC_TRY_COMPILE([#include "$srcdir/crypto/modes/modes_lcl.h"],
@@ -115,15 +119,7 @@ AC_CONFIG_FILES([
include/Makefile
include/openssl/Makefile
crypto/Makefile
- ssl/Makefile
- tls/Makefile
- tests/Makefile
- apps/Makefile
- man/Makefile
libcrypto.pc
- libssl.pc
- libtls.pc
- openssl.pc
])
AC_OUTPUT
diff --git a/crypto/bio/bss_log.c b/crypto/bio/bss_log.c
index c6c8c49..64b25d9 100644
--- a/crypto/bio/bss_log.c
+++ b/crypto/bio/bss_log.c
@@ -65,12 +65,12 @@
#include <errno.h>
#include <stdio.h>
#include <string.h>
-#include <syslog.h>
#include <openssl/buffer.h>
#include <openssl/err.h>
#ifndef NO_SYSLOG
+#include <syslog.h>
static int slg_write(BIO *h, const char *buf, int num);
static int slg_puts(BIO *h, const char *str);
diff --git a/crypto/compat/arc4random.h b/crypto/compat/arc4random.h
index 762aec2..cfe0927 100644
--- a/crypto/compat/arc4random.h
+++ b/crypto/compat/arc4random.h
@@ -1,35 +1,41 @@
#ifndef LIBCRYPTOCOMPAT_ARC4RANDOM_H
#define LIBCRYPTOCOMPAT_ARC4RANDOM_H
-#include <sys/param.h>
-
-#if defined(_AIX)
-#include "arc4random_aix.h"
-
-#elif defined(__FreeBSD__)
-#include "arc4random_freebsd.h"
-
-#elif defined(__hpux)
-#include "arc4random_hpux.h"
-
-#elif defined(__linux__)
-#include "arc4random_linux.h"
-
-#elif defined(__NetBSD__)
-#include "arc4random_netbsd.h"
-
-#elif defined(__APPLE__)
-#include "arc4random_osx.h"
-
-#elif defined(__sun)
-#include "arc4random_solaris.h"
-
-#elif defined(_WIN32)
-#include "arc4random_win.h"
-
-#else
-#error "No arc4random hooks defined for this platform."
-
-#endif
-
+#include <pthread.h>
+
+static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER;
+
+#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx)
+#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx)
+
+
+static inline void _getentropy_fail(void)
+{
+// TerminateProcess(GetCurrentProcess(), 0);
+}
+
+static inline int
+_rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
+{
+ *rsp = calloc(1, sizeof(**rsp));
+ if (*rsp == NULL)
+ return (-1);
+
+ *rsxp = calloc(1, sizeof(**rsxp));
+ if (*rsxp == NULL) {
+ free(*rsp);
+ return (-1);
+ }
+ return (0);
+}
+
+static inline void
+_rs_forkhandler(void)
+{
+}
+
+static inline void
+_rs_forkdetect(void)
+{
+}
#endif
diff --git a/include/compat/arpa/nameser.h b/include/compat/arpa/nameser.h
index 0126a60..03f55da 100644
--- a/include/compat/arpa/nameser.h
+++ b/include/compat/arpa/nameser.h
@@ -3,11 +3,6 @@
* arpa/inet.h compatibility shim
*/
-#ifndef _WIN32
-#include_next <arpa/nameser.h>
-#else
-#include <win32netcompat.h>
-
#ifndef INADDRSZ
#define INADDRSZ 4
#endif
@@ -19,5 +14,3 @@
#ifndef INT16SZ
#define INT16SZ 2
#endif
-
-#endif
diff --git a/include/compat/sys/uio.h b/include/compat/sys/uio.h
index b4aee9e..e2d7fe1 100644
--- a/include/compat/sys/uio.h
+++ b/include/compat/sys/uio.h
@@ -3,9 +3,8 @@
* sys/select.h compatibility shim
*/
-#ifndef _WIN32
-#include_next <sys/uio.h>
-#else
+#ifndef COMPAT_SYS_INFO_H
+#define COMPAT_SYS_INFO_H
#include <sys/types.h>
@@ -14,4 +13,4 @@ struct iovec {
size_t iov_len;
};
-#endif
+#endif
\ No newline at end of file
diff --git a/m4/disable-compiler-warnings.m4 b/m4/disable-compiler-warnings.m4
index 2792722..e928674 100644
--- a/m4/disable-compiler-warnings.m4
+++ b/m4/disable-compiler-warnings.m4
@@ -11,7 +11,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
[CLANG=no]
)
AC_MSG_RESULT([$CLANG])
-AS_IF([test "x$CLANG" = "xyes"], [CLANG_FLAGS=-Qunused-arguments])
CFLAGS="$CFLAGS $CLANG_FLAGS"
LDFLAGS="$LDFLAGS $CLANG_FLAGS"