Loading crypto/bio/bf_buff.c +16 −0 Original line number Diff line number Diff line Loading @@ -255,6 +255,11 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) return (0); ret = BIO_ctrl(b->next_bio, cmd, num, ptr); break; case BIO_CTRL_EOF: if (ctx->ibuf_len > 0) return 0; ret = BIO_ctrl(b->next_bio, cmd, num, ptr); break; case BIO_CTRL_INFO: ret = (long)ctx->obuf_len; break; Loading Loading @@ -380,6 +385,17 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) !BIO_set_write_buffer_size(dbio, ctx->obuf_size)) ret = 0; break; case BIO_CTRL_PEEK: /* Ensure there's stuff in the input buffer */ { char fake_buf[1]; (void)buffer_read(b, fake_buf, 0); } if (num > ctx->ibuf_len) num = ctx->ibuf_len; memcpy(ptr, &(ctx->ibuf[ctx->ibuf_off]), num); ret = num; break; default: if (b->next_bio == NULL) return (0); Loading include/openssl/bio.h +2 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ extern "C" { # define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */ # define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */ # define BIO_CTRL_PEEK 29/* BIO_f_buffer special */ # define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */ /* dgram BIO stuff */ Loading Loading @@ -494,6 +495,7 @@ size_t BIO_ctrl_wpending(BIO *b); /* For the BIO_f_buffer() type */ # define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) # define BIO_buffer_peek(b,s,l) BIO_ctrl(b,BIO_CTRL_PEEK,(l),(s)) /* For BIO_s_bio() */ # define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) Loading Loading
crypto/bio/bf_buff.c +16 −0 Original line number Diff line number Diff line Loading @@ -255,6 +255,11 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) return (0); ret = BIO_ctrl(b->next_bio, cmd, num, ptr); break; case BIO_CTRL_EOF: if (ctx->ibuf_len > 0) return 0; ret = BIO_ctrl(b->next_bio, cmd, num, ptr); break; case BIO_CTRL_INFO: ret = (long)ctx->obuf_len; break; Loading Loading @@ -380,6 +385,17 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) !BIO_set_write_buffer_size(dbio, ctx->obuf_size)) ret = 0; break; case BIO_CTRL_PEEK: /* Ensure there's stuff in the input buffer */ { char fake_buf[1]; (void)buffer_read(b, fake_buf, 0); } if (num > ctx->ibuf_len) num = ctx->ibuf_len; memcpy(ptr, &(ctx->ibuf[ctx->ibuf_off]), num); ret = num; break; default: if (b->next_bio == NULL) return (0); Loading
include/openssl/bio.h +2 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ extern "C" { # define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */ # define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */ # define BIO_CTRL_PEEK 29/* BIO_f_buffer special */ # define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */ /* dgram BIO stuff */ Loading Loading @@ -494,6 +495,7 @@ size_t BIO_ctrl_wpending(BIO *b); /* For the BIO_f_buffer() type */ # define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) # define BIO_buffer_peek(b,s,l) BIO_ctrl(b,BIO_CTRL_PEEK,(l),(s)) /* For BIO_s_bio() */ # define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) Loading