Lines Matching refs:ctx

58     BIO_LINEBUFFER_CTX *ctx;
60 if ((ctx = OPENSSL_malloc(sizeof(*ctx))) == NULL) {
64 ctx->obuf = OPENSSL_malloc(DEFAULT_LINEBUFFER_SIZE);
65 if (ctx->obuf == NULL) {
67 OPENSSL_free(ctx);
70 ctx->obuf_size = DEFAULT_LINEBUFFER_SIZE;
71 ctx->obuf_len = 0;
74 bi->ptr = (char *)ctx;
111 BIO_LINEBUFFER_CTX *ctx;
115 ctx = (BIO_LINEBUFFER_CTX *)b->ptr;
116 if ((ctx == NULL) || (b->next_bio == NULL))
136 while ((foundnl || p - in > ctx->obuf_size - ctx->obuf_len)
137 && ctx->obuf_len > 0) {
138 int orig_olen = ctx->obuf_len;
140 i = ctx->obuf_size - ctx->obuf_len;
143 memcpy(&(ctx->obuf[ctx->obuf_len]), in, p - in);
144 ctx->obuf_len += p - in;
149 memcpy(&(ctx->obuf[ctx->obuf_len]), in, i);
150 ctx->obuf_len += i;
156 i = BIO_write(b->next_bio, ctx->obuf, ctx->obuf_len);
158 ctx->obuf_len = orig_olen;
166 if (i < ctx->obuf_len)
167 memmove(ctx->obuf, ctx->obuf + i, ctx->obuf_len - i);
168 ctx->obuf_len -= i;
175 if ((foundnl || p - in > ctx->obuf_size) && p - in > 0) {
196 memcpy(&(ctx->obuf[ctx->obuf_len]), in, inl);
197 ctx->obuf_len += inl;
206 BIO_LINEBUFFER_CTX *ctx;
212 ctx = (BIO_LINEBUFFER_CTX *)b->ptr;
216 ctx->obuf_len = 0;
222 ret = (long)ctx->obuf_len;
225 ret = (long)ctx->obuf_len;
236 p = ctx->obuf;
237 if ((obs > DEFAULT_LINEBUFFER_SIZE) && (obs != ctx->obuf_size)) {
242 if (ctx->obuf != p) {
243 if (ctx->obuf_len > obs) {
244 ctx->obuf_len = obs;
246 memcpy(p, ctx->obuf, ctx->obuf_len);
247 OPENSSL_free(ctx->obuf);
248 ctx->obuf = p;
249 ctx->obuf_size = obs;
263 if (ctx->obuf_len <= 0) {
270 if (ctx->obuf_len > 0) {
271 r = BIO_write(b->next_bio, ctx->obuf, ctx->obuf_len);
275 if (r < ctx->obuf_len)
276 memmove(ctx->obuf, ctx->obuf + r, ctx->obuf_len - r);
277 ctx->obuf_len -= r;
279 ctx->obuf_len = 0;
287 if (BIO_set_write_buffer_size(dbio, ctx->obuf_size) <= 0)