OpenSSL 1.1.1-pre2

This commit is contained in:
Hakase
2018-04-07 17:29:40 +09:00
parent 82a44d2483
commit bbac8ca55d
17755 changed files with 221242 additions and 98415 deletions
+23 -18
View File
@@ -60,7 +60,11 @@ int BIO_fd_should_retry(int s);
static const BIO_METHOD methods_fdp = {
BIO_TYPE_FD,
"file descriptor",
/* TODO: Convert to new style write function */
bwrite_conv,
fd_write,
/* TODO: Convert to new style read function */
bread_conv,
fd_read,
fd_puts,
fd_gets,
@@ -72,7 +76,7 @@ static const BIO_METHOD methods_fdp = {
const BIO_METHOD *BIO_s_fd(void)
{
return (&methods_fdp);
return &methods_fdp;
}
BIO *BIO_new_fd(int fd, int close_flag)
@@ -80,9 +84,9 @@ BIO *BIO_new_fd(int fd, int close_flag)
BIO *ret;
ret = BIO_new(BIO_s_fd());
if (ret == NULL)
return (NULL);
return NULL;
BIO_set_fd(ret, fd, close_flag);
return (ret);
return ret;
}
static int fd_new(BIO *bi)
@@ -91,13 +95,13 @@ static int fd_new(BIO *bi)
bi->num = -1;
bi->ptr = NULL;
bi->flags = BIO_FLAGS_UPLINK; /* essentially redundant */
return (1);
return 1;
}
static int fd_free(BIO *a)
{
if (a == NULL)
return (0);
return 0;
if (a->shutdown) {
if (a->init) {
UP_close(a->num);
@@ -105,7 +109,7 @@ static int fd_free(BIO *a)
a->init = 0;
a->flags = BIO_FLAGS_UPLINK;
}
return (1);
return 1;
}
static int fd_read(BIO *b, char *out, int outl)
@@ -121,7 +125,7 @@ static int fd_read(BIO *b, char *out, int outl)
BIO_set_retry_read(b);
}
}
return (ret);
return ret;
}
static int fd_write(BIO *b, const char *in, int inl)
@@ -134,7 +138,7 @@ static int fd_write(BIO *b, const char *in, int inl)
if (BIO_fd_should_retry(ret))
BIO_set_retry_write(b);
}
return (ret);
return ret;
}
static long fd_ctrl(BIO *b, int cmd, long num, void *ptr)
@@ -186,7 +190,7 @@ static long fd_ctrl(BIO *b, int cmd, long num, void *ptr)
ret = 0;
break;
}
return (ret);
return ret;
}
static int fd_puts(BIO *bp, const char *str)
@@ -195,7 +199,7 @@ static int fd_puts(BIO *bp, const char *str)
n = strlen(str);
ret = fd_write(bp, str, n);
return (ret);
return ret;
}
static int fd_gets(BIO *bp, char *buf, int size)
@@ -204,14 +208,16 @@ static int fd_gets(BIO *bp, char *buf, int size)
char *ptr = buf;
char *end = buf + size - 1;
while ((ptr < end) && (fd_read(bp, ptr, 1) > 0) && (ptr[0] != '\n'))
ptr++;
while (ptr < end && fd_read(bp, ptr, 1) > 0) {
if (*ptr++ == '\n')
break;
}
ptr[0] = '\0';
if (buf[0] != '\0')
ret = strlen(buf);
return (ret);
return ret;
}
int BIO_fd_should_retry(int i)
@@ -221,9 +227,9 @@ int BIO_fd_should_retry(int i)
if ((i == 0) || (i == -1)) {
err = get_last_sys_error();
return (BIO_fd_non_fatal_error(err));
return BIO_fd_non_fatal_error(err);
}
return (0);
return 0;
}
int BIO_fd_non_fatal_error(int err)
@@ -265,11 +271,10 @@ int BIO_fd_non_fatal_error(int err)
# ifdef EALREADY
case EALREADY:
# endif
return (1);
/* break; */
return 1;
default:
break;
}
return (0);
return 0;
}
#endif