OpenSSL 1.1.1-pre2
This commit is contained in:
+18
-16
@@ -9,7 +9,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#define USE_SOCKETS
|
||||
#include "bio_lcl.h"
|
||||
#include "internal/cryptlib.h"
|
||||
|
||||
@@ -38,7 +37,11 @@ int BIO_sock_should_retry(int s);
|
||||
static const BIO_METHOD methods_sockp = {
|
||||
BIO_TYPE_SOCKET,
|
||||
"socket",
|
||||
/* TODO: Convert to new style write function */
|
||||
bwrite_conv,
|
||||
sock_write,
|
||||
/* TODO: Convert to new style read function */
|
||||
bread_conv,
|
||||
sock_read,
|
||||
sock_puts,
|
||||
NULL, /* sock_gets, */
|
||||
@@ -50,7 +53,7 @@ static const BIO_METHOD methods_sockp = {
|
||||
|
||||
const BIO_METHOD *BIO_s_socket(void)
|
||||
{
|
||||
return (&methods_sockp);
|
||||
return &methods_sockp;
|
||||
}
|
||||
|
||||
BIO *BIO_new_socket(int fd, int close_flag)
|
||||
@@ -59,9 +62,9 @@ BIO *BIO_new_socket(int fd, int close_flag)
|
||||
|
||||
ret = BIO_new(BIO_s_socket());
|
||||
if (ret == NULL)
|
||||
return (NULL);
|
||||
return NULL;
|
||||
BIO_set_fd(ret, fd, close_flag);
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sock_new(BIO *bi)
|
||||
@@ -70,13 +73,13 @@ static int sock_new(BIO *bi)
|
||||
bi->num = 0;
|
||||
bi->ptr = NULL;
|
||||
bi->flags = 0;
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int sock_free(BIO *a)
|
||||
{
|
||||
if (a == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
if (a->shutdown) {
|
||||
if (a->init) {
|
||||
BIO_closesocket(a->num);
|
||||
@@ -84,7 +87,7 @@ static int sock_free(BIO *a)
|
||||
a->init = 0;
|
||||
a->flags = 0;
|
||||
}
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int sock_read(BIO *b, char *out, int outl)
|
||||
@@ -100,7 +103,7 @@ static int sock_read(BIO *b, char *out, int outl)
|
||||
BIO_set_retry_read(b);
|
||||
}
|
||||
}
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sock_write(BIO *b, const char *in, int inl)
|
||||
@@ -114,7 +117,7 @@ static int sock_write(BIO *b, const char *in, int inl)
|
||||
if (BIO_sock_should_retry(ret))
|
||||
BIO_set_retry_write(b);
|
||||
}
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static long sock_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
@@ -152,7 +155,7 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sock_puts(BIO *bp, const char *str)
|
||||
@@ -161,7 +164,7 @@ static int sock_puts(BIO *bp, const char *str)
|
||||
|
||||
n = strlen(str);
|
||||
ret = sock_write(bp, str, n);
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int BIO_sock_should_retry(int i)
|
||||
@@ -171,9 +174,9 @@ int BIO_sock_should_retry(int i)
|
||||
if ((i == 0) || (i == -1)) {
|
||||
err = get_last_socket_error();
|
||||
|
||||
return (BIO_sock_non_fatal_error(err));
|
||||
return BIO_sock_non_fatal_error(err);
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BIO_sock_non_fatal_error(int err)
|
||||
@@ -220,12 +223,11 @@ int BIO_sock_non_fatal_error(int err)
|
||||
# ifdef EALREADY
|
||||
case EALREADY:
|
||||
# endif
|
||||
return (1);
|
||||
/* break; */
|
||||
return 1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* #ifndef OPENSSL_NO_SOCK */
|
||||
Reference in New Issue
Block a user