#include <errno.h>
#include "cryptlib.h"
#include <openssl/bio.h>
-#include <openssl/evp.h>
static int buffer_write(BIO *h, const char *buf,int num);
static int buffer_read(BIO *h, char *buf, int size);
static int buffer_new(BIO *h);
static int buffer_free(BIO *data);
static long buffer_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
-#define DEFAULT_BUFFER_SIZE 1024
+#define DEFAULT_BUFFER_SIZE 4096
static BIO_METHOD methods_buffer=
{
size-=i;
ctx->ibuf_len-=i;
ctx->ibuf_off+=i;
- if ((flag) || (i == size))
+ if (flag || size == 0)
{
*buf='\0';
return(num);
if (i <= 0)
{
BIO_copy_next_retry(b);
+ *buf='\0';
if (i < 0) return((num > 0)?num:i);
if (i == 0) return(num);
}
static int buffer_puts(BIO *b, const char *str)
{
- return(BIO_write(b,str,strlen(str)));
+ return(buffer_write(b,str,strlen(str)));
}