32 DIRS= crypto ssl engines apps test tools |
32 DIRS= crypto ssl engines apps test tools |
33 +endif |
33 +endif |
34 ENGDIRS= ccgost |
34 ENGDIRS= ccgost |
35 SHLIBDIRS= crypto ssl |
35 SHLIBDIRS= crypto ssl |
36 |
36 |
37 --- openssl-1.0.0e/crypto/cryptlib.c 2011-06-22 08:39:00.000000000 -0700 |
37 --- openssl-1.0.0e/crypto/cryptlib.c 2011-06-22 08:39:00.000000000 -0700 |
38 +++ openssl-1.0.0e_patched/crypto/cryptlib.c 2011-12-12 06:17:45.422476900 -0800 |
38 +++ openssl-1.0.0e_patched/crypto/cryptlib.c 2011-12-12 06:17:45.422476900 -0800 |
39 @@ -412,6 +412,7 @@ |
39 @@ -421,11 +421,13 @@ |
40 static void solaris_locking_callback(int mode, int type, const char *file, |
40 static void solaris_locking_callback(int mode, int type, const char *file, |
41 int line) |
41 int line) |
42 { |
42 { |
43 +#ifndef _BOOT |
43 +#ifndef _BOOT |
44 if (mode & CRYPTO_LOCK) |
44 if (mode & CRYPTO_LOCK) { |
45 { |
45 pthread_mutex_lock(&solaris_openssl_locks[type]); |
46 pthread_mutex_lock(&solaris_openssl_locks[type]); |
46 } else { |
47 @@ -420,6 +421,7 @@ |
47 pthread_mutex_unlock(&solaris_openssl_locks[type]); |
48 { |
48 } |
49 pthread_mutex_unlock(&solaris_openssl_locks[type]); |
49 +#endif |
50 } |
50 } |
51 +#endif |
51 |
52 } |
52 |
53 |
53 @@ -435,6 +437,7 @@ |
54 |
54 static struct CRYPTO_dynlock_value * |
55 @@ -453,6 +455,12 @@ |
55 solaris_dynlock_create(const char *file, int line) |
56 } |
56 { |
57 |
57 +#ifndef _BOOT |
58 /* |
58 int ret; |
59 + * pthread_* can't be used in wanboot. |
59 pthread_mutex_t *dynlock; |
60 + * wanboot needs not be thread-safe and mutexes and locking callback |
60 |
61 + * function will not be setup for wanboot. |
61 @@ -447,6 +450,9 @@ |
62 + */ |
62 OPENSSL_assert(ret); |
63 +#ifndef _BOOT |
63 |
64 + /* |
64 return ((struct CRYPTO_dynlock_value *)dynlock); |
65 * Set atfork handler so that child can setup its own mutexes and |
65 +#else |
66 * locking callbacks when it is forked |
66 + return (NULL); |
67 */ |
67 +#endif |
68 @@ -475,7 +483,7 @@ |
68 } |
69 pthread_mutex_init(&solaris_openssl_locks[i], NULL); |
69 |
70 } |
70 static void |
71 locking_callback = solaris_locking_callback; |
71 @@ -453,6 +459,7 @@ |
|
72 solaris_dynlock_lock(int mode, struct CRYPTO_dynlock_valud *dynlock, |
|
73 const char *file, int line) |
|
74 { |
|
75 +#ifndef _BOOT |
|
76 int ret; |
|
77 |
|
78 if (mode & CRYPTO_LOCK) { |
|
79 @@ -462,6 +469,7 @@ |
|
80 } |
|
81 |
|
82 OPENSSL_assert(ret == 0); |
|
83 +#endif |
|
84 } |
|
85 |
|
86 static void |
|
87 @@ -468,9 +476,11 @@ |
|
88 solaris_dynlock_destroy(struct CRYPTO_dynlock_value *dynlock, |
|
89 const char *file, int line) |
|
90 { |
|
91 +#ifndef _BOOT |
|
92 int ret; |
|
93 ret = pthread_mutex_destroy((pthread_mutex_t *)dynlock); |
|
94 OPENSSL_assert(ret); |
|
95 +#endif |
|
96 } |
|
97 |
|
98 |
|
99 @@ -514,6 +524,12 @@ |
|
100 } |
|
101 |
|
102 /* |
|
103 + * pthread_* can't be used in wanboot. |
|
104 + * wanboot needs not be thread-safe and mutexes and locking callback |
|
105 + * function will not be setup for wanboot. |
|
106 + */ |
|
107 +#ifndef _BOOT |
|
108 + /* |
|
109 * Set atfork handler so that child can setup its own mutexes and |
|
110 * locking callbacks when it is forked |
|
111 */ |
|
112 @@ -534,7 +550,7 @@ |
|
113 pthread_mutex_init(&solaris_openssl_locks[i], NULL); |
|
114 } |
|
115 locking_callback = solaris_locking_callback; |
72 - |
116 - |
73 +#endif |
117 +#endif |
74 } |
118 } |
75 |
119 |
76 void CRYPTO_set_locking_callback(void (*func) (int mode, int type, |
120 void CRYPTO_set_locking_callback(void (*func) (int mode, int type, |
77 @@ -1021,6 +1029,12 @@ |
121 @@ -1084,6 +1100,12 @@ |
78 MessageBox(NULL, buf, _T("OpenSSL: FATAL"), MB_OK | MB_ICONSTOP); |
122 MessageBox(NULL, buf, _T("OpenSSL: FATAL"), MB_OK | MB_ICONSTOP); |
79 } |
123 } |
80 #else |
124 #else |
81 +/* |
125 +/* |
82 + * Solaris libsa.a used for WAN boot doesn't provide for vfprintf(). Since |
126 + * Solaris libsa.a used for WAN boot doesn't provide for vfprintf(). Since |
83 + * OPENSSL_showfatal() is not used anywhere else then here we can safely use |
127 + * OPENSSL_showfatal() is not used anywhere else then here we can safely use |
84 + * the code from 0.9.7d version. |
128 + * the code from 0.9.7d version. |
85 + */ |
129 + */ |
86 +#ifndef _BOOT |
130 +#ifndef _BOOT |
87 void OPENSSL_showfatal(const char *fmta, ...) |
131 void OPENSSL_showfatal(const char *fmta, ...) |
88 { |
132 { |
89 va_list ap; |
133 va_list ap; |
90 @@ -1029,6 +1043,7 @@ |
134 @@ -1092,6 +1114,7 @@ |
91 vfprintf(stderr, fmta, ap); |
135 vfprintf(stderr, fmta, ap); |
92 va_end(ap); |
136 va_end(ap); |
93 } |
137 } |
94 +#endif /* _BOOT */ |
138 +#endif /* _BOOT */ |
95 |
139 |
96 int OPENSSL_isservice(void) |
140 int OPENSSL_isservice(void) |
97 { |
141 { |
98 @@ -1038,9 +1053,15 @@ |
142 @@ -1101,9 +1124,15 @@ |
99 |
143 |
100 void OpenSSLDie(const char *file, int line, const char *assertion) |
144 void OpenSSLDie(const char *file, int line, const char *assertion) |
101 { |
145 { |
102 +#ifndef _BOOT |
146 +#ifndef _BOOT |
103 OPENSSL_showfatal |
147 OPENSSL_showfatal |
104 ("%s(%d): OpenSSL internal error, assertion failed: %s\n", file, line, |
148 ("%s(%d): OpenSSL internal error, assertion failed: %s\n", file, line, |
105 assertion); |
149 assertion); |
106 +#else |
150 +#else |
107 + fprintf(stderr, |
151 + fprintf(stderr, |
108 + "%s(%d): OpenSSL internal error, assertion failed: %s\n", |
152 + "%s(%d): OpenSSL internal error, assertion failed: %s\n", |
109 + file,line,assertion); |
153 + file,line,assertion); |
110 +#endif |
154 +#endif |
111 #if !defined(_WIN32) || defined(__CYGWIN__) |
155 #if !defined(_WIN32) || defined(__CYGWIN__) |
112 abort(); |
156 abort(); |
113 #else |
157 #else |
114 --- openssl-1.0.0e/crypto/err/err_all.c 2009-08-09 07:58:05.000000000 -0700 |
158 --- openssl-1.0.0e/crypto/err/err_all.c 2009-08-09 07:58:05.000000000 -0700 |
115 +++ openssl-1.0.0e_patched/crypto/err/err_all.c 2011-12-13 05:22:01.205351400 -0800 |
159 +++ openssl-1.0.0e_patched/crypto/err/err_all.c 2011-12-13 05:22:01.205351400 -0800 |
116 @@ -148,7 +148,9 @@ |
160 @@ -148,7 +148,9 @@ |
117 ERR_load_X509V3_strings(); |
161 ERR_load_X509V3_strings(); |
118 ERR_load_PKCS12_strings(); |
162 ERR_load_PKCS12_strings(); |
119 ERR_load_RAND_strings(); |
163 ERR_load_RAND_strings(); |
120 +#ifndef _BOOT |
164 +#ifndef _BOOT |
121 ERR_load_DSO_strings(); |
165 ERR_load_DSO_strings(); |
122 +#endif /* _BOOT */ |
166 +#endif /* _BOOT */ |
123 ERR_load_TS_strings(); |
167 ERR_load_TS_strings(); |
124 # ifndef OPENSSL_NO_ENGINE |
168 # ifndef OPENSSL_NO_ENGINE |
125 ERR_load_ENGINE_strings(); |
169 ERR_load_ENGINE_strings(); |
126 --- openssl-1.0.0e/crypto/evp/evp_key.c 2010-03-27 12:27:50.000000000 -0700 |
170 --- openssl-1.0.0e/crypto/evp/evp_key.c 2010-03-27 12:27:50.000000000 -0700 |
127 +++ openssl-1.0.0e_patched/crypto/evp/evp_key.c 2011-12-13 05:19:32.956908600 -0800 |
171 +++ openssl-1.0.0e_patched/crypto/evp/evp_key.c 2011-12-13 05:19:32.956908600 -0800 |
128 @@ -83,7 +83,7 @@ |
172 @@ -83,7 +83,7 @@ |
129 else |
173 else |
130 return (prompt_string); |
174 return (prompt_string); |
131 } |
175 } |
132 - |
176 - |
133 +#ifndef _BOOT |
177 +#ifndef _BOOT |
134 /* |
178 /* |
135 * For historical reasons, the standard function for reading passwords is in |
179 * For historical reasons, the standard function for reading passwords is in |
136 * the DES library -- if someone ever wants to disable DES, this function |
180 * the DES library -- if someone ever wants to disable DES, this function |
137 @@ -115,6 +115,7 @@ |
181 @@ -115,6 +115,7 @@ |
138 OPENSSL_cleanse(buff, BUFSIZ); |
182 OPENSSL_cleanse(buff, BUFSIZ); |
139 return ret; |
183 return ret; |
140 } |
184 } |
141 +#endif /* !_BOOT */ |
185 +#endif /* !_BOOT */ |
142 |
186 |
143 int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, |
187 int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, |
144 const unsigned char *salt, const unsigned char *data, |
188 const unsigned char *salt, const unsigned char *data, |
145 --- openssl-1.0.0e/crypto/rand/rand_unix.c 2009-04-06 07:31:36.000000000 -0700 |
189 --- openssl-1.0.0e/crypto/rand/rand_unix.c 2009-04-06 07:31:36.000000000 -0700 |
146 +++ openssl-1.0.0e_patched/crypto/rand/rand_unix.c 2011-12-19 07:28:39.988944800 -0800 |
190 +++ openssl-1.0.0e_patched/crypto/rand/rand_unix.c 2011-12-19 07:28:39.988944800 -0800 |
147 @@ -122,7 +122,11 @@ |
191 @@ -122,7 +122,11 @@ |
148 # include <sys/time.h> |
192 # include <sys/time.h> |
149 # include <sys/times.h> |
193 # include <sys/times.h> |
150 # include <sys/stat.h> |
194 # include <sys/stat.h> |
151 +#ifdef _BOOT |
195 +#ifdef _BOOT |
152 +# include <sys/fcntl.h> |
196 +# include <sys/fcntl.h> |
153 +#else |
197 +#else |
154 # include <fcntl.h> |
198 # include <fcntl.h> |
155 +#endif |
199 +#endif |
156 # include <unistd.h> |
200 # include <unistd.h> |
214 * collecting daemon. |
258 * collecting daemon. |
215 @@ -407,6 +424,7 @@ |
259 @@ -407,6 +424,7 @@ |
216 } |
260 } |
217 # endif |
261 # endif |
218 |
262 |
219 +#ifndef _BOOT |
263 +#ifndef _BOOT |
220 /* put in some default random data, we need more than just this */ |
264 /* put in some default random data, we need more than just this */ |
221 l = curr_pid; |
265 l = curr_pid; |
222 RAND_add(&l, sizeof(l), 0.0); |
266 RAND_add(&l, sizeof(l), 0.0); |
223 @@ -415,6 +433,7 @@ |
267 @@ -415,6 +433,7 @@ |
224 |
268 |
225 l = time(NULL); |
269 l = time(NULL); |
226 RAND_add(&l, sizeof(l), 0.0); |
270 RAND_add(&l, sizeof(l), 0.0); |
227 +#endif /* !_BOOT */ |
271 +#endif /* !_BOOT */ |
228 |
272 |
229 # if defined(OPENSSL_SYS_BEOS) |
273 # if defined(OPENSSL_SYS_BEOS) |
230 { |
274 { |
231 --- openssl-1.0.0e/crypto/rand/randfile.c 2011-03-19 02:44:37.000000000 -0700 |
275 --- openssl-1.0.0e/crypto/rand/randfile.c 2011-03-19 02:44:37.000000000 -0700 |
232 +++ openssl-1.0.0e_patched/crypto/rand/randfile.c 2011-12-13 05:26:51.884824200 -0800 |
276 +++ openssl-1.0.0e_patched/crypto/rand/randfile.c 2011-12-13 05:26:51.884824200 -0800 |
233 @@ -57,9 +57,11 @@ |
277 @@ -57,9 +57,11 @@ |
234 */ |
278 */ |
235 |
279 |
236 /* We need to define this to get macros like S_IFBLK and S_IFCHR */ |
280 /* We need to define this to get macros like S_IFBLK and S_IFCHR */ |
237 +#ifndef _BOOT |
281 +#ifndef _BOOT |
238 #if !defined(OPENSSL_SYS_VXWORKS) |
282 #if !defined(OPENSSL_SYS_VXWORKS) |
239 # define _XOPEN_SOURCE 500 |
283 # define _XOPEN_SOURCE 500 |
240 #endif |
284 #endif |
241 +#endif /* _BOOT */ |
285 +#endif /* _BOOT */ |
242 |
286 |
243 #include <errno.h> |
287 #include <errno.h> |
244 #include <stdio.h> |
288 #include <stdio.h> |
245 @@ -191,6 +193,7 @@ |
289 @@ -191,6 +193,7 @@ |
246 return (ret); |
290 return (ret); |
247 } |
291 } |
248 |
292 |
249 +#ifndef _BOOT |
293 +#ifndef _BOOT |
250 int RAND_write_file(const char *file) |
294 int RAND_write_file(const char *file) |
251 { |
295 { |
252 unsigned char buf[BUFSIZE]; |
296 unsigned char buf[BUFSIZE]; |
253 @@ -335,3 +338,5 @@ |
297 @@ -335,3 +338,5 @@ |
254 #endif |
298 #endif |
255 return (buf); |
299 return (buf); |
256 } |
300 } |
257 + |
301 + |
258 +#endif /* _BOOT */ |
302 +#endif /* _BOOT */ |
259 --- openssl-1.0.0e/crypto/x509v3/v3_utl.c 2009-07-27 14:08:53.000000000 -0700 |
303 --- openssl-1.0.0e/crypto/x509v3/v3_utl.c 2009-07-27 14:08:53.000000000 -0700 |
260 +++ openssl-1.0.0e_patched/crypto/x509v3/v3_utl.c 2011-12-13 05:10:08.844191400 -0800 |
304 +++ openssl-1.0.0e_patched/crypto/x509v3/v3_utl.c 2011-12-13 05:10:08.844191400 -0800 |
261 @@ -715,9 +715,50 @@ |
305 @@ -715,9 +715,50 @@ |
262 } |
306 } |
263 } |
307 } |
264 |
308 |
265 +#if defined(_BOOT) |
309 +#if defined(_BOOT) |
266 +/* This function was copied from bio/b_sock.c */ |
310 +/* This function was copied from bio/b_sock.c */ |
267 +static int get_ip(const char *str, unsigned char ip[4]) |
311 +static int get_ip(const char *str, unsigned char ip[4]) |
268 +{ |
312 +{ |
269 + unsigned int tmp[4]; |
313 + unsigned int tmp[4]; |
270 + int num = 0, c, ok = 0; |
314 + int num = 0, c, ok = 0; |
300 + |
344 + |
301 static int ipv4_from_asc(unsigned char *v4, const char *in) |
345 static int ipv4_from_asc(unsigned char *v4, const char *in) |
302 { |
346 { |
303 int a0, a1, a2, a3; |
347 int a0, a1, a2, a3; |
304 + |
348 + |
305 +#if defined(_BOOT) |
349 +#if defined(_BOOT) |
306 + if (get_ip(in, v4) != 1) |
350 + if (get_ip(in, v4) != 1) |
307 + return 0; |
351 + return 0; |
308 +#else /* _BOOT */ |
352 +#else /* _BOOT */ |
309 if (sscanf(in, "%d.%d.%d.%d", &a0, &a1, &a2, &a3) != 4) |
353 if (sscanf(in, "%d.%d.%d.%d", &a0, &a1, &a2, &a3) != 4) |
310 return 0; |
354 return 0; |
311 if ((a0 < 0) || (a0 > 255) || (a1 < 0) || (a1 > 255) |
355 if ((a0 < 0) || (a0 > 255) || (a1 < 0) || (a1 > 255) |
312 @@ -727,6 +768,7 @@ |
356 @@ -727,6 +768,7 @@ |
313 v4[1] = a1; |
357 v4[1] = a1; |
314 v4[2] = a2; |
358 v4[2] = a2; |
315 v4[3] = a3; |
359 v4[3] = a3; |
316 +#endif /* _BOOT */ |
360 +#endif /* _BOOT */ |
317 return 1; |
361 return 1; |
318 } |
362 } |
319 |
363 |
320 --- openssl-1.0.0e/e_os.h 2011-12-19 04:17:51.631087400 -0800 |
364 --- openssl-1.0.0e/e_os.h 2011-12-19 04:17:51.631087400 -0800 |
321 +++ openssl-1.0.0e_patched/e_os.h 2011-12-19 04:15:15.776668900 -0800 |
365 +++ openssl-1.0.0e_patched/e_os.h 2011-12-19 04:15:15.776668900 -0800 |
322 @@ -213,10 +213,19 @@ |
366 @@ -213,10 +213,19 @@ |
323 # define get_last_socket_error() errno |
367 # define get_last_socket_error() errno |
324 # define clear_socket_error() errno=0 |
368 # define clear_socket_error() errno=0 |
325 # define ioctlsocket(a,b,c) ioctl(a,b,c) |
369 # define ioctlsocket(a,b,c) ioctl(a,b,c) |
326 +#ifdef _BOOT |
370 +#ifdef _BOOT |
327 +#include <netinet/in.h> |
371 +#include <netinet/in.h> |
328 +extern int socket_read(int, void *, size_t, int); |
372 +extern int socket_read(int, void *, size_t, int); |
329 +extern int socket_close(int); |
373 +extern int socket_close(int); |
330 +# define closesocket(s) socket_close(s) |
374 +# define closesocket(s) socket_close(s) |
331 +# define readsocket(s,b,n) socket_read((s),(b),(n), 200) |
375 +# define readsocket(s,b,n) socket_read((s),(b),(n), 200) |