summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormpi <>2014-04-13 21:11:19 +0000
committermpi <>2014-04-13 21:11:19 +0000
commit3d8036a72e4d1e91fc354eb6336d3459e1ee7c9c (patch)
tree1dfda1f42bb153069c45620d1c4a0e984040d299
parent055493ad24265ed26872a3a87865dd61fa3b713f (diff)
downloadopenbsd-3d8036a72e4d1e91fc354eb6336d3459e1ee7c9c.tar.gz
openbsd-3d8036a72e4d1e91fc354eb6336d3459e1ee7c9c.tar.bz2
openbsd-3d8036a72e4d1e91fc354eb6336d3459e1ee7c9c.zip
Do not include "e_os.h" anymore. Simply pull in the necessary headers.
ok miod@, deraadt@
-rw-r--r--src/lib/libssl/d1_clnt.c2
-rw-r--r--src/lib/libssl/d1_lib.c6
-rw-r--r--src/lib/libssl/d1_pkt.c1
-rw-r--r--src/lib/libssl/d1_srvr.c2
-rw-r--r--src/lib/libssl/s23_clnt.c2
-rw-r--r--src/lib/libssl/s23_lib.c6
-rw-r--r--src/lib/libssl/s23_pkt.c1
-rw-r--r--src/lib/libssl/s23_srvr.c2
-rw-r--r--src/lib/libssl/s3_clnt.c2
-rw-r--r--src/lib/libssl/s3_lib.c4
-rw-r--r--src/lib/libssl/s3_pkt.c4
-rw-r--r--src/lib/libssl/s3_srvr.c2
-rw-r--r--src/lib/libssl/src/ssl/d1_clnt.c2
-rw-r--r--src/lib/libssl/src/ssl/d1_lib.c6
-rw-r--r--src/lib/libssl/src/ssl/d1_pkt.c1
-rw-r--r--src/lib/libssl/src/ssl/d1_srvr.c2
-rw-r--r--src/lib/libssl/src/ssl/s23_clnt.c2
-rw-r--r--src/lib/libssl/src/ssl/s23_lib.c6
-rw-r--r--src/lib/libssl/src/ssl/s23_pkt.c1
-rw-r--r--src/lib/libssl/src/ssl/s23_srvr.c2
-rw-r--r--src/lib/libssl/src/ssl/s2_clnt.c2
-rw-r--r--src/lib/libssl/src/ssl/s2_pkt.c9
-rw-r--r--src/lib/libssl/src/ssl/s2_srvr.c4
-rw-r--r--src/lib/libssl/src/ssl/s3_clnt.c2
-rw-r--r--src/lib/libssl/src/ssl/s3_lib.c4
-rw-r--r--src/lib/libssl/src/ssl/s3_pkt.c4
-rw-r--r--src/lib/libssl/src/ssl/s3_srvr.c2
-rw-r--r--src/lib/libssl/src/ssl/ssl_cert.c12
-rw-r--r--src/lib/libssl/src/ssl/ssl_locl.h8
-rw-r--r--src/lib/libssl/src/ssl/ssl_task.c7
-rw-r--r--src/lib/libssl/src/ssl/ssltest.c28
-rw-r--r--src/lib/libssl/ssl_cert.c12
-rw-r--r--src/lib/libssl/ssl_locl.h8
33 files changed, 89 insertions, 69 deletions
diff --git a/src/lib/libssl/d1_clnt.c b/src/lib/libssl/d1_clnt.c
index 48e5e06bde..eb6ea6c0ec 100644
--- a/src/lib/libssl/d1_clnt.c
+++ b/src/lib/libssl/d1_clnt.c
@@ -158,7 +158,7 @@ int dtls1_connect(SSL *s)
158 158
159 RAND_add(&Time,sizeof(Time),0); 159 RAND_add(&Time,sizeof(Time),0);
160 ERR_clear_error(); 160 ERR_clear_error();
161 clear_sys_error(); 161 errno = 0;
162 162
163 if (s->info_callback != NULL) 163 if (s->info_callback != NULL)
164 cb=s->info_callback; 164 cb=s->info_callback;
diff --git a/src/lib/libssl/d1_lib.c b/src/lib/libssl/d1_lib.c
index 106939f241..7565ce7e36 100644
--- a/src/lib/libssl/d1_lib.c
+++ b/src/lib/libssl/d1_lib.c
@@ -57,8 +57,12 @@
57 * 57 *
58 */ 58 */
59 59
60#include <sys/param.h>
61#include <sys/socket.h>
62
63#include <netinet/in.h>
64
60#include <stdio.h> 65#include <stdio.h>
61#define USE_SOCKETS
62#include <openssl/objects.h> 66#include <openssl/objects.h>
63#include "ssl_locl.h" 67#include "ssl_locl.h"
64 68
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c
index 8186462d4a..52f7fc022f 100644
--- a/src/lib/libssl/d1_pkt.c
+++ b/src/lib/libssl/d1_pkt.c
@@ -115,7 +115,6 @@
115 115
116#include <stdio.h> 116#include <stdio.h>
117#include <errno.h> 117#include <errno.h>
118#define USE_SOCKETS
119#include "ssl_locl.h" 118#include "ssl_locl.h"
120#include <openssl/evp.h> 119#include <openssl/evp.h>
121#include <openssl/buffer.h> 120#include <openssl/buffer.h>
diff --git a/src/lib/libssl/d1_srvr.c b/src/lib/libssl/d1_srvr.c
index 9975e20873..aacf8fd380 100644
--- a/src/lib/libssl/d1_srvr.c
+++ b/src/lib/libssl/d1_srvr.c
@@ -158,7 +158,7 @@ int dtls1_accept(SSL *s)
158 158
159 RAND_add(&Time,sizeof(Time),0); 159 RAND_add(&Time,sizeof(Time),0);
160 ERR_clear_error(); 160 ERR_clear_error();
161 clear_sys_error(); 161 errno = 0;
162 162
163 if (s->info_callback != NULL) 163 if (s->info_callback != NULL)
164 cb=s->info_callback; 164 cb=s->info_callback;
diff --git a/src/lib/libssl/s23_clnt.c b/src/lib/libssl/s23_clnt.c
index 2b93c639dd..6315e9d876 100644
--- a/src/lib/libssl/s23_clnt.c
+++ b/src/lib/libssl/s23_clnt.c
@@ -152,7 +152,7 @@ int ssl23_connect(SSL *s)
152 152
153 RAND_add(&Time,sizeof(Time),0); 153 RAND_add(&Time,sizeof(Time),0);
154 ERR_clear_error(); 154 ERR_clear_error();
155 clear_sys_error(); 155 errno = 0;
156 156
157 if (s->info_callback != NULL) 157 if (s->info_callback != NULL)
158 cb=s->info_callback; 158 cb=s->info_callback;
diff --git a/src/lib/libssl/s23_lib.c b/src/lib/libssl/s23_lib.c
index 3bf728318a..a6285b767f 100644
--- a/src/lib/libssl/s23_lib.c
+++ b/src/lib/libssl/s23_lib.c
@@ -121,7 +121,7 @@ int ssl23_read(SSL *s, void *buf, int len)
121 { 121 {
122 int n; 122 int n;
123 123
124 clear_sys_error(); 124 errno = 0;
125 if (SSL_in_init(s) && (!s->in_handshake)) 125 if (SSL_in_init(s) && (!s->in_handshake))
126 { 126 {
127 n=s->handshake_func(s); 127 n=s->handshake_func(s);
@@ -144,7 +144,7 @@ int ssl23_peek(SSL *s, void *buf, int len)
144 { 144 {
145 int n; 145 int n;
146 146
147 clear_sys_error(); 147 errno = 0;
148 if (SSL_in_init(s) && (!s->in_handshake)) 148 if (SSL_in_init(s) && (!s->in_handshake))
149 { 149 {
150 n=s->handshake_func(s); 150 n=s->handshake_func(s);
@@ -167,7 +167,7 @@ int ssl23_write(SSL *s, const void *buf, int len)
167 { 167 {
168 int n; 168 int n;
169 169
170 clear_sys_error(); 170 errno = 0;
171 if (SSL_in_init(s) && (!s->in_handshake)) 171 if (SSL_in_init(s) && (!s->in_handshake))
172 { 172 {
173 n=s->handshake_func(s); 173 n=s->handshake_func(s);
diff --git a/src/lib/libssl/s23_pkt.c b/src/lib/libssl/s23_pkt.c
index 4ca6a1b258..eba8d9d8fc 100644
--- a/src/lib/libssl/s23_pkt.c
+++ b/src/lib/libssl/s23_pkt.c
@@ -58,7 +58,6 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <errno.h> 60#include <errno.h>
61#define USE_SOCKETS
62#include "ssl_locl.h" 61#include "ssl_locl.h"
63#include <openssl/evp.h> 62#include <openssl/evp.h>
64#include <openssl/buffer.h> 63#include <openssl/buffer.h>
diff --git a/src/lib/libssl/s23_srvr.c b/src/lib/libssl/s23_srvr.c
index 4877849013..2ac8786c62 100644
--- a/src/lib/libssl/s23_srvr.c
+++ b/src/lib/libssl/s23_srvr.c
@@ -154,7 +154,7 @@ int ssl23_accept(SSL *s)
154 154
155 RAND_add(&Time,sizeof(Time),0); 155 RAND_add(&Time,sizeof(Time),0);
156 ERR_clear_error(); 156 ERR_clear_error();
157 clear_sys_error(); 157 errno = 0;
158 158
159 if (s->info_callback != NULL) 159 if (s->info_callback != NULL)
160 cb=s->info_callback; 160 cb=s->info_callback;
diff --git a/src/lib/libssl/s3_clnt.c b/src/lib/libssl/s3_clnt.c
index a6b3c01afa..64e7be8d67 100644
--- a/src/lib/libssl/s3_clnt.c
+++ b/src/lib/libssl/s3_clnt.c
@@ -193,7 +193,7 @@ int ssl3_connect(SSL *s)
193 193
194 RAND_add(&Time,sizeof(Time),0); 194 RAND_add(&Time,sizeof(Time),0);
195 ERR_clear_error(); 195 ERR_clear_error();
196 clear_sys_error(); 196 errno = 0;
197 197
198 if (s->info_callback != NULL) 198 if (s->info_callback != NULL)
199 cb=s->info_callback; 199 cb=s->info_callback;
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c
index 6b2739161d..fd1e7b80d8 100644
--- a/src/lib/libssl/s3_lib.c
+++ b/src/lib/libssl/s3_lib.c
@@ -4167,7 +4167,7 @@ int ssl3_write(SSL *s, const void *buf, int len)
4167 return(0); 4167 return(0);
4168 } 4168 }
4169#endif 4169#endif
4170 clear_sys_error(); 4170 errno = 0;
4171 if (s->s3->renegotiate) ssl3_renegotiate_check(s); 4171 if (s->s3->renegotiate) ssl3_renegotiate_check(s);
4172 4172
4173 /* This is an experimental flag that sends the 4173 /* This is an experimental flag that sends the
@@ -4213,7 +4213,7 @@ static int ssl3_read_internal(SSL *s, void *buf, int len, int peek)
4213 { 4213 {
4214 int ret; 4214 int ret;
4215 4215
4216 clear_sys_error(); 4216 errno = 0;
4217 if (s->s3->renegotiate) ssl3_renegotiate_check(s); 4217 if (s->s3->renegotiate) ssl3_renegotiate_check(s);
4218 s->s3->in_read_app_data=1; 4218 s->s3->in_read_app_data=1;
4219 ret=s->method->ssl_read_bytes(s,SSL3_RT_APPLICATION_DATA,buf,len,peek); 4219 ret=s->method->ssl_read_bytes(s,SSL3_RT_APPLICATION_DATA,buf,len,peek);
diff --git a/src/lib/libssl/s3_pkt.c b/src/lib/libssl/s3_pkt.c
index 96ba63262e..6b55d21a3e 100644
--- a/src/lib/libssl/s3_pkt.c
+++ b/src/lib/libssl/s3_pkt.c
@@ -232,7 +232,7 @@ int ssl3_read_n(SSL *s, int n, int max, int extend)
232 * and need to read in more until we have len+n (up to 232 * and need to read in more until we have len+n (up to
233 * len+max if possible) */ 233 * len+max if possible) */
234 234
235 clear_sys_error(); 235 errno = 0;
236 if (s->rbio != NULL) 236 if (s->rbio != NULL)
237 { 237 {
238 s->rwstate=SSL_READING; 238 s->rwstate=SSL_READING;
@@ -874,7 +874,7 @@ int ssl3_write_pending(SSL *s, int type, const unsigned char *buf,
874 874
875 for (;;) 875 for (;;)
876 { 876 {
877 clear_sys_error(); 877 errno = 0;
878 if (s->wbio != NULL) 878 if (s->wbio != NULL)
879 { 879 {
880 s->rwstate=SSL_WRITING; 880 s->rwstate=SSL_WRITING;
diff --git a/src/lib/libssl/s3_srvr.c b/src/lib/libssl/s3_srvr.c
index 9ac19c05f2..518dfcd5e2 100644
--- a/src/lib/libssl/s3_srvr.c
+++ b/src/lib/libssl/s3_srvr.c
@@ -220,7 +220,7 @@ int ssl3_accept(SSL *s)
220 220
221 RAND_add(&Time,sizeof(Time),0); 221 RAND_add(&Time,sizeof(Time),0);
222 ERR_clear_error(); 222 ERR_clear_error();
223 clear_sys_error(); 223 errno = 0;
224 224
225 if (s->info_callback != NULL) 225 if (s->info_callback != NULL)
226 cb=s->info_callback; 226 cb=s->info_callback;
diff --git a/src/lib/libssl/src/ssl/d1_clnt.c b/src/lib/libssl/src/ssl/d1_clnt.c
index 48e5e06bde..eb6ea6c0ec 100644
--- a/src/lib/libssl/src/ssl/d1_clnt.c
+++ b/src/lib/libssl/src/ssl/d1_clnt.c
@@ -158,7 +158,7 @@ int dtls1_connect(SSL *s)
158 158
159 RAND_add(&Time,sizeof(Time),0); 159 RAND_add(&Time,sizeof(Time),0);
160 ERR_clear_error(); 160 ERR_clear_error();
161 clear_sys_error(); 161 errno = 0;
162 162
163 if (s->info_callback != NULL) 163 if (s->info_callback != NULL)
164 cb=s->info_callback; 164 cb=s->info_callback;
diff --git a/src/lib/libssl/src/ssl/d1_lib.c b/src/lib/libssl/src/ssl/d1_lib.c
index 106939f241..7565ce7e36 100644
--- a/src/lib/libssl/src/ssl/d1_lib.c
+++ b/src/lib/libssl/src/ssl/d1_lib.c
@@ -57,8 +57,12 @@
57 * 57 *
58 */ 58 */
59 59
60#include <sys/param.h>
61#include <sys/socket.h>
62
63#include <netinet/in.h>
64
60#include <stdio.h> 65#include <stdio.h>
61#define USE_SOCKETS
62#include <openssl/objects.h> 66#include <openssl/objects.h>
63#include "ssl_locl.h" 67#include "ssl_locl.h"
64 68
diff --git a/src/lib/libssl/src/ssl/d1_pkt.c b/src/lib/libssl/src/ssl/d1_pkt.c
index 8186462d4a..52f7fc022f 100644
--- a/src/lib/libssl/src/ssl/d1_pkt.c
+++ b/src/lib/libssl/src/ssl/d1_pkt.c
@@ -115,7 +115,6 @@
115 115
116#include <stdio.h> 116#include <stdio.h>
117#include <errno.h> 117#include <errno.h>
118#define USE_SOCKETS
119#include "ssl_locl.h" 118#include "ssl_locl.h"
120#include <openssl/evp.h> 119#include <openssl/evp.h>
121#include <openssl/buffer.h> 120#include <openssl/buffer.h>
diff --git a/src/lib/libssl/src/ssl/d1_srvr.c b/src/lib/libssl/src/ssl/d1_srvr.c
index 9975e20873..aacf8fd380 100644
--- a/src/lib/libssl/src/ssl/d1_srvr.c
+++ b/src/lib/libssl/src/ssl/d1_srvr.c
@@ -158,7 +158,7 @@ int dtls1_accept(SSL *s)
158 158
159 RAND_add(&Time,sizeof(Time),0); 159 RAND_add(&Time,sizeof(Time),0);
160 ERR_clear_error(); 160 ERR_clear_error();
161 clear_sys_error(); 161 errno = 0;
162 162
163 if (s->info_callback != NULL) 163 if (s->info_callback != NULL)
164 cb=s->info_callback; 164 cb=s->info_callback;
diff --git a/src/lib/libssl/src/ssl/s23_clnt.c b/src/lib/libssl/src/ssl/s23_clnt.c
index 2b93c639dd..6315e9d876 100644
--- a/src/lib/libssl/src/ssl/s23_clnt.c
+++ b/src/lib/libssl/src/ssl/s23_clnt.c
@@ -152,7 +152,7 @@ int ssl23_connect(SSL *s)
152 152
153 RAND_add(&Time,sizeof(Time),0); 153 RAND_add(&Time,sizeof(Time),0);
154 ERR_clear_error(); 154 ERR_clear_error();
155 clear_sys_error(); 155 errno = 0;
156 156
157 if (s->info_callback != NULL) 157 if (s->info_callback != NULL)
158 cb=s->info_callback; 158 cb=s->info_callback;
diff --git a/src/lib/libssl/src/ssl/s23_lib.c b/src/lib/libssl/src/ssl/s23_lib.c
index 3bf728318a..a6285b767f 100644
--- a/src/lib/libssl/src/ssl/s23_lib.c
+++ b/src/lib/libssl/src/ssl/s23_lib.c
@@ -121,7 +121,7 @@ int ssl23_read(SSL *s, void *buf, int len)
121 { 121 {
122 int n; 122 int n;
123 123
124 clear_sys_error(); 124 errno = 0;
125 if (SSL_in_init(s) && (!s->in_handshake)) 125 if (SSL_in_init(s) && (!s->in_handshake))
126 { 126 {
127 n=s->handshake_func(s); 127 n=s->handshake_func(s);
@@ -144,7 +144,7 @@ int ssl23_peek(SSL *s, void *buf, int len)
144 { 144 {
145 int n; 145 int n;
146 146
147 clear_sys_error(); 147 errno = 0;
148 if (SSL_in_init(s) && (!s->in_handshake)) 148 if (SSL_in_init(s) && (!s->in_handshake))
149 { 149 {
150 n=s->handshake_func(s); 150 n=s->handshake_func(s);
@@ -167,7 +167,7 @@ int ssl23_write(SSL *s, const void *buf, int len)
167 { 167 {
168 int n; 168 int n;
169 169
170 clear_sys_error(); 170 errno = 0;
171 if (SSL_in_init(s) && (!s->in_handshake)) 171 if (SSL_in_init(s) && (!s->in_handshake))
172 { 172 {
173 n=s->handshake_func(s); 173 n=s->handshake_func(s);
diff --git a/src/lib/libssl/src/ssl/s23_pkt.c b/src/lib/libssl/src/ssl/s23_pkt.c
index 4ca6a1b258..eba8d9d8fc 100644
--- a/src/lib/libssl/src/ssl/s23_pkt.c
+++ b/src/lib/libssl/src/ssl/s23_pkt.c
@@ -58,7 +58,6 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include <errno.h> 60#include <errno.h>
61#define USE_SOCKETS
62#include "ssl_locl.h" 61#include "ssl_locl.h"
63#include <openssl/evp.h> 62#include <openssl/evp.h>
64#include <openssl/buffer.h> 63#include <openssl/buffer.h>
diff --git a/src/lib/libssl/src/ssl/s23_srvr.c b/src/lib/libssl/src/ssl/s23_srvr.c
index 4877849013..2ac8786c62 100644
--- a/src/lib/libssl/src/ssl/s23_srvr.c
+++ b/src/lib/libssl/src/ssl/s23_srvr.c
@@ -154,7 +154,7 @@ int ssl23_accept(SSL *s)
154 154
155 RAND_add(&Time,sizeof(Time),0); 155 RAND_add(&Time,sizeof(Time),0);
156 ERR_clear_error(); 156 ERR_clear_error();
157 clear_sys_error(); 157 errno = 0;
158 158
159 if (s->info_callback != NULL) 159 if (s->info_callback != NULL)
160 cb=s->info_callback; 160 cb=s->info_callback;
diff --git a/src/lib/libssl/src/ssl/s2_clnt.c b/src/lib/libssl/src/ssl/s2_clnt.c
index 03b6cf9673..15fbef9c77 100644
--- a/src/lib/libssl/src/ssl/s2_clnt.c
+++ b/src/lib/libssl/src/ssl/s2_clnt.c
@@ -152,7 +152,7 @@ int ssl2_connect(SSL *s)
152 152
153 RAND_add(&l,sizeof(l),0); 153 RAND_add(&l,sizeof(l),0);
154 ERR_clear_error(); 154 ERR_clear_error();
155 clear_sys_error(); 155 errno = 0;
156 156
157 if (s->info_callback != NULL) 157 if (s->info_callback != NULL)
158 cb=s->info_callback; 158 cb=s->info_callback;
diff --git a/src/lib/libssl/src/ssl/s2_pkt.c b/src/lib/libssl/src/ssl/s2_pkt.c
index 8bb6ab8baa..7efad40153 100644
--- a/src/lib/libssl/src/ssl/s2_pkt.c
+++ b/src/lib/libssl/src/ssl/s2_pkt.c
@@ -113,7 +113,6 @@
113#ifndef OPENSSL_NO_SSL2 113#ifndef OPENSSL_NO_SSL2
114#include <stdio.h> 114#include <stdio.h>
115#include <errno.h> 115#include <errno.h>
116#define USE_SOCKETS
117 116
118static int read_n(SSL *s,unsigned int n,unsigned int max,unsigned int extend); 117static int read_n(SSL *s,unsigned int n,unsigned int max,unsigned int extend);
119static int n_do_ssl_write(SSL *s, const unsigned char *buf, unsigned int len); 118static int n_do_ssl_write(SSL *s, const unsigned char *buf, unsigned int len);
@@ -144,7 +143,7 @@ static int ssl2_read_internal(SSL *s, void *buf, int len, int peek)
144 } 143 }
145 } 144 }
146 145
147 clear_sys_error(); 146 errno = 0;
148 s->rwstate=SSL_NOTHING; 147 s->rwstate=SSL_NOTHING;
149 if (len <= 0) return(len); 148 if (len <= 0) return(len);
150 149
@@ -372,7 +371,7 @@ static int read_n(SSL *s, unsigned int n, unsigned int max,
372 s->packet=s->s2->rbuf; 371 s->packet=s->s2->rbuf;
373 while (newb < (int)n) 372 while (newb < (int)n)
374 { 373 {
375 clear_sys_error(); 374 errno = 0;
376 if (s->rbio != NULL) 375 if (s->rbio != NULL)
377 { 376 {
378 s->rwstate=SSL_READING; 377 s->rwstate=SSL_READING;
@@ -438,7 +437,7 @@ int ssl2_write(SSL *s, const void *_buf, int len)
438 return(-1); 437 return(-1);
439 } 438 }
440 439
441 clear_sys_error(); 440 errno = 0;
442 s->rwstate=SSL_NOTHING; 441 s->rwstate=SSL_NOTHING;
443 if (len <= 0) return(len); 442 if (len <= 0) return(len);
444 443
@@ -483,7 +482,7 @@ static int write_pending(SSL *s, const unsigned char *buf, unsigned int len)
483 482
484 for (;;) 483 for (;;)
485 { 484 {
486 clear_sys_error(); 485 errno = 0;
487 if (s->wbio != NULL) 486 if (s->wbio != NULL)
488 { 487 {
489 s->rwstate=SSL_WRITING; 488 s->rwstate=SSL_WRITING;
diff --git a/src/lib/libssl/src/ssl/s2_srvr.c b/src/lib/libssl/src/ssl/s2_srvr.c
index 2cba426bb7..cac405db7c 100644
--- a/src/lib/libssl/src/ssl/s2_srvr.c
+++ b/src/lib/libssl/src/ssl/s2_srvr.c
@@ -153,7 +153,7 @@ int ssl2_accept(SSL *s)
153 153
154 RAND_add(&l,sizeof(l),0); 154 RAND_add(&l,sizeof(l),0);
155 ERR_clear_error(); 155 ERR_clear_error();
156 clear_sys_error(); 156 errno = 0;
157 157
158 if (s->info_callback != NULL) 158 if (s->info_callback != NULL)
159 cb=s->info_callback; 159 cb=s->info_callback;
@@ -170,7 +170,7 @@ int ssl2_accept(SSL *s)
170 return(-1); 170 return(-1);
171 } 171 }
172 172
173 clear_sys_error(); 173 errno = 0;
174 for (;;) 174 for (;;)
175 { 175 {
176 state=s->state; 176 state=s->state;
diff --git a/src/lib/libssl/src/ssl/s3_clnt.c b/src/lib/libssl/src/ssl/s3_clnt.c
index a6b3c01afa..64e7be8d67 100644
--- a/src/lib/libssl/src/ssl/s3_clnt.c
+++ b/src/lib/libssl/src/ssl/s3_clnt.c
@@ -193,7 +193,7 @@ int ssl3_connect(SSL *s)
193 193
194 RAND_add(&Time,sizeof(Time),0); 194 RAND_add(&Time,sizeof(Time),0);
195 ERR_clear_error(); 195 ERR_clear_error();
196 clear_sys_error(); 196 errno = 0;
197 197
198 if (s->info_callback != NULL) 198 if (s->info_callback != NULL)
199 cb=s->info_callback; 199 cb=s->info_callback;
diff --git a/src/lib/libssl/src/ssl/s3_lib.c b/src/lib/libssl/src/ssl/s3_lib.c
index 6b2739161d..fd1e7b80d8 100644
--- a/src/lib/libssl/src/ssl/s3_lib.c
+++ b/src/lib/libssl/src/ssl/s3_lib.c
@@ -4167,7 +4167,7 @@ int ssl3_write(SSL *s, const void *buf, int len)
4167 return(0); 4167 return(0);
4168 } 4168 }
4169#endif 4169#endif
4170 clear_sys_error(); 4170 errno = 0;
4171 if (s->s3->renegotiate) ssl3_renegotiate_check(s); 4171 if (s->s3->renegotiate) ssl3_renegotiate_check(s);
4172 4172
4173 /* This is an experimental flag that sends the 4173 /* This is an experimental flag that sends the
@@ -4213,7 +4213,7 @@ static int ssl3_read_internal(SSL *s, void *buf, int len, int peek)
4213 { 4213 {
4214 int ret; 4214 int ret;
4215 4215
4216 clear_sys_error(); 4216 errno = 0;
4217 if (s->s3->renegotiate) ssl3_renegotiate_check(s); 4217 if (s->s3->renegotiate) ssl3_renegotiate_check(s);
4218 s->s3->in_read_app_data=1; 4218 s->s3->in_read_app_data=1;
4219 ret=s->method->ssl_read_bytes(s,SSL3_RT_APPLICATION_DATA,buf,len,peek); 4219 ret=s->method->ssl_read_bytes(s,SSL3_RT_APPLICATION_DATA,buf,len,peek);
diff --git a/src/lib/libssl/src/ssl/s3_pkt.c b/src/lib/libssl/src/ssl/s3_pkt.c
index 96ba63262e..6b55d21a3e 100644
--- a/src/lib/libssl/src/ssl/s3_pkt.c
+++ b/src/lib/libssl/src/ssl/s3_pkt.c
@@ -232,7 +232,7 @@ int ssl3_read_n(SSL *s, int n, int max, int extend)
232 * and need to read in more until we have len+n (up to 232 * and need to read in more until we have len+n (up to
233 * len+max if possible) */ 233 * len+max if possible) */
234 234
235 clear_sys_error(); 235 errno = 0;
236 if (s->rbio != NULL) 236 if (s->rbio != NULL)
237 { 237 {
238 s->rwstate=SSL_READING; 238 s->rwstate=SSL_READING;
@@ -874,7 +874,7 @@ int ssl3_write_pending(SSL *s, int type, const unsigned char *buf,
874 874
875 for (;;) 875 for (;;)
876 { 876 {
877 clear_sys_error(); 877 errno = 0;
878 if (s->wbio != NULL) 878 if (s->wbio != NULL)
879 { 879 {
880 s->rwstate=SSL_WRITING; 880 s->rwstate=SSL_WRITING;
diff --git a/src/lib/libssl/src/ssl/s3_srvr.c b/src/lib/libssl/src/ssl/s3_srvr.c
index 9ac19c05f2..518dfcd5e2 100644
--- a/src/lib/libssl/src/ssl/s3_srvr.c
+++ b/src/lib/libssl/src/ssl/s3_srvr.c
@@ -220,7 +220,7 @@ int ssl3_accept(SSL *s)
220 220
221 RAND_add(&Time,sizeof(Time),0); 221 RAND_add(&Time,sizeof(Time),0);
222 ERR_clear_error(); 222 ERR_clear_error();
223 clear_sys_error(); 223 errno = 0;
224 224
225 if (s->info_callback != NULL) 225 if (s->info_callback != NULL)
226 cb=s->info_callback; 226 cb=s->info_callback;
diff --git a/src/lib/libssl/src/ssl/ssl_cert.c b/src/lib/libssl/src/ssl/ssl_cert.c
index 5123a89182..6d144077f9 100644
--- a/src/lib/libssl/src/ssl/ssl_cert.c
+++ b/src/lib/libssl/src/ssl/ssl_cert.c
@@ -114,13 +114,13 @@
114 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. 114 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
115 */ 115 */
116 116
117#include <stdio.h> 117#include <sys/types.h>
118 118
119#include "e_os.h" 119#include <stdio.h>
120#ifndef NO_SYS_TYPES_H 120#include <unistd.h>
121# include <sys/types.h>
122#endif
123 121
122#include <openssl/opensslconf.h>
123#include <openssl/e_os2.h>
124#include "o_dir.h" 124#include "o_dir.h"
125#include <openssl/objects.h> 125#include <openssl/objects.h>
126#include <openssl/bio.h> 126#include <openssl/bio.h>
@@ -837,7 +837,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
837 837
838 if (errno) 838 if (errno)
839 { 839 {
840 SYSerr(SYS_F_OPENDIR, get_last_sys_error()); 840 SYSerr(SYS_F_OPENDIR, errno);
841 ERR_add_error_data(3, "OPENSSL_DIR_read(&ctx, '", dir, "')"); 841 ERR_add_error_data(3, "OPENSSL_DIR_read(&ctx, '", dir, "')");
842 SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB); 842 SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB);
843 goto err; 843 goto err;
diff --git a/src/lib/libssl/src/ssl/ssl_locl.h b/src/lib/libssl/src/ssl/ssl_locl.h
index e485907748..e7fecbc3cb 100644
--- a/src/lib/libssl/src/ssl/ssl_locl.h
+++ b/src/lib/libssl/src/ssl/ssl_locl.h
@@ -142,13 +142,17 @@
142 142
143#ifndef HEADER_SSL_LOCL_H 143#ifndef HEADER_SSL_LOCL_H
144#define HEADER_SSL_LOCL_H 144#define HEADER_SSL_LOCL_H
145
146#include <sys/types.h>
147
145#include <stdlib.h> 148#include <stdlib.h>
146#include <time.h> 149#include <time.h>
147#include <string.h> 150#include <string.h>
148#include <errno.h> 151#include <errno.h>
152#include <unistd.h>
149 153
150#include "e_os.h" 154#include <openssl/opensslconf.h>
151 155#include <openssl/e_os2.h>
152#include <openssl/buffer.h> 156#include <openssl/buffer.h>
153#ifndef OPENSSL_NO_COMP 157#ifndef OPENSSL_NO_COMP
154#include <openssl/comp.h> 158#include <openssl/comp.h>
diff --git a/src/lib/libssl/src/ssl/ssl_task.c b/src/lib/libssl/src/ssl/ssl_task.c
index 416fb16743..366204f097 100644
--- a/src/lib/libssl/src/ssl/ssl_task.c
+++ b/src/lib/libssl/src/ssl/ssl_task.c
@@ -114,6 +114,8 @@
114 * Author: Dave Jones 114 * Author: Dave Jones
115 * Date: 22-JUL-1996 115 * Date: 22-JUL-1996
116 */ 116 */
117#include <sys/types.h>
118
117#include <stdlib.h> 119#include <stdlib.h>
118#include <stdio.h> 120#include <stdio.h>
119#include <iodef.h> /* VMS IO$_ definitions */ 121#include <iodef.h> /* VMS IO$_ definitions */
@@ -123,9 +125,10 @@ int LIB$INIT_TIMER(), LIB$SHOW_TIMER();
123 125
124#include <string.h> /* from ssltest.c */ 126#include <string.h> /* from ssltest.c */
125#include <errno.h> 127#include <errno.h>
128#include <unistd.h>
126 129
127#include "e_os.h" 130#include <openssl/opensslconf.h>
128 131#include <openssl/e_os2.h>
129#include <openssl/buffer.h> 132#include <openssl/buffer.h>
130#include <openssl/x509.h> 133#include <openssl/x509.h>
131#include <openssl/ssl.h> 134#include <openssl/ssl.h>
diff --git a/src/lib/libssl/src/ssl/ssltest.c b/src/lib/libssl/src/ssl/ssltest.c
index 8a602cc551..1e285a5c52 100644
--- a/src/lib/libssl/src/ssl/ssltest.c
+++ b/src/lib/libssl/src/ssl/ssltest.c
@@ -142,17 +142,21 @@
142 142
143#define _BSD_SOURCE 1 /* Or gethostname won't be declared properly 143#define _BSD_SOURCE 1 /* Or gethostname won't be declared properly
144 on Linux and GNU platforms. */ 144 on Linux and GNU platforms. */
145#include <sys/types.h>
146#include <sys/param.h>
147#include <sys/socket.h>
148
149#include <netinet/in.h>
145 150
146#include <assert.h> 151#include <assert.h>
147#include <errno.h> 152#include <errno.h>
148#include <limits.h> 153#include <limits.h>
154#include <netdb.h>
149#include <stdio.h> 155#include <stdio.h>
150#include <stdlib.h> 156#include <stdlib.h>
151#include <string.h> 157#include <string.h>
152#include <time.h> 158#include <time.h>
153 159#include <unistd.h>
154#define USE_SOCKETS
155#include "e_os.h"
156 160
157#ifdef OPENSSL_SYS_VMS 161#ifdef OPENSSL_SYS_VMS
158#define _XOPEN_SOURCE 500 /* Or isascii won't be declared properly on 162#define _XOPEN_SOURCE 500 /* Or isascii won't be declared properly on
@@ -161,6 +165,8 @@
161 165
162#include <ctype.h> 166#include <ctype.h>
163 167
168#include <openssl/opensslconf.h>
169#include <openssl/e_os2.h>
164#include <openssl/bio.h> 170#include <openssl/bio.h>
165#include <openssl/crypto.h> 171#include <openssl/crypto.h>
166#include <openssl/evp.h> 172#include <openssl/evp.h>
@@ -586,7 +592,7 @@ int main(int argc, char *argv[])
586 fips_mode=1; 592 fips_mode=1;
587#else 593#else
588 fprintf(stderr,"not compiled with FIPS support, so exitting without running.\n"); 594 fprintf(stderr,"not compiled with FIPS support, so exitting without running.\n");
589 EXIT(0); 595 exit(0);
590#endif 596#endif
591 } 597 }
592 else if (strcmp(*argv,"-server_auth") == 0) 598 else if (strcmp(*argv,"-server_auth") == 0)
@@ -785,7 +791,7 @@ bad:
785 { 791 {
786 /* ensure that the cipher list are correctly sorted and exit */ 792 /* ensure that the cipher list are correctly sorted and exit */
787 if (do_test_cipherlist() == 0) 793 if (do_test_cipherlist() == 0)
788 EXIT(1); 794 exit(1);
789 ret = 0; 795 ret = 0;
790 goto end; 796 goto end;
791 } 797 }
@@ -796,7 +802,7 @@ bad:
796 "the test anyway (and\n-d to see what happens), " 802 "the test anyway (and\n-d to see what happens), "
797 "or add one of -ssl2, -ssl3, -tls1, -reuse\n" 803 "or add one of -ssl2, -ssl3, -tls1, -reuse\n"
798 "to avoid protocol mismatch.\n"); 804 "to avoid protocol mismatch.\n");
799 EXIT(1); 805 exit(1);
800 } 806 }
801 807
802#ifdef OPENSSL_FIPS 808#ifdef OPENSSL_FIPS
@@ -806,7 +812,7 @@ bad:
806 { 812 {
807 ERR_load_crypto_strings(); 813 ERR_load_crypto_strings();
808 ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE)); 814 ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
809 EXIT(1); 815 exit(1);
810 } 816 }
811 else 817 else
812 fprintf(stderr,"*** IN FIPS MODE ***\n"); 818 fprintf(stderr,"*** IN FIPS MODE ***\n");
@@ -1150,7 +1156,7 @@ end:
1150 EVP_cleanup(); 1156 EVP_cleanup();
1151 CRYPTO_mem_leaks(bio_err); 1157 CRYPTO_mem_leaks(bio_err);
1152 if (bio_err != NULL) BIO_free(bio_err); 1158 if (bio_err != NULL) BIO_free(bio_err);
1153 EXIT(ret); 1159 exit(ret);
1154 return ret; 1160 return ret;
1155 } 1161 }
1156 1162
@@ -2144,7 +2150,7 @@ static int process_proxy_cond_multipliers(unsigned int letters[26],
2144 default: 2150 default:
2145 fprintf(stderr, "SOMETHING IS SERIOUSLY WRONG!" 2151 fprintf(stderr, "SOMETHING IS SERIOUSLY WRONG!"
2146 " STOPPING\n"); 2152 " STOPPING\n");
2147 EXIT(1); 2153 exit(1);
2148 } 2154 }
2149 } 2155 }
2150 break; 2156 break;
@@ -2207,7 +2213,7 @@ static int process_proxy_cond_adders(unsigned int letters[26],
2207 default: 2213 default:
2208 fprintf(stderr, "SOMETHING IS SERIOUSLY WRONG!" 2214 fprintf(stderr, "SOMETHING IS SERIOUSLY WRONG!"
2209 " STOPPING\n"); 2215 " STOPPING\n");
2210 EXIT(1); 2216 exit(1);
2211 } 2217 }
2212 } 2218 }
2213 break; 2219 break;
@@ -2306,7 +2312,7 @@ static int app_verify_callback(X509_STORE_CTX *ctx, void *arg)
2306 cb_arg->proxy_cond, &cond_end); 2312 cb_arg->proxy_cond, &cond_end);
2307 2313
2308 if (ok < 0) 2314 if (ok < 0)
2309 EXIT(3); 2315 exit(3);
2310 if (*cond_end) 2316 if (*cond_end)
2311 { 2317 {
2312 fprintf(stderr, "Stopped processing condition before it's end.\n"); 2318 fprintf(stderr, "Stopped processing condition before it's end.\n");
diff --git a/src/lib/libssl/ssl_cert.c b/src/lib/libssl/ssl_cert.c
index 5123a89182..6d144077f9 100644
--- a/src/lib/libssl/ssl_cert.c
+++ b/src/lib/libssl/ssl_cert.c
@@ -114,13 +114,13 @@
114 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. 114 * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
115 */ 115 */
116 116
117#include <stdio.h> 117#include <sys/types.h>
118 118
119#include "e_os.h" 119#include <stdio.h>
120#ifndef NO_SYS_TYPES_H 120#include <unistd.h>
121# include <sys/types.h>
122#endif
123 121
122#include <openssl/opensslconf.h>
123#include <openssl/e_os2.h>
124#include "o_dir.h" 124#include "o_dir.h"
125#include <openssl/objects.h> 125#include <openssl/objects.h>
126#include <openssl/bio.h> 126#include <openssl/bio.h>
@@ -837,7 +837,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
837 837
838 if (errno) 838 if (errno)
839 { 839 {
840 SYSerr(SYS_F_OPENDIR, get_last_sys_error()); 840 SYSerr(SYS_F_OPENDIR, errno);
841 ERR_add_error_data(3, "OPENSSL_DIR_read(&ctx, '", dir, "')"); 841 ERR_add_error_data(3, "OPENSSL_DIR_read(&ctx, '", dir, "')");
842 SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB); 842 SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB);
843 goto err; 843 goto err;
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h
index e485907748..e7fecbc3cb 100644
--- a/src/lib/libssl/ssl_locl.h
+++ b/src/lib/libssl/ssl_locl.h
@@ -142,13 +142,17 @@
142 142
143#ifndef HEADER_SSL_LOCL_H 143#ifndef HEADER_SSL_LOCL_H
144#define HEADER_SSL_LOCL_H 144#define HEADER_SSL_LOCL_H
145
146#include <sys/types.h>
147
145#include <stdlib.h> 148#include <stdlib.h>
146#include <time.h> 149#include <time.h>
147#include <string.h> 150#include <string.h>
148#include <errno.h> 151#include <errno.h>
152#include <unistd.h>
149 153
150#include "e_os.h" 154#include <openssl/opensslconf.h>
151 155#include <openssl/e_os2.h>
152#include <openssl/buffer.h> 156#include <openssl/buffer.h>
153#ifndef OPENSSL_NO_COMP 157#ifndef OPENSSL_NO_COMP
154#include <openssl/comp.h> 158#include <openssl/comp.h>