diff options
Diffstat (limited to 'src/lib/libcrypto/bio')
-rw-r--r-- | src/lib/libcrypto/bio/b_sock.c | 34 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bf_buff.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bf_lbuf.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio_err.c | 36 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio_lib.c | 24 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_acpt.c | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_bio.c | 24 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_conn.c | 30 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_file.c | 18 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_mem.c | 8 |
10 files changed, 75 insertions, 115 deletions
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index db8a30538c..0cc570b66f 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: b_sock.c,v 1.62 2016/12/20 23:14:37 beck Exp $ */ | 1 | /* $OpenBSD: b_sock.c,v 1.63 2017/01/29 17:49:22 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -89,13 +89,12 @@ BIO_get_host_ip(const char *str, unsigned char *ip) | |||
89 | CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); | 89 | CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); |
90 | he = BIO_gethostbyname(str); | 90 | he = BIO_gethostbyname(str); |
91 | if (he == NULL) { | 91 | if (he == NULL) { |
92 | BIOerr(BIO_F_BIO_GET_HOST_IP, BIO_R_BAD_HOSTNAME_LOOKUP); | 92 | BIOerror(BIO_R_BAD_HOSTNAME_LOOKUP); |
93 | goto err; | 93 | goto err; |
94 | } | 94 | } |
95 | 95 | ||
96 | if (he->h_addrtype != AF_INET) { | 96 | if (he->h_addrtype != AF_INET) { |
97 | BIOerr(BIO_F_BIO_GET_HOST_IP, | 97 | BIOerror(BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET); |
98 | BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET); | ||
99 | goto err; | 98 | goto err; |
100 | } | 99 | } |
101 | for (i = 0; i < 4; i++) | 100 | for (i = 0; i < 4; i++) |
@@ -123,7 +122,7 @@ BIO_get_port(const char *str, unsigned short *port_ptr) | |||
123 | int error; | 122 | int error; |
124 | 123 | ||
125 | if (str == NULL) { | 124 | if (str == NULL) { |
126 | BIOerr(BIO_F_BIO_GET_PORT, BIO_R_NO_PORT_SPECIFIED); | 125 | BIOerror(BIO_R_NO_PORT_SPECIFIED); |
127 | return (0); | 126 | return (0); |
128 | } | 127 | } |
129 | 128 | ||
@@ -162,7 +161,7 @@ BIO_socket_ioctl(int fd, long type, void *arg) | |||
162 | 161 | ||
163 | ret = ioctl(fd, type, arg); | 162 | ret = ioctl(fd, type, arg); |
164 | if (ret < 0) | 163 | if (ret < 0) |
165 | SYSerr(SYS_F_IOCTLSOCKET, errno); | 164 | SYSerror(errno); |
166 | return (ret); | 165 | return (ret); |
167 | } | 166 | } |
168 | 167 | ||
@@ -258,10 +257,9 @@ BIO_get_accept_socket(char *host, int bind_mode) | |||
258 | again: | 257 | again: |
259 | s = socket(server.sa.sa_family, SOCK_STREAM, IPPROTO_TCP); | 258 | s = socket(server.sa.sa_family, SOCK_STREAM, IPPROTO_TCP); |
260 | if (s == -1) { | 259 | if (s == -1) { |
261 | SYSerr(SYS_F_SOCKET, errno); | 260 | SYSerror(errno); |
262 | ERR_asprintf_error_data("port='%s'", host); | 261 | ERR_asprintf_error_data("port='%s'", host); |
263 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, | 262 | BIOerror(BIO_R_UNABLE_TO_CREATE_SOCKET); |
264 | BIO_R_UNABLE_TO_CREATE_SOCKET); | ||
265 | goto err; | 263 | goto err; |
266 | } | 264 | } |
267 | 265 | ||
@@ -301,17 +299,15 @@ again: | |||
301 | } | 299 | } |
302 | /* else error */ | 300 | /* else error */ |
303 | } | 301 | } |
304 | SYSerr(SYS_F_BIND, err_num); | 302 | SYSerror(err_num); |
305 | ERR_asprintf_error_data("port='%s'", host); | 303 | ERR_asprintf_error_data("port='%s'", host); |
306 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, | 304 | BIOerror(BIO_R_UNABLE_TO_BIND_SOCKET); |
307 | BIO_R_UNABLE_TO_BIND_SOCKET); | ||
308 | goto err; | 305 | goto err; |
309 | } | 306 | } |
310 | if (listen(s, SOMAXCONN) == -1) { | 307 | if (listen(s, SOMAXCONN) == -1) { |
311 | SYSerr(SYS_F_BIND, errno); | 308 | SYSerror(errno); |
312 | ERR_asprintf_error_data("port='%s'", host); | 309 | ERR_asprintf_error_data("port='%s'", host); |
313 | BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET, | 310 | BIOerror(BIO_R_UNABLE_TO_LISTEN_SOCKET); |
314 | BIO_R_UNABLE_TO_LISTEN_SOCKET); | ||
315 | goto err; | 311 | goto err; |
316 | } | 312 | } |
317 | ret = 1; | 313 | ret = 1; |
@@ -347,8 +343,8 @@ BIO_accept(int sock, char **addr) | |||
347 | if (ret == -1) { | 343 | if (ret == -1) { |
348 | if (BIO_sock_should_retry(ret)) | 344 | if (BIO_sock_should_retry(ret)) |
349 | return -2; | 345 | return -2; |
350 | SYSerr(SYS_F_ACCEPT, errno); | 346 | SYSerror(errno); |
351 | BIOerr(BIO_F_BIO_ACCEPT, BIO_R_ACCEPT_ERROR); | 347 | BIOerror(BIO_R_ACCEPT_ERROR); |
352 | goto end; | 348 | goto end; |
353 | } | 349 | } |
354 | 350 | ||
@@ -371,7 +367,7 @@ BIO_accept(int sock, char **addr) | |||
371 | ret = -1; | 367 | ret = -1; |
372 | free(p); | 368 | free(p); |
373 | *addr = NULL; | 369 | *addr = NULL; |
374 | BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); | 370 | BIOerror(ERR_R_MALLOC_FAILURE); |
375 | goto end; | 371 | goto end; |
376 | } | 372 | } |
377 | p = tmp; | 373 | p = tmp; |
@@ -387,7 +383,7 @@ BIO_accept(int sock, char **addr) | |||
387 | if ((p = malloc(24)) == NULL) { | 383 | if ((p = malloc(24)) == NULL) { |
388 | close(ret); | 384 | close(ret); |
389 | ret = -1; | 385 | ret = -1; |
390 | BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE); | 386 | BIOerror(ERR_R_MALLOC_FAILURE); |
391 | goto end; | 387 | goto end; |
392 | } | 388 | } |
393 | *addr = p; | 389 | *addr = p; |
diff --git a/src/lib/libcrypto/bio/bf_buff.c b/src/lib/libcrypto/bio/bf_buff.c index 588cc48a28..30765b03ca 100644 --- a/src/lib/libcrypto/bio/bf_buff.c +++ b/src/lib/libcrypto/bio/bf_buff.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bf_buff.c,v 1.23 2015/07/19 18:29:31 miod Exp $ */ | 1 | /* $OpenBSD: bf_buff.c,v 1.24 2017/01/29 17:49:22 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -445,7 +445,7 @@ buffer_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
445 | } | 445 | } |
446 | return (ret); | 446 | return (ret); |
447 | malloc_error: | 447 | malloc_error: |
448 | BIOerr(BIO_F_BUFFER_CTRL, ERR_R_MALLOC_FAILURE); | 448 | BIOerror(ERR_R_MALLOC_FAILURE); |
449 | return (0); | 449 | return (0); |
450 | } | 450 | } |
451 | 451 | ||
diff --git a/src/lib/libcrypto/bio/bf_lbuf.c b/src/lib/libcrypto/bio/bf_lbuf.c index 7978fdb347..5d9ec0f025 100644 --- a/src/lib/libcrypto/bio/bf_lbuf.c +++ b/src/lib/libcrypto/bio/bf_lbuf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bf_lbuf.c,v 1.13 2015/07/19 18:29:31 miod Exp $ */ | 1 | /* $OpenBSD: bf_lbuf.c,v 1.14 2017/01/29 17:49:22 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -343,7 +343,7 @@ linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
343 | } | 343 | } |
344 | return (ret); | 344 | return (ret); |
345 | malloc_error: | 345 | malloc_error: |
346 | BIOerr(BIO_F_LINEBUFFER_CTRL, ERR_R_MALLOC_FAILURE); | 346 | BIOerror(ERR_R_MALLOC_FAILURE); |
347 | return (0); | 347 | return (0); |
348 | } | 348 | } |
349 | 349 | ||
diff --git a/src/lib/libcrypto/bio/bio_err.c b/src/lib/libcrypto/bio/bio_err.c index 80788585ba..2920e32103 100644 --- a/src/lib/libcrypto/bio/bio_err.c +++ b/src/lib/libcrypto/bio/bio_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_err.c,v 1.16 2014/07/10 22:45:56 jsing Exp $ */ | 1 | /* $OpenBSD: bio_err.c,v 1.17 2017/01/29 17:49:22 beck Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -72,39 +72,7 @@ | |||
72 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BIO,0,reason) | 72 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BIO,0,reason) |
73 | 73 | ||
74 | static ERR_STRING_DATA BIO_str_functs[] = { | 74 | static ERR_STRING_DATA BIO_str_functs[] = { |
75 | {ERR_FUNC(BIO_F_ACPT_STATE), "ACPT_STATE"}, | 75 | {ERR_FUNC(0xfff), "CRYPTO_internal"}, |
76 | {ERR_FUNC(BIO_F_BIO_ACCEPT), "BIO_accept"}, | ||
77 | {ERR_FUNC(BIO_F_BIO_BER_GET_HEADER), "BIO_BER_GET_HEADER"}, | ||
78 | {ERR_FUNC(BIO_F_BIO_CALLBACK_CTRL), "BIO_callback_ctrl"}, | ||
79 | {ERR_FUNC(BIO_F_BIO_CTRL), "BIO_ctrl"}, | ||
80 | {ERR_FUNC(BIO_F_BIO_GETHOSTBYNAME), "BIO_gethostbyname"}, | ||
81 | {ERR_FUNC(BIO_F_BIO_GETS), "BIO_gets"}, | ||
82 | {ERR_FUNC(BIO_F_BIO_GET_ACCEPT_SOCKET), "BIO_get_accept_socket"}, | ||
83 | {ERR_FUNC(BIO_F_BIO_GET_HOST_IP), "BIO_get_host_ip"}, | ||
84 | {ERR_FUNC(BIO_F_BIO_GET_PORT), "BIO_get_port"}, | ||
85 | {ERR_FUNC(BIO_F_BIO_MAKE_PAIR), "BIO_MAKE_PAIR"}, | ||
86 | {ERR_FUNC(BIO_F_BIO_NEW), "BIO_new"}, | ||
87 | {ERR_FUNC(BIO_F_BIO_NEW_FILE), "BIO_new_file"}, | ||
88 | {ERR_FUNC(BIO_F_BIO_NEW_MEM_BUF), "BIO_new_mem_buf"}, | ||
89 | {ERR_FUNC(BIO_F_BIO_NREAD), "BIO_nread"}, | ||
90 | {ERR_FUNC(BIO_F_BIO_NREAD0), "BIO_nread0"}, | ||
91 | {ERR_FUNC(BIO_F_BIO_NWRITE), "BIO_nwrite"}, | ||
92 | {ERR_FUNC(BIO_F_BIO_NWRITE0), "BIO_nwrite0"}, | ||
93 | {ERR_FUNC(BIO_F_BIO_PUTS), "BIO_puts"}, | ||
94 | {ERR_FUNC(BIO_F_BIO_READ), "BIO_read"}, | ||
95 | {ERR_FUNC(BIO_F_BIO_SOCK_INIT), "BIO_sock_init"}, | ||
96 | {ERR_FUNC(BIO_F_BIO_WRITE), "BIO_write"}, | ||
97 | {ERR_FUNC(BIO_F_BUFFER_CTRL), "BUFFER_CTRL"}, | ||
98 | {ERR_FUNC(BIO_F_CONN_CTRL), "CONN_CTRL"}, | ||
99 | {ERR_FUNC(BIO_F_CONN_STATE), "CONN_STATE"}, | ||
100 | {ERR_FUNC(BIO_F_DGRAM_SCTP_READ), "DGRAM_SCTP_READ"}, | ||
101 | {ERR_FUNC(BIO_F_FILE_CTRL), "FILE_CTRL"}, | ||
102 | {ERR_FUNC(BIO_F_FILE_READ), "FILE_READ"}, | ||
103 | {ERR_FUNC(BIO_F_LINEBUFFER_CTRL), "LINEBUFFER_CTRL"}, | ||
104 | {ERR_FUNC(BIO_F_MEM_READ), "MEM_READ"}, | ||
105 | {ERR_FUNC(BIO_F_MEM_WRITE), "MEM_WRITE"}, | ||
106 | {ERR_FUNC(BIO_F_SSL_NEW), "SSL_new"}, | ||
107 | {ERR_FUNC(BIO_F_WSASTARTUP), "WSASTARTUP"}, | ||
108 | {0, NULL} | 76 | {0, NULL} |
109 | }; | 77 | }; |
110 | 78 | ||
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index 0be56aacde..86ccbdc202 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_lib.c,v 1.22 2015/02/10 11:22:21 jsing Exp $ */ | 1 | /* $OpenBSD: bio_lib.c,v 1.23 2017/01/29 17:49:22 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -71,7 +71,7 @@ BIO_new(BIO_METHOD *method) | |||
71 | 71 | ||
72 | ret = malloc(sizeof(BIO)); | 72 | ret = malloc(sizeof(BIO)); |
73 | if (ret == NULL) { | 73 | if (ret == NULL) { |
74 | BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE); | 74 | BIOerror(ERR_R_MALLOC_FAILURE); |
75 | return (NULL); | 75 | return (NULL); |
76 | } | 76 | } |
77 | if (!BIO_set(ret, method)) { | 77 | if (!BIO_set(ret, method)) { |
@@ -200,7 +200,7 @@ BIO_read(BIO *b, void *out, int outl) | |||
200 | long (*cb)(BIO *, int, const char *, int, long, long); | 200 | long (*cb)(BIO *, int, const char *, int, long, long); |
201 | 201 | ||
202 | if ((b == NULL) || (b->method == NULL) || (b->method->bread == NULL)) { | 202 | if ((b == NULL) || (b->method == NULL) || (b->method->bread == NULL)) { |
203 | BIOerr(BIO_F_BIO_READ, BIO_R_UNSUPPORTED_METHOD); | 203 | BIOerror(BIO_R_UNSUPPORTED_METHOD); |
204 | return (-2); | 204 | return (-2); |
205 | } | 205 | } |
206 | 206 | ||
@@ -210,7 +210,7 @@ BIO_read(BIO *b, void *out, int outl) | |||
210 | return (i); | 210 | return (i); |
211 | 211 | ||
212 | if (!b->init) { | 212 | if (!b->init) { |
213 | BIOerr(BIO_F_BIO_READ, BIO_R_UNINITIALIZED); | 213 | BIOerror(BIO_R_UNINITIALIZED); |
214 | return (-2); | 214 | return (-2); |
215 | } | 215 | } |
216 | 216 | ||
@@ -236,7 +236,7 @@ BIO_write(BIO *b, const void *in, int inl) | |||
236 | 236 | ||
237 | cb = b->callback; | 237 | cb = b->callback; |
238 | if ((b->method == NULL) || (b->method->bwrite == NULL)) { | 238 | if ((b->method == NULL) || (b->method->bwrite == NULL)) { |
239 | BIOerr(BIO_F_BIO_WRITE, BIO_R_UNSUPPORTED_METHOD); | 239 | BIOerror(BIO_R_UNSUPPORTED_METHOD); |
240 | return (-2); | 240 | return (-2); |
241 | } | 241 | } |
242 | 242 | ||
@@ -245,7 +245,7 @@ BIO_write(BIO *b, const void *in, int inl) | |||
245 | return (i); | 245 | return (i); |
246 | 246 | ||
247 | if (!b->init) { | 247 | if (!b->init) { |
248 | BIOerr(BIO_F_BIO_WRITE, BIO_R_UNINITIALIZED); | 248 | BIOerror(BIO_R_UNINITIALIZED); |
249 | return (-2); | 249 | return (-2); |
250 | } | 250 | } |
251 | 251 | ||
@@ -267,7 +267,7 @@ BIO_puts(BIO *b, const char *in) | |||
267 | long (*cb)(BIO *, int, const char *, int, long, long); | 267 | long (*cb)(BIO *, int, const char *, int, long, long); |
268 | 268 | ||
269 | if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) { | 269 | if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) { |
270 | BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD); | 270 | BIOerror(BIO_R_UNSUPPORTED_METHOD); |
271 | return (-2); | 271 | return (-2); |
272 | } | 272 | } |
273 | 273 | ||
@@ -278,7 +278,7 @@ BIO_puts(BIO *b, const char *in) | |||
278 | return (i); | 278 | return (i); |
279 | 279 | ||
280 | if (!b->init) { | 280 | if (!b->init) { |
281 | BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED); | 281 | BIOerror(BIO_R_UNINITIALIZED); |
282 | return (-2); | 282 | return (-2); |
283 | } | 283 | } |
284 | 284 | ||
@@ -299,7 +299,7 @@ BIO_gets(BIO *b, char *in, int inl) | |||
299 | long (*cb)(BIO *, int, const char *, int, long, long); | 299 | long (*cb)(BIO *, int, const char *, int, long, long); |
300 | 300 | ||
301 | if ((b == NULL) || (b->method == NULL) || (b->method->bgets == NULL)) { | 301 | if ((b == NULL) || (b->method == NULL) || (b->method->bgets == NULL)) { |
302 | BIOerr(BIO_F_BIO_GETS, BIO_R_UNSUPPORTED_METHOD); | 302 | BIOerror(BIO_R_UNSUPPORTED_METHOD); |
303 | return (-2); | 303 | return (-2); |
304 | } | 304 | } |
305 | 305 | ||
@@ -310,7 +310,7 @@ BIO_gets(BIO *b, char *in, int inl) | |||
310 | return (i); | 310 | return (i); |
311 | 311 | ||
312 | if (!b->init) { | 312 | if (!b->init) { |
313 | BIOerr(BIO_F_BIO_GETS, BIO_R_UNINITIALIZED); | 313 | BIOerror(BIO_R_UNINITIALIZED); |
314 | return (-2); | 314 | return (-2); |
315 | } | 315 | } |
316 | 316 | ||
@@ -364,7 +364,7 @@ BIO_ctrl(BIO *b, int cmd, long larg, void *parg) | |||
364 | return (0); | 364 | return (0); |
365 | 365 | ||
366 | if ((b->method == NULL) || (b->method->ctrl == NULL)) { | 366 | if ((b->method == NULL) || (b->method->ctrl == NULL)) { |
367 | BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); | 367 | BIOerror(BIO_R_UNSUPPORTED_METHOD); |
368 | return (-2); | 368 | return (-2); |
369 | } | 369 | } |
370 | 370 | ||
@@ -392,7 +392,7 @@ BIO_callback_ctrl(BIO *b, int cmd, | |||
392 | return (0); | 392 | return (0); |
393 | 393 | ||
394 | if ((b->method == NULL) || (b->method->callback_ctrl == NULL)) { | 394 | if ((b->method == NULL) || (b->method->callback_ctrl == NULL)) { |
395 | BIOerr(BIO_F_BIO_CALLBACK_CTRL, BIO_R_UNSUPPORTED_METHOD); | 395 | BIOerror(BIO_R_UNSUPPORTED_METHOD); |
396 | return (-2); | 396 | return (-2); |
397 | } | 397 | } |
398 | 398 | ||
diff --git a/src/lib/libcrypto/bio/bss_acpt.c b/src/lib/libcrypto/bio/bss_acpt.c index 4e3c982c2d..20508a7d5e 100644 --- a/src/lib/libcrypto/bio/bss_acpt.c +++ b/src/lib/libcrypto/bio/bss_acpt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bss_acpt.c,v 1.26 2015/07/18 22:09:30 beck Exp $ */ | 1 | /* $OpenBSD: bss_acpt.c,v 1.27 2017/01/29 17:49:22 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -201,7 +201,7 @@ again: | |||
201 | switch (c->state) { | 201 | switch (c->state) { |
202 | case ACPT_S_BEFORE: | 202 | case ACPT_S_BEFORE: |
203 | if (c->param_addr == NULL) { | 203 | if (c->param_addr == NULL) { |
204 | BIOerr(BIO_F_ACPT_STATE, BIO_R_NO_ACCEPT_PORT_SPECIFIED); | 204 | BIOerror(BIO_R_NO_ACCEPT_PORT_SPECIFIED); |
205 | return (-1); | 205 | return (-1); |
206 | } | 206 | } |
207 | s = BIO_get_accept_socket(c->param_addr, c->bind_mode); | 207 | s = BIO_get_accept_socket(c->param_addr, c->bind_mode); |
@@ -211,7 +211,7 @@ again: | |||
211 | if (c->accept_nbio) { | 211 | if (c->accept_nbio) { |
212 | if (!BIO_socket_nbio(s, 1)) { | 212 | if (!BIO_socket_nbio(s, 1)) { |
213 | close(s); | 213 | close(s); |
214 | BIOerr(BIO_F_ACPT_STATE, BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET); | 214 | BIOerror(BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET); |
215 | return (-1); | 215 | return (-1); |
216 | } | 216 | } |
217 | } | 217 | } |
@@ -248,7 +248,7 @@ again: | |||
248 | 248 | ||
249 | if (c->nbio) { | 249 | if (c->nbio) { |
250 | if (!BIO_socket_nbio(i, 1)) { | 250 | if (!BIO_socket_nbio(i, 1)) { |
251 | BIOerr(BIO_F_ACPT_STATE, BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET); | 251 | BIOerror(BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET); |
252 | goto err; | 252 | goto err; |
253 | } | 253 | } |
254 | } | 254 | } |
diff --git a/src/lib/libcrypto/bio/bss_bio.c b/src/lib/libcrypto/bio/bss_bio.c index c817910d93..20eb9a9829 100644 --- a/src/lib/libcrypto/bio/bss_bio.c +++ b/src/lib/libcrypto/bio/bss_bio.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bss_bio.c,v 1.22 2015/12/23 20:37:23 mmcc Exp $ */ | 1 | /* $OpenBSD: bss_bio.c,v 1.23 2017/01/29 17:49:22 beck Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -348,7 +348,7 @@ bio_write(BIO *bio, const char *buf, int num_) | |||
348 | b->request = 0; | 348 | b->request = 0; |
349 | if (b->closed) { | 349 | if (b->closed) { |
350 | /* we already closed */ | 350 | /* we already closed */ |
351 | BIOerr(BIO_F_BIO_WRITE, BIO_R_BROKEN_PIPE); | 351 | BIOerror(BIO_R_BROKEN_PIPE); |
352 | return -1; | 352 | return -1; |
353 | } | 353 | } |
354 | 354 | ||
@@ -425,7 +425,7 @@ bio_nwrite0(BIO *bio, char **buf) | |||
425 | 425 | ||
426 | b->request = 0; | 426 | b->request = 0; |
427 | if (b->closed) { | 427 | if (b->closed) { |
428 | BIOerr(BIO_F_BIO_NWRITE0, BIO_R_BROKEN_PIPE); | 428 | BIOerror(BIO_R_BROKEN_PIPE); |
429 | return -1; | 429 | return -1; |
430 | } | 430 | } |
431 | 431 | ||
@@ -491,10 +491,10 @@ bio_ctrl(BIO *bio, int cmd, long num, void *ptr) | |||
491 | 491 | ||
492 | case BIO_C_SET_WRITE_BUF_SIZE: | 492 | case BIO_C_SET_WRITE_BUF_SIZE: |
493 | if (b->peer) { | 493 | if (b->peer) { |
494 | BIOerr(BIO_F_BIO_CTRL, BIO_R_IN_USE); | 494 | BIOerror(BIO_R_IN_USE); |
495 | ret = 0; | 495 | ret = 0; |
496 | } else if (num == 0) { | 496 | } else if (num == 0) { |
497 | BIOerr(BIO_F_BIO_CTRL, BIO_R_INVALID_ARGUMENT); | 497 | BIOerror(BIO_R_INVALID_ARGUMENT); |
498 | ret = 0; | 498 | ret = 0; |
499 | } else { | 499 | } else { |
500 | size_t new_size = num; | 500 | size_t new_size = num; |
@@ -679,14 +679,14 @@ bio_make_pair(BIO *bio1, BIO *bio2) | |||
679 | b2 = bio2->ptr; | 679 | b2 = bio2->ptr; |
680 | 680 | ||
681 | if (b1->peer != NULL || b2->peer != NULL) { | 681 | if (b1->peer != NULL || b2->peer != NULL) { |
682 | BIOerr(BIO_F_BIO_MAKE_PAIR, BIO_R_IN_USE); | 682 | BIOerror(BIO_R_IN_USE); |
683 | return 0; | 683 | return 0; |
684 | } | 684 | } |
685 | 685 | ||
686 | if (b1->buf == NULL) { | 686 | if (b1->buf == NULL) { |
687 | b1->buf = malloc(b1->size); | 687 | b1->buf = malloc(b1->size); |
688 | if (b1->buf == NULL) { | 688 | if (b1->buf == NULL) { |
689 | BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE); | 689 | BIOerror(ERR_R_MALLOC_FAILURE); |
690 | return 0; | 690 | return 0; |
691 | } | 691 | } |
692 | b1->len = 0; | 692 | b1->len = 0; |
@@ -696,7 +696,7 @@ bio_make_pair(BIO *bio1, BIO *bio2) | |||
696 | if (b2->buf == NULL) { | 696 | if (b2->buf == NULL) { |
697 | b2->buf = malloc(b2->size); | 697 | b2->buf = malloc(b2->size); |
698 | if (b2->buf == NULL) { | 698 | if (b2->buf == NULL) { |
699 | BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE); | 699 | BIOerror(ERR_R_MALLOC_FAILURE); |
700 | return 0; | 700 | return 0; |
701 | } | 701 | } |
702 | b2->len = 0; | 702 | b2->len = 0; |
@@ -822,7 +822,7 @@ BIO_nread0(BIO *bio, char **buf) | |||
822 | long ret; | 822 | long ret; |
823 | 823 | ||
824 | if (!bio->init) { | 824 | if (!bio->init) { |
825 | BIOerr(BIO_F_BIO_NREAD0, BIO_R_UNINITIALIZED); | 825 | BIOerror(BIO_R_UNINITIALIZED); |
826 | return -2; | 826 | return -2; |
827 | } | 827 | } |
828 | 828 | ||
@@ -839,7 +839,7 @@ BIO_nread(BIO *bio, char **buf, int num) | |||
839 | int ret; | 839 | int ret; |
840 | 840 | ||
841 | if (!bio->init) { | 841 | if (!bio->init) { |
842 | BIOerr(BIO_F_BIO_NREAD, BIO_R_UNINITIALIZED); | 842 | BIOerror(BIO_R_UNINITIALIZED); |
843 | return -2; | 843 | return -2; |
844 | } | 844 | } |
845 | 845 | ||
@@ -855,7 +855,7 @@ BIO_nwrite0(BIO *bio, char **buf) | |||
855 | long ret; | 855 | long ret; |
856 | 856 | ||
857 | if (!bio->init) { | 857 | if (!bio->init) { |
858 | BIOerr(BIO_F_BIO_NWRITE0, BIO_R_UNINITIALIZED); | 858 | BIOerror(BIO_R_UNINITIALIZED); |
859 | return -2; | 859 | return -2; |
860 | } | 860 | } |
861 | 861 | ||
@@ -872,7 +872,7 @@ BIO_nwrite(BIO *bio, char **buf, int num) | |||
872 | int ret; | 872 | int ret; |
873 | 873 | ||
874 | if (!bio->init) { | 874 | if (!bio->init) { |
875 | BIOerr(BIO_F_BIO_NWRITE, BIO_R_UNINITIALIZED); | 875 | BIOerror(BIO_R_UNINITIALIZED); |
876 | return -2; | 876 | return -2; |
877 | } | 877 | } |
878 | 878 | ||
diff --git a/src/lib/libcrypto/bio/bss_conn.c b/src/lib/libcrypto/bio/bss_conn.c index 7f50936677..555273882c 100644 --- a/src/lib/libcrypto/bio/bss_conn.c +++ b/src/lib/libcrypto/bio/bss_conn.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bss_conn.c,v 1.32 2014/11/26 05:37:26 bcook Exp $ */ | 1 | /* $OpenBSD: bss_conn.c,v 1.33 2017/01/29 17:49:22 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -134,7 +134,7 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
134 | case BIO_CONN_S_BEFORE: | 134 | case BIO_CONN_S_BEFORE: |
135 | p = c->param_hostname; | 135 | p = c->param_hostname; |
136 | if (p == NULL) { | 136 | if (p == NULL) { |
137 | BIOerr(BIO_F_CONN_STATE, BIO_R_NO_HOSTNAME_SPECIFIED); | 137 | BIOerror(BIO_R_NO_HOSTNAME_SPECIFIED); |
138 | goto exit_loop; | 138 | goto exit_loop; |
139 | } | 139 | } |
140 | for (; *p != '\0'; p++) { | 140 | for (; *p != '\0'; p++) { |
@@ -157,7 +157,7 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
157 | } | 157 | } |
158 | 158 | ||
159 | if (c->param_port == NULL) { | 159 | if (c->param_port == NULL) { |
160 | BIOerr(BIO_F_CONN_STATE, BIO_R_NO_PORT_SPECIFIED); | 160 | BIOerror(BIO_R_NO_PORT_SPECIFIED); |
161 | ERR_asprintf_error_data("host=%s", | 161 | ERR_asprintf_error_data("host=%s", |
162 | c->param_hostname); | 162 | c->param_hostname); |
163 | goto exit_loop; | 163 | goto exit_loop; |
@@ -195,11 +195,10 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
195 | 195 | ||
196 | ret = socket(AF_INET, SOCK_STREAM, SOCKET_PROTOCOL); | 196 | ret = socket(AF_INET, SOCK_STREAM, SOCKET_PROTOCOL); |
197 | if (ret == -1) { | 197 | if (ret == -1) { |
198 | SYSerr(SYS_F_SOCKET, errno); | 198 | SYSerror(errno); |
199 | ERR_asprintf_error_data("host=%s:%s", | 199 | ERR_asprintf_error_data("host=%s:%s", |
200 | c->param_hostname, c->param_port); | 200 | c->param_hostname, c->param_port); |
201 | BIOerr(BIO_F_CONN_STATE, | 201 | BIOerror(BIO_R_UNABLE_TO_CREATE_SOCKET); |
202 | BIO_R_UNABLE_TO_CREATE_SOCKET); | ||
203 | goto exit_loop; | 202 | goto exit_loop; |
204 | } | 203 | } |
205 | b->num = ret; | 204 | b->num = ret; |
@@ -209,8 +208,7 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
209 | case BIO_CONN_S_NBIO: | 208 | case BIO_CONN_S_NBIO: |
210 | if (c->nbio) { | 209 | if (c->nbio) { |
211 | if (!BIO_socket_nbio(b->num, 1)) { | 210 | if (!BIO_socket_nbio(b->num, 1)) { |
212 | BIOerr(BIO_F_CONN_STATE, | 211 | BIOerror(BIO_R_ERROR_SETTING_NBIO); |
213 | BIO_R_ERROR_SETTING_NBIO); | ||
214 | ERR_asprintf_error_data("host=%s:%s", | 212 | ERR_asprintf_error_data("host=%s:%s", |
215 | c->param_hostname, c->param_port); | 213 | c->param_hostname, c->param_port); |
216 | goto exit_loop; | 214 | goto exit_loop; |
@@ -222,10 +220,10 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
222 | i = 1; | 220 | i = 1; |
223 | i = setsockopt(b->num, SOL_SOCKET, SO_KEEPALIVE, &i, sizeof(i)); | 221 | i = setsockopt(b->num, SOL_SOCKET, SO_KEEPALIVE, &i, sizeof(i)); |
224 | if (i < 0) { | 222 | if (i < 0) { |
225 | SYSerr(SYS_F_SOCKET, errno); | 223 | SYSerror(errno); |
226 | ERR_asprintf_error_data("host=%s:%s", | 224 | ERR_asprintf_error_data("host=%s:%s", |
227 | c->param_hostname, c->param_port); | 225 | c->param_hostname, c->param_port); |
228 | BIOerr(BIO_F_CONN_STATE, BIO_R_KEEPALIVE); | 226 | BIOerror(BIO_R_KEEPALIVE); |
229 | goto exit_loop; | 227 | goto exit_loop; |
230 | } | 228 | } |
231 | #endif | 229 | #endif |
@@ -243,11 +241,10 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
243 | c->state = BIO_CONN_S_BLOCKED_CONNECT; | 241 | c->state = BIO_CONN_S_BLOCKED_CONNECT; |
244 | b->retry_reason = BIO_RR_CONNECT; | 242 | b->retry_reason = BIO_RR_CONNECT; |
245 | } else { | 243 | } else { |
246 | SYSerr(SYS_F_CONNECT, errno); | 244 | SYSerror(errno); |
247 | ERR_asprintf_error_data("host=%s:%s", | 245 | ERR_asprintf_error_data("host=%s:%s", |
248 | c->param_hostname, c->param_port); | 246 | c->param_hostname, c->param_port); |
249 | BIOerr(BIO_F_CONN_STATE, | 247 | BIOerror(BIO_R_CONNECT_ERROR); |
250 | BIO_R_CONNECT_ERROR); | ||
251 | } | 248 | } |
252 | goto exit_loop; | 249 | goto exit_loop; |
253 | } else | 250 | } else |
@@ -258,11 +255,10 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
258 | i = BIO_sock_error(b->num); | 255 | i = BIO_sock_error(b->num); |
259 | if (i) { | 256 | if (i) { |
260 | BIO_clear_retry_flags(b); | 257 | BIO_clear_retry_flags(b); |
261 | SYSerr(SYS_F_CONNECT, i); | 258 | SYSerror(i); |
262 | ERR_asprintf_error_data("host=%s:%s", | 259 | ERR_asprintf_error_data("host=%s:%s", |
263 | c->param_hostname, c->param_port); | 260 | c->param_hostname, c->param_port); |
264 | BIOerr(BIO_F_CONN_STATE, | 261 | BIOerror(BIO_R_NBIO_CONNECT_ERROR); |
265 | BIO_R_NBIO_CONNECT_ERROR); | ||
266 | ret = 0; | 262 | ret = 0; |
267 | goto exit_loop; | 263 | goto exit_loop; |
268 | } else | 264 | } else |
@@ -533,7 +529,7 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
533 | case BIO_CTRL_SET_CALLBACK: | 529 | case BIO_CTRL_SET_CALLBACK: |
534 | { | 530 | { |
535 | #if 0 /* FIXME: Should this be used? -- Richard Levitte */ | 531 | #if 0 /* FIXME: Should this be used? -- Richard Levitte */ |
536 | BIOerr(BIO_F_CONN_CTRL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 532 | BIOerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
537 | ret = -1; | 533 | ret = -1; |
538 | #else | 534 | #else |
539 | ret = 0; | 535 | ret = 0; |
diff --git a/src/lib/libcrypto/bio/bss_file.c b/src/lib/libcrypto/bio/bss_file.c index c710076fea..01f4a3ff3b 100644 --- a/src/lib/libcrypto/bio/bss_file.c +++ b/src/lib/libcrypto/bio/bss_file.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bss_file.c,v 1.31 2014/11/11 19:26:12 miod Exp $ */ | 1 | /* $OpenBSD: bss_file.c,v 1.32 2017/01/29 17:49:22 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -119,12 +119,12 @@ BIO_new_file(const char *filename, const char *mode) | |||
119 | file = fopen(filename, mode); | 119 | file = fopen(filename, mode); |
120 | 120 | ||
121 | if (file == NULL) { | 121 | if (file == NULL) { |
122 | SYSerr(SYS_F_FOPEN, errno); | 122 | SYSerror(errno); |
123 | ERR_asprintf_error_data("fopen('%s', '%s')", filename, mode); | 123 | ERR_asprintf_error_data("fopen('%s', '%s')", filename, mode); |
124 | if (errno == ENOENT) | 124 | if (errno == ENOENT) |
125 | BIOerr(BIO_F_BIO_NEW_FILE, BIO_R_NO_SUCH_FILE); | 125 | BIOerror(BIO_R_NO_SUCH_FILE); |
126 | else | 126 | else |
127 | BIOerr(BIO_F_BIO_NEW_FILE, ERR_R_SYS_LIB); | 127 | BIOerror(ERR_R_SYS_LIB); |
128 | return (NULL); | 128 | return (NULL); |
129 | } | 129 | } |
130 | if ((ret = BIO_new(BIO_s_file())) == NULL) { | 130 | if ((ret = BIO_new(BIO_s_file())) == NULL) { |
@@ -188,8 +188,8 @@ file_read(BIO *b, char *out, int outl) | |||
188 | if (b->init && out != NULL) { | 188 | if (b->init && out != NULL) { |
189 | ret = fread(out, 1, outl, (FILE *)b->ptr); | 189 | ret = fread(out, 1, outl, (FILE *)b->ptr); |
190 | if (ret == 0 && ferror((FILE *)b->ptr)) { | 190 | if (ret == 0 && ferror((FILE *)b->ptr)) { |
191 | SYSerr(SYS_F_FREAD, errno); | 191 | SYSerror(errno); |
192 | BIOerr(BIO_F_FILE_READ, ERR_R_SYS_LIB); | 192 | BIOerror(ERR_R_SYS_LIB); |
193 | ret = -1; | 193 | ret = -1; |
194 | } | 194 | } |
195 | } | 195 | } |
@@ -246,15 +246,15 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
246 | else if (num & BIO_FP_READ) | 246 | else if (num & BIO_FP_READ) |
247 | strlcpy(p, "r", sizeof p); | 247 | strlcpy(p, "r", sizeof p); |
248 | else { | 248 | else { |
249 | BIOerr(BIO_F_FILE_CTRL, BIO_R_BAD_FOPEN_MODE); | 249 | BIOerror(BIO_R_BAD_FOPEN_MODE); |
250 | ret = 0; | 250 | ret = 0; |
251 | break; | 251 | break; |
252 | } | 252 | } |
253 | fp = fopen(ptr, p); | 253 | fp = fopen(ptr, p); |
254 | if (fp == NULL) { | 254 | if (fp == NULL) { |
255 | SYSerr(SYS_F_FOPEN, errno); | 255 | SYSerror(errno); |
256 | ERR_asprintf_error_data("fopen('%s', '%s')", ptr, p); | 256 | ERR_asprintf_error_data("fopen('%s', '%s')", ptr, p); |
257 | BIOerr(BIO_F_FILE_CTRL, ERR_R_SYS_LIB); | 257 | BIOerror(ERR_R_SYS_LIB); |
258 | ret = 0; | 258 | ret = 0; |
259 | break; | 259 | break; |
260 | } | 260 | } |
diff --git a/src/lib/libcrypto/bio/bss_mem.c b/src/lib/libcrypto/bio/bss_mem.c index 119bd672f6..be491ca152 100644 --- a/src/lib/libcrypto/bio/bss_mem.c +++ b/src/lib/libcrypto/bio/bss_mem.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bss_mem.c,v 1.14 2015/03/21 08:05:20 doug Exp $ */ | 1 | /* $OpenBSD: bss_mem.c,v 1.15 2017/01/29 17:49:22 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -101,7 +101,7 @@ BIO_new_mem_buf(void *buf, int len) | |||
101 | size_t sz; | 101 | size_t sz; |
102 | 102 | ||
103 | if (!buf) { | 103 | if (!buf) { |
104 | BIOerr(BIO_F_BIO_NEW_MEM_BUF, BIO_R_NULL_PARAMETER); | 104 | BIOerror(BIO_R_NULL_PARAMETER); |
105 | return NULL; | 105 | return NULL; |
106 | } | 106 | } |
107 | sz = (len < 0) ? strlen(buf) : (size_t)len; | 107 | sz = (len < 0) ? strlen(buf) : (size_t)len; |
@@ -183,12 +183,12 @@ mem_write(BIO *b, const char *in, int inl) | |||
183 | 183 | ||
184 | bm = (BUF_MEM *)b->ptr; | 184 | bm = (BUF_MEM *)b->ptr; |
185 | if (in == NULL) { | 185 | if (in == NULL) { |
186 | BIOerr(BIO_F_MEM_WRITE, BIO_R_NULL_PARAMETER); | 186 | BIOerror(BIO_R_NULL_PARAMETER); |
187 | goto end; | 187 | goto end; |
188 | } | 188 | } |
189 | 189 | ||
190 | if (b->flags & BIO_FLAGS_MEM_RDONLY) { | 190 | if (b->flags & BIO_FLAGS_MEM_RDONLY) { |
191 | BIOerr(BIO_F_MEM_WRITE, BIO_R_WRITE_TO_READ_ONLY_BIO); | 191 | BIOerror(BIO_R_WRITE_TO_READ_ONLY_BIO); |
192 | goto end; | 192 | goto end; |
193 | } | 193 | } |
194 | 194 | ||