Lines Matching refs:bio
92 int BIO_free(BIO *bio) { in BIO_free() argument
95 for (; bio != NULL; bio = next_bio) { in BIO_free()
96 if (!CRYPTO_refcount_dec_and_test_zero(&bio->references)) { in BIO_free()
100 next_bio = BIO_pop(bio); in BIO_free()
102 if (bio->method != NULL && bio->method->destroy != NULL) { in BIO_free()
103 bio->method->destroy(bio); in BIO_free()
106 OPENSSL_free(bio); in BIO_free()
111 int BIO_up_ref(BIO *bio) { in BIO_up_ref() argument
112 CRYPTO_refcount_inc(&bio->references); in BIO_up_ref()
116 void BIO_vfree(BIO *bio) { in BIO_vfree() argument
117 BIO_free(bio); in BIO_vfree()
120 void BIO_free_all(BIO *bio) { in BIO_free_all() argument
121 BIO_free(bio); in BIO_free_all()
124 int BIO_read(BIO *bio, void *buf, int len) { in BIO_read() argument
125 if (bio == NULL || bio->method == NULL || bio->method->bread == NULL) { in BIO_read()
129 if (!bio->init) { in BIO_read()
136 int ret = bio->method->bread(bio, buf, len); in BIO_read()
138 bio->num_read += ret; in BIO_read()
143 int BIO_gets(BIO *bio, char *buf, int len) { in BIO_gets() argument
144 if (bio == NULL || bio->method == NULL || bio->method->bgets == NULL) { in BIO_gets()
148 if (!bio->init) { in BIO_gets()
155 int ret = bio->method->bgets(bio, buf, len); in BIO_gets()
157 bio->num_read += ret; in BIO_gets()
162 int BIO_write(BIO *bio, const void *in, int inl) { in BIO_write() argument
163 if (bio == NULL || bio->method == NULL || bio->method->bwrite == NULL) { in BIO_write()
167 if (!bio->init) { in BIO_write()
174 int ret = bio->method->bwrite(bio, in, inl); in BIO_write()
176 bio->num_write += ret; in BIO_write()
181 int BIO_write_all(BIO *bio, const void *data, size_t len) { in BIO_write_all() argument
184 int ret = BIO_write(bio, data_u8, len > INT_MAX ? INT_MAX : (int)len); in BIO_write_all()
194 int BIO_puts(BIO *bio, const char *in) { in BIO_puts() argument
195 return BIO_write(bio, in, strlen(in)); in BIO_puts()
198 int BIO_flush(BIO *bio) { in BIO_flush() argument
199 return BIO_ctrl(bio, BIO_CTRL_FLUSH, 0, NULL); in BIO_flush()
202 long BIO_ctrl(BIO *bio, int cmd, long larg, void *parg) { in BIO_ctrl() argument
203 if (bio == NULL) { in BIO_ctrl()
207 if (bio->method == NULL || bio->method->ctrl == NULL) { in BIO_ctrl()
212 return bio->method->ctrl(bio, cmd, larg, parg); in BIO_ctrl()
231 int BIO_reset(BIO *bio) { in BIO_reset() argument
232 return BIO_ctrl(bio, BIO_CTRL_RESET, 0, NULL); in BIO_reset()
235 int BIO_eof(BIO *bio) { in BIO_eof() argument
236 return BIO_ctrl(bio, BIO_CTRL_EOF, 0, NULL); in BIO_eof()
239 void BIO_set_flags(BIO *bio, int flags) { in BIO_set_flags() argument
240 bio->flags |= flags; in BIO_set_flags()
243 int BIO_test_flags(const BIO *bio, int flags) { in BIO_test_flags() argument
244 return bio->flags & flags; in BIO_test_flags()
247 int BIO_should_read(const BIO *bio) { in BIO_should_read() argument
248 return BIO_test_flags(bio, BIO_FLAGS_READ); in BIO_should_read()
251 int BIO_should_write(const BIO *bio) { in BIO_should_write() argument
252 return BIO_test_flags(bio, BIO_FLAGS_WRITE); in BIO_should_write()
255 int BIO_should_retry(const BIO *bio) { in BIO_should_retry() argument
256 return BIO_test_flags(bio, BIO_FLAGS_SHOULD_RETRY); in BIO_should_retry()
259 int BIO_should_io_special(const BIO *bio) { in BIO_should_io_special() argument
260 return BIO_test_flags(bio, BIO_FLAGS_IO_SPECIAL); in BIO_should_io_special()
263 int BIO_get_retry_reason(const BIO *bio) { return bio->retry_reason; } in BIO_get_retry_reason() argument
265 void BIO_clear_flags(BIO *bio, int flags) { in BIO_clear_flags() argument
266 bio->flags &= ~flags; in BIO_clear_flags()
269 void BIO_set_retry_read(BIO *bio) { in BIO_set_retry_read() argument
270 bio->flags |= BIO_FLAGS_READ | BIO_FLAGS_SHOULD_RETRY; in BIO_set_retry_read()
273 void BIO_set_retry_write(BIO *bio) { in BIO_set_retry_write() argument
274 bio->flags |= BIO_FLAGS_WRITE | BIO_FLAGS_SHOULD_RETRY; in BIO_set_retry_write()
279 int BIO_get_retry_flags(BIO *bio) { in BIO_get_retry_flags() argument
280 return bio->flags & kRetryFlags; in BIO_get_retry_flags()
283 void BIO_clear_retry_flags(BIO *bio) { in BIO_clear_retry_flags() argument
284 bio->flags &= ~kRetryFlags; in BIO_clear_retry_flags()
285 bio->retry_reason = 0; in BIO_clear_retry_flags()
288 int BIO_method_type(const BIO *bio) { return bio->method->type; } in BIO_method_type() argument
290 void BIO_copy_next_retry(BIO *bio) { in BIO_copy_next_retry() argument
291 BIO_clear_retry_flags(bio); in BIO_copy_next_retry()
292 BIO_set_flags(bio, BIO_get_retry_flags(bio->next_bio)); in BIO_copy_next_retry()
293 bio->retry_reason = bio->next_bio->retry_reason; in BIO_copy_next_retry()
296 long BIO_callback_ctrl(BIO *bio, int cmd, bio_info_cb fp) { in BIO_callback_ctrl() argument
297 if (bio == NULL) { in BIO_callback_ctrl()
301 if (bio->method == NULL || bio->method->callback_ctrl == NULL) { in BIO_callback_ctrl()
306 return bio->method->callback_ctrl(bio, cmd, fp); in BIO_callback_ctrl()
309 size_t BIO_pending(const BIO *bio) { in BIO_pending() argument
310 const long r = BIO_ctrl((BIO *) bio, BIO_CTRL_PENDING, 0, NULL); in BIO_pending()
319 size_t BIO_ctrl_pending(const BIO *bio) { in BIO_ctrl_pending() argument
320 return BIO_pending(bio); in BIO_ctrl_pending()
323 size_t BIO_wpending(const BIO *bio) { in BIO_wpending() argument
324 const long r = BIO_ctrl((BIO *) bio, BIO_CTRL_WPENDING, 0, NULL); in BIO_wpending()
333 int BIO_set_close(BIO *bio, int close_flag) { in BIO_set_close() argument
334 return BIO_ctrl(bio, BIO_CTRL_SET_CLOSE, close_flag, NULL); in BIO_set_close()
337 OPENSSL_EXPORT size_t BIO_number_read(const BIO *bio) { in BIO_number_read() argument
338 return bio->num_read; in BIO_number_read()
341 OPENSSL_EXPORT size_t BIO_number_written(const BIO *bio) { in BIO_number_written() argument
342 return bio->num_write; in BIO_number_written()
345 BIO *BIO_push(BIO *bio, BIO *appended_bio) { in BIO_push() argument
348 if (bio == NULL) { in BIO_push()
349 return bio; in BIO_push()
352 last_bio = bio; in BIO_push()
358 return bio; in BIO_push()
361 BIO *BIO_pop(BIO *bio) { in BIO_pop() argument
364 if (bio == NULL) { in BIO_pop()
367 ret = bio->next_bio; in BIO_pop()
368 bio->next_bio = NULL; in BIO_pop()
372 BIO *BIO_next(BIO *bio) { in BIO_next() argument
373 if (!bio) { in BIO_next()
376 return bio->next_bio; in BIO_next()
379 BIO *BIO_find_type(BIO *bio, int type) { in BIO_find_type() argument
382 if (!bio) { in BIO_find_type()
388 if (bio->method != NULL) { in BIO_find_type()
389 method_type = bio->method->type; in BIO_find_type()
393 return bio; in BIO_find_type()
396 return bio; in BIO_find_type()
399 bio = bio->next_bio; in BIO_find_type()
400 } while (bio != NULL); in BIO_find_type()
405 int BIO_indent(BIO *bio, unsigned indent, unsigned max_indent) { in BIO_indent() argument
411 if (BIO_puts(bio, " ") != 1) { in BIO_indent()
418 static int print_bio(const char *str, size_t len, void *bio) { in print_bio() argument
419 return BIO_write((BIO *)bio, str, len); in print_bio()
422 void ERR_print_errors(BIO *bio) { in ERR_print_errors() argument
423 ERR_print_errors_cb(print_bio, bio); in ERR_print_errors()
434 static int bio_read_all(BIO *bio, uint8_t **out, size_t *out_len, in bio_read_all() argument
460 const int n = BIO_read(bio, *out + done, todo); in bio_read_all()
490 static int bio_read_full(BIO *bio, uint8_t *out, int *out_eof_on_first_read, in bio_read_full() argument
495 int ret = BIO_read(bio, out, todo); in bio_read_full()
517 int BIO_read_asn1(BIO *bio, uint8_t **out, size_t *out_len, size_t max_len) { in OPENSSL_DECLARE_ERROR_REASON()
522 if (!bio_read_full(bio, header, &eof_on_first_read, kInitialHeaderLen)) { in OPENSSL_DECLARE_ERROR_REASON()
553 if (!bio_read_all(bio, out, out_len, header, kInitialHeaderLen, in OPENSSL_DECLARE_ERROR_REASON()
566 if (!bio_read_full(bio, header + kInitialHeaderLen, NULL, num_bytes)) { in OPENSSL_DECLARE_ERROR_REASON()
608 if (!bio_read_full(bio, (*out) + header_len, NULL, len - header_len)) { in OPENSSL_DECLARE_ERROR_REASON()
617 void BIO_set_retry_special(BIO *bio) { in BIO_set_retry_special() argument
618 bio->flags |= BIO_FLAGS_READ | BIO_FLAGS_IO_SPECIAL; in BIO_set_retry_special()
621 int BIO_set_write_buffer_size(BIO *bio, int buffer_size) { return 0; } in BIO_set_write_buffer_size() argument
685 void BIO_set_data(BIO *bio, void *ptr) { bio->ptr = ptr; } in BIO_set_data() argument
687 void *BIO_get_data(BIO *bio) { return bio->ptr; } in BIO_get_data() argument
689 void BIO_set_init(BIO *bio, int init) { bio->init = init; } in BIO_set_init() argument
691 int BIO_get_init(BIO *bio) { return bio->init; } in BIO_get_init() argument
693 void BIO_set_shutdown(BIO *bio, int shutdown) { bio->shutdown = shutdown; } in BIO_set_shutdown() argument
695 int BIO_get_shutdown(BIO *bio) { return bio->shutdown; } in BIO_get_shutdown() argument