summaryrefslogtreecommitdiffstats
path: root/src/crypto/bio
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2015-09-25 00:26:37 +0000
committerKenny Root <kroot@google.com>2015-09-25 00:26:37 +0000
commita04d78d392463df4e69a64360c952ffa5abd22f7 (patch)
treedc62c249d595198e0d99e43890019d21e901fbec /src/crypto/bio
parent1e4884f615b20946411a74e41eb9c6aa65e2d5f3 (diff)
downloadexternal_boringssl-a04d78d392463df4e69a64360c952ffa5abd22f7.zip
external_boringssl-a04d78d392463df4e69a64360c952ffa5abd22f7.tar.gz
external_boringssl-a04d78d392463df4e69a64360c952ffa5abd22f7.tar.bz2
Revert "external/boringssl: sync with upstream."
This reverts commit 1e4884f615b20946411a74e41eb9c6aa65e2d5f3. This breaks some x86 builds. Change-Id: I4d4310663ce52bc0a130e6b9dbc22b868ff4fb25
Diffstat (limited to 'src/crypto/bio')
-rw-r--r--src/crypto/bio/CMakeLists.txt2
-rw-r--r--src/crypto/bio/bio.c14
-rw-r--r--src/crypto/bio/bio_mem.c4
-rw-r--r--src/crypto/bio/buffer.c2
-rw-r--r--src/crypto/bio/connect.c16
-rw-r--r--src/crypto/bio/file.c21
-rw-r--r--src/crypto/bio/pair.c62
-rw-r--r--src/crypto/bio/printf.c2
-rw-r--r--src/crypto/bio/socket_helper.c5
9 files changed, 69 insertions, 59 deletions
diff --git a/src/crypto/bio/CMakeLists.txt b/src/crypto/bio/CMakeLists.txt
index 8de090a..dbf5951 100644
--- a/src/crypto/bio/CMakeLists.txt
+++ b/src/crypto/bio/CMakeLists.txt
@@ -1,4 +1,4 @@
-include_directories(../../include)
+include_directories(. .. ../../include)
add_library(
bio
diff --git a/src/crypto/bio/bio.c b/src/crypto/bio/bio.c
index 4bc98ba..5ac5911 100644
--- a/src/crypto/bio/bio.c
+++ b/src/crypto/bio/bio.c
@@ -90,7 +90,7 @@ static int bio_set(BIO *bio, const BIO_METHOD *method) {
BIO *BIO_new(const BIO_METHOD *method) {
BIO *ret = OPENSSL_malloc(sizeof(BIO));
if (ret == NULL) {
- OPENSSL_PUT_ERROR(BIO, ERR_R_MALLOC_FAILURE);
+ OPENSSL_PUT_ERROR(BIO, BIO_new, ERR_R_MALLOC_FAILURE);
return NULL;
}
@@ -153,7 +153,7 @@ static int bio_io(BIO *bio, void *buf, int len, size_t method_offset,
}
if (io_func == NULL) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNSUPPORTED_METHOD);
+ OPENSSL_PUT_ERROR(BIO, bio_io, BIO_R_UNSUPPORTED_METHOD);
return -2;
}
@@ -165,7 +165,7 @@ static int bio_io(BIO *bio, void *buf, int len, size_t method_offset,
}
if (!bio->init) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNINITIALIZED);
+ OPENSSL_PUT_ERROR(BIO, bio_io, BIO_R_UNINITIALIZED);
return -2;
}
@@ -217,7 +217,7 @@ long BIO_ctrl(BIO *bio, int cmd, long larg, void *parg) {
}
if (bio->method == NULL || bio->method->ctrl == NULL) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNSUPPORTED_METHOD);
+ OPENSSL_PUT_ERROR(BIO, BIO_ctrl, BIO_R_UNSUPPORTED_METHOD);
return -2;
}
@@ -323,7 +323,7 @@ long BIO_callback_ctrl(BIO *bio, int cmd, bio_info_cb fp) {
}
if (bio->method == NULL || bio->method->callback_ctrl == NULL) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNSUPPORTED_METHOD);
+ OPENSSL_PUT_ERROR(BIO, BIO_callback_ctrl, BIO_R_UNSUPPORTED_METHOD);
return 0;
}
@@ -462,10 +462,6 @@ void BIO_print_errors(BIO *bio) {
ERR_print_errors_cb(print_bio, bio);
}
-void ERR_print_errors(BIO *bio) {
- BIO_print_errors(bio);
-}
-
/* bio_read_all reads everything from |bio| and prepends |prefix| to it. On
* success, |*out| is set to an allocated buffer (which should be freed with
* |OPENSSL_free|), |*out_len| is set to its length and one is returned. The
diff --git a/src/crypto/bio/bio_mem.c b/src/crypto/bio/bio_mem.c
index ef56111..f3aad6f 100644
--- a/src/crypto/bio/bio_mem.c
+++ b/src/crypto/bio/bio_mem.c
@@ -70,7 +70,7 @@ BIO *BIO_new_mem_buf(void *buf, int len) {
const size_t size = len < 0 ? strlen((char *)buf) : (size_t)len;
if (!buf && len != 0) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_NULL_PARAMETER);
+ OPENSSL_PUT_ERROR(BIO, BIO_new_mem_buf, BIO_R_NULL_PARAMETER);
return NULL;
}
@@ -167,7 +167,7 @@ static int mem_write(BIO *bio, const char *in, int inl) {
b = (BUF_MEM *)bio->ptr;
if (bio->flags & BIO_FLAGS_MEM_RDONLY) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_WRITE_TO_READ_ONLY_BIO);
+ OPENSSL_PUT_ERROR(BIO, mem_write, BIO_R_WRITE_TO_READ_ONLY_BIO);
goto err;
}
diff --git a/src/crypto/bio/buffer.c b/src/crypto/bio/buffer.c
index 9d0cb3c..3fc0685 100644
--- a/src/crypto/bio/buffer.c
+++ b/src/crypto/bio/buffer.c
@@ -406,7 +406,7 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) {
return ret;
malloc_error:
- OPENSSL_PUT_ERROR(BIO, ERR_R_MALLOC_FAILURE);
+ OPENSSL_PUT_ERROR(BIO, buffer_ctrl, ERR_R_MALLOC_FAILURE);
return 0;
}
diff --git a/src/crypto/bio/connect.c b/src/crypto/bio/connect.c
index 2ed2def..32361bf 100644
--- a/src/crypto/bio/connect.c
+++ b/src/crypto/bio/connect.c
@@ -142,7 +142,7 @@ static int conn_state(BIO *bio, BIO_CONNECT *c) {
case BIO_CONN_S_BEFORE:
p = c->param_hostname;
if (p == NULL) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_NO_HOSTNAME_SPECIFIED);
+ OPENSSL_PUT_ERROR(BIO, conn_state, BIO_R_NO_HOSTNAME_SPECIFIED);
goto exit_loop;
}
for (; *p != 0; p++) {
@@ -167,7 +167,7 @@ static int conn_state(BIO *bio, BIO_CONNECT *c) {
}
if (c->param_port == NULL) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_NO_PORT_SPECIFIED);
+ OPENSSL_PUT_ERROR(BIO, conn_state, BIO_R_NO_PORT_SPECIFIED);
ERR_add_error_data(2, "host=", c->param_hostname);
goto exit_loop;
}
@@ -175,7 +175,7 @@ static int conn_state(BIO *bio, BIO_CONNECT *c) {
if (!bio_ip_and_port_to_socket_and_addr(
&bio->num, &c->them, &c->them_length, c->param_hostname,
c->param_port)) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNABLE_TO_CREATE_SOCKET);
+ OPENSSL_PUT_ERROR(BIO, conn_state, BIO_R_UNABLE_TO_CREATE_SOCKET);
ERR_add_error_data(4, "host=", c->param_hostname, ":", c->param_port);
goto exit_loop;
}
@@ -185,7 +185,7 @@ static int conn_state(BIO *bio, BIO_CONNECT *c) {
if (c->nbio) {
if (!bio_socket_nbio(bio->num, 1)) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_ERROR_SETTING_NBIO);
+ OPENSSL_PUT_ERROR(BIO, conn_state, BIO_R_ERROR_SETTING_NBIO);
ERR_add_error_data(4, "host=", c->param_hostname, ":",
c->param_port);
goto exit_loop;
@@ -197,7 +197,7 @@ static int conn_state(BIO *bio, BIO_CONNECT *c) {
sizeof(i));
if (ret < 0) {
OPENSSL_PUT_SYSTEM_ERROR(setsockopt);
- OPENSSL_PUT_ERROR(BIO, BIO_R_KEEPALIVE);
+ OPENSSL_PUT_ERROR(BIO, conn_state, BIO_R_KEEPALIVE);
ERR_add_error_data(4, "host=", c->param_hostname, ":", c->param_port);
goto exit_loop;
}
@@ -211,7 +211,7 @@ static int conn_state(BIO *bio, BIO_CONNECT *c) {
bio->retry_reason = BIO_RR_CONNECT;
} else {
OPENSSL_PUT_SYSTEM_ERROR(connect);
- OPENSSL_PUT_ERROR(BIO, BIO_R_CONNECT_ERROR);
+ OPENSSL_PUT_ERROR(BIO, conn_state, BIO_R_CONNECT_ERROR);
ERR_add_error_data(4, "host=", c->param_hostname, ":",
c->param_port);
}
@@ -232,7 +232,7 @@ static int conn_state(BIO *bio, BIO_CONNECT *c) {
} else {
BIO_clear_retry_flags(bio);
OPENSSL_PUT_SYSTEM_ERROR(connect);
- OPENSSL_PUT_ERROR(BIO, BIO_R_NBIO_CONNECT_ERROR);
+ OPENSSL_PUT_ERROR(BIO, conn_state, BIO_R_NBIO_CONNECT_ERROR);
ERR_add_error_data(4, "host=", c->param_hostname, ":", c->param_port);
ret = 0;
}
@@ -464,7 +464,7 @@ static long conn_ctrl(BIO *bio, int cmd, long num, void *ptr) {
break;
case BIO_CTRL_SET_CALLBACK: {
#if 0 /* FIXME: Should this be used? -- Richard Levitte */
- OPENSSL_PUT_ERROR(BIO, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+ OPENSSL_PUT_ERROR(BIO, XXX, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
ret = -1;
#else
ret = 0;
diff --git a/src/crypto/bio/file.c b/src/crypto/bio/file.c
index 2d3ccfe..7f57aad 100644
--- a/src/crypto/bio/file.c
+++ b/src/crypto/bio/file.c
@@ -88,7 +88,7 @@
#define BIO_FP_APPEND 0x08
static FILE *open_file(const char *filename, const char *mode) {
-#if defined(OPENSSL_WINDOWS) && defined(CP_UTF8)
+#if defined(_WIN32) && defined(CP_UTF8)
int sz, len_0 = (int)strlen(filename) + 1;
DWORD flags;
@@ -133,9 +133,9 @@ BIO *BIO_new_file(const char *filename, const char *mode) {
ERR_add_error_data(5, "fopen('", filename, "','", mode, "')");
if (errno == ENOENT) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_NO_SUCH_FILE);
+ OPENSSL_PUT_ERROR(BIO, BIO_new_file, BIO_R_NO_SUCH_FILE);
} else {
- OPENSSL_PUT_ERROR(BIO, BIO_R_SYS_LIB);
+ OPENSSL_PUT_ERROR(BIO, BIO_new_file, BIO_R_SYS_LIB);
}
return NULL;
}
@@ -182,19 +182,20 @@ static int file_free(BIO *bio) {
}
static int file_read(BIO *b, char *out, int outl) {
+ int ret = 0;
+
if (!b->init) {
return 0;
}
- size_t ret = fread(out, 1, outl, (FILE *)b->ptr);
+ ret = fread(out, 1, outl, (FILE *)b->ptr);
if (ret == 0 && ferror((FILE *)b->ptr)) {
OPENSSL_PUT_SYSTEM_ERROR(fread);
- OPENSSL_PUT_ERROR(BIO, ERR_R_SYS_LIB);
- return -1;
+ OPENSSL_PUT_ERROR(BIO, file_read, ERR_R_SYS_LIB);
+ ret = -1;
}
- /* fread reads at most |outl| bytes, so |ret| fits in an int. */
- return (int)ret;
+ return ret;
}
static int file_write(BIO *b, const char *in, int inl) {
@@ -252,7 +253,7 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr) {
} else if (num & BIO_FP_READ) {
BUF_strlcpy(p, "r", sizeof(p));
} else {
- OPENSSL_PUT_ERROR(BIO, BIO_R_BAD_FOPEN_MODE);
+ OPENSSL_PUT_ERROR(BIO, file_ctrl, BIO_R_BAD_FOPEN_MODE);
ret = 0;
break;
}
@@ -260,7 +261,7 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr) {
if (fp == NULL) {
OPENSSL_PUT_SYSTEM_ERROR(fopen);
ERR_add_error_data(5, "fopen('", ptr, "','", p, "')");
- OPENSSL_PUT_ERROR(BIO, ERR_R_SYS_LIB);
+ OPENSSL_PUT_ERROR(BIO, file_ctrl, ERR_R_SYS_LIB);
ret = 0;
break;
}
diff --git a/src/crypto/bio/pair.c b/src/crypto/bio/pair.c
index 6f78890..cc55950 100644
--- a/src/crypto/bio/pair.c
+++ b/src/crypto/bio/pair.c
@@ -181,25 +181,27 @@ int BIO_zero_copy_get_read_buf(BIO* bio, uint8_t** out_read_buf,
BIO_clear_retry_flags(bio);
if (!bio->init) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNINITIALIZED);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_read_buf, BIO_R_UNINITIALIZED);
return 0;
}
b = bio->ptr;
if (!b || !b->peer) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNSUPPORTED_METHOD);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_read_buf,
+ BIO_R_UNSUPPORTED_METHOD);
return 0;
}
peer_b = b->peer->ptr;
if (!peer_b || !peer_b->peer || peer_b->peer->ptr != b) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNSUPPORTED_METHOD);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_read_buf,
+ BIO_R_UNSUPPORTED_METHOD);
return 0;
}
if (peer_b->zero_copy_read_lock) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_INVALID_ARGUMENT);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_read_buf, BIO_R_INVALID_ARGUMENT);
return 0;
}
@@ -227,32 +229,37 @@ int BIO_zero_copy_get_read_buf_done(BIO* bio, size_t bytes_read) {
assert(BIO_get_retry_flags(bio) == 0);
if (!bio->init) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNINITIALIZED);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_read_buf_done,
+ BIO_R_UNINITIALIZED);
return 0;
}
b = bio->ptr;
if (!b || !b->peer) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNSUPPORTED_METHOD);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_read_buf_done,
+ BIO_R_UNSUPPORTED_METHOD);
return 0;
}
peer_b = b->peer->ptr;
if (!peer_b || !peer_b->peer || peer_b->peer->ptr != b) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNSUPPORTED_METHOD);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_read_buf_done,
+ BIO_R_UNSUPPORTED_METHOD);
return 0;
}
if (!peer_b->zero_copy_read_lock) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_INVALID_ARGUMENT);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_read_buf_done,
+ BIO_R_INVALID_ARGUMENT);
return 0;
}
max_available =
bio_zero_copy_get_read_buf(peer_b, &dummy_read_buf, &dummy_read_offset);
if (bytes_read > max_available) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_INVALID_ARGUMENT);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_read_buf_done,
+ BIO_R_INVALID_ARGUMENT);
return 0;
}
@@ -311,33 +318,35 @@ int BIO_zero_copy_get_write_buf(BIO* bio, uint8_t** out_write_buf,
BIO_clear_retry_flags(bio);
if (!bio->init) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNINITIALIZED);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_write_buf, BIO_R_UNINITIALIZED);
return 0;
}
b = bio->ptr;
if (!b || !b->buf || !b->peer) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNSUPPORTED_METHOD);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_write_buf,
+ BIO_R_UNSUPPORTED_METHOD);
return 0;
}
peer_b = b->peer->ptr;
if (!peer_b || !peer_b->peer || peer_b->peer->ptr != b) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNSUPPORTED_METHOD);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_write_buf,
+ BIO_R_UNSUPPORTED_METHOD);
return 0;
}
assert(b->buf != NULL);
if (b->zero_copy_write_lock) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_INVALID_ARGUMENT);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_write_buf, BIO_R_INVALID_ARGUMENT);
return 0;
}
b->request = 0;
if (b->closed) {
/* Bio is already closed. */
- OPENSSL_PUT_ERROR(BIO, BIO_R_BROKEN_PIPE);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_write_buf, BIO_R_BROKEN_PIPE);
return 0;
}
@@ -360,38 +369,43 @@ int BIO_zero_copy_get_write_buf_done(BIO* bio, size_t bytes_written) {
uint8_t* dummy_write_buf;
if (!bio->init) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNINITIALIZED);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_write_buf_done,
+ BIO_R_UNINITIALIZED);
return 0;
}
b = bio->ptr;
if (!b || !b->buf || !b->peer) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNSUPPORTED_METHOD);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_write_buf_done,
+ BIO_R_UNSUPPORTED_METHOD);
return 0;
}
peer_b = b->peer->ptr;
if (!peer_b || !peer_b->peer || peer_b->peer->ptr != b) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_UNSUPPORTED_METHOD);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_write_buf_done,
+ BIO_R_UNSUPPORTED_METHOD);
return 0;
}
b->request = 0;
if (b->closed) {
/* BIO is already closed. */
- OPENSSL_PUT_ERROR(BIO, BIO_R_BROKEN_PIPE);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_write_buf_done, BIO_R_BROKEN_PIPE);
return 0;
}
if (!b->zero_copy_write_lock) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_INVALID_ARGUMENT);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_write_buf_done,
+ BIO_R_INVALID_ARGUMENT);
return 0;
}
rest = bio_zero_copy_get_write_buf(b, &dummy_write_buf, &dummy_write_offset);
if (bytes_written > rest) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_INVALID_ARGUMENT);
+ OPENSSL_PUT_ERROR(BIO, BIO_zero_copy_get_write_buf_done,
+ BIO_R_INVALID_ARGUMENT);
return 0;
}
@@ -511,7 +525,7 @@ static int bio_write(BIO *bio, const char *buf, int num_) {
b->request = 0;
if (b->closed) {
/* we already closed */
- OPENSSL_PUT_ERROR(BIO, BIO_R_BROKEN_PIPE);
+ OPENSSL_PUT_ERROR(BIO, bio_write, BIO_R_BROKEN_PIPE);
return -1;
}
@@ -576,7 +590,7 @@ static int bio_make_pair(BIO* bio1, BIO* bio2,
b2 = bio2->ptr;
if (b1->peer != NULL || b2->peer != NULL) {
- OPENSSL_PUT_ERROR(BIO, BIO_R_IN_USE);
+ OPENSSL_PUT_ERROR(BIO, bio_make_pair, BIO_R_IN_USE);
return 0;
}
@@ -591,7 +605,7 @@ static int bio_make_pair(BIO* bio1, BIO* bio2,
b1->buf_externally_allocated = 0;
b1->buf = OPENSSL_malloc(b1->size);
if (b1->buf == NULL) {
- OPENSSL_PUT_ERROR(BIO, ERR_R_MALLOC_FAILURE);
+ OPENSSL_PUT_ERROR(BIO, bio_make_pair, ERR_R_MALLOC_FAILURE);
return 0;
}
} else {
@@ -610,7 +624,7 @@ static int bio_make_pair(BIO* bio1, BIO* bio2,
b2->buf_externally_allocated = 0;
b2->buf = OPENSSL_malloc(b2->size);
if (b2->buf == NULL) {
- OPENSSL_PUT_ERROR(BIO, ERR_R_MALLOC_FAILURE);
+ OPENSSL_PUT_ERROR(BIO, bio_make_pair, ERR_R_MALLOC_FAILURE);
return 0;
}
} else {
diff --git a/src/crypto/bio/printf.c b/src/crypto/bio/printf.c
index 2f5ae4a..f51b396 100644
--- a/src/crypto/bio/printf.c
+++ b/src/crypto/bio/printf.c
@@ -95,7 +95,7 @@ int BIO_printf(BIO *bio, const char *format, ...) {
out = OPENSSL_malloc(requested_len + 1);
out_malloced = 1;
if (out == NULL) {
- OPENSSL_PUT_ERROR(BIO, ERR_R_MALLOC_FAILURE);
+ OPENSSL_PUT_ERROR(BIO, BIO_printf, ERR_R_MALLOC_FAILURE);
return -1;
}
va_start(args, format);
diff --git a/src/crypto/bio/socket_helper.c b/src/crypto/bio/socket_helper.c
index 01f635e..b1cdd1a 100644
--- a/src/crypto/bio/socket_helper.c
+++ b/src/crypto/bio/socket_helper.c
@@ -12,8 +12,7 @@
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
-#undef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE 200112L
+#define _POSIX_SOURCE
#include <openssl/bio.h>
#include <openssl/err.h>
@@ -51,7 +50,7 @@ int bio_ip_and_port_to_socket_and_addr(int *out_sock,
ret = getaddrinfo(hostname, port_str, &hint, &result);
if (ret != 0) {
- OPENSSL_PUT_ERROR(SYS, 0);
+ OPENSSL_PUT_ERROR(SYS, getaddrinfo, 0);
ERR_add_error_data(1, gai_strerror(ret));
return 0;
}