ostream-openssl.c revision 31df48d66a9a2327f6de41796e6819543c4494e1
/* Copyright (c) 2009-2014 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "buffer.h"
#include "ostream-private.h"
#include "iostream-openssl.h"
struct ssl_ostream {
struct ostream_private ostream;
struct ssl_iostream *ssl_io;
};
static void
{
if (close_parent)
}
{
}
static size_t
{
unsigned int i;
for (i = 0; i < iov_count; i++) {
break;
}
/* we're requeted to use whatever space is available in
the buffer */
} else {
}
size);
bytes_sent += size;
i = iov_count;
}
if (avail > 0)
for (; i < iov_count; i++) {
bytes_sent += size;
break;
}
return bytes_sent;
}
{
int ret = 1;
/* we're writing plaintext data to OpenSSL, which it encrypts
and writes to bio_int's buffer. ssl_iostream_bio_sync()
reads it from there and adds to plain_output stream. */
if (ret <= 0) {
ret, "SSL_write");
if (ret < 0) {
break;
}
if (ret == 0)
break;
} else {
}
}
}
{
int ret;
/* handshake failed */
/* we can try to send some of our buffered data */
}
/* we need to read more data until we can continue. */
FALSE);
ret = 1;
}
return ret;
}
static ssize_t
{
size_t bytes_sent = 0;
/* buffer was empty before calling this. try to write it
immediately. */
if (o_stream_ssl_flush_buffer(sstream) < 0)
return -1;
}
return bytes_sent;
}
{
}
{
/* try to actually flush the pending data */
return -1;
/* we may be able to copy more data, try it */
else
if (ret2 == 0)
if (ret2 < 0)
return -1;
}
{
}
static void
{
}
{
}
{
struct ssl_ostream *sstream;
}