Only use recv/send for socket BIOs on Windows.
In OpenSSL, socket BIOs only used recv/send on Windows and read/write on POSIX. Align our socket BIOs with that behavior. This should be a no-op, but avoids frustrating consumers overly sensitive to the syscalls used now that SSL_set_fd has switched to socket BIOs to align with OpenSSL. b/28138582. Change-Id: Id4870ef8e668e587d6ef51c5b5f21e03af66a288 Reviewed-on: https://boringssl-review.googlesource.com/7686 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
919610b4c4
commit
26993ad55e
@ -110,7 +110,11 @@ static int sock_read(BIO *b, char *out, int outl) {
|
||||
}
|
||||
|
||||
bio_clear_socket_error();
|
||||
#if defined(OPENSSL_WINDOWS)
|
||||
ret = recv(b->num, out, outl, 0);
|
||||
#else
|
||||
ret = read(b->num, out, outl);
|
||||
#endif
|
||||
BIO_clear_retry_flags(b);
|
||||
if (ret <= 0) {
|
||||
if (bio_fd_should_retry(ret)) {
|
||||
@ -124,7 +128,11 @@ static int sock_write(BIO *b, const char *in, int inl) {
|
||||
int ret;
|
||||
|
||||
bio_clear_socket_error();
|
||||
#if defined(OPENSSL_WINDOWS)
|
||||
ret = send(b->num, in, inl, 0);
|
||||
#else
|
||||
ret = write(b->num, in, inl);
|
||||
#endif
|
||||
BIO_clear_retry_flags(b);
|
||||
if (ret <= 0) {
|
||||
if (bio_fd_should_retry(ret)) {
|
||||
|
@ -529,9 +529,9 @@ OPENSSL_EXPORT int BIO_set_write_buffer_size(BIO *bio, int buffer_size);
|
||||
|
||||
/* Socket BIOs.
|
||||
*
|
||||
* Socket BIOs behave like file descriptor BIOs but wrap the system's |recv|
|
||||
* and |send| functions. This is relevant for Windows systems where file
|
||||
* descriptors, provided by C runtime for use with |read| and |write|, are not
|
||||
* Socket BIOs behave like file descriptor BIOs but, on Windows systems, wrap
|
||||
* the system's |recv| and |send| functions instead of |read| and |write|. On
|
||||
* Windows, file descriptors are provided by C runtime and are not
|
||||
* interchangeable with sockets.
|
||||
*
|
||||
* Socket BIOs may be used with |BIO_set_fd| and |BIO_get_fd|.
|
||||
|
Loading…
Reference in New Issue
Block a user