18# include <openssl/macros.h>
19# ifndef OPENSSL_NO_DEPRECATED_3_0
23# include <openssl/e_os2.h>
25# ifndef OPENSSL_NO_STDIO
30# include <openssl/crypto.h>
31# include <openssl/bioerr.h>
32# include <openssl/core.h>
39# define BIO_TYPE_DESCRIPTOR 0x0100
40# define BIO_TYPE_FILTER 0x0200
41# define BIO_TYPE_SOURCE_SINK 0x0400
44# define BIO_TYPE_NONE 0
45# define BIO_TYPE_MEM ( 1|BIO_TYPE_SOURCE_SINK)
46# define BIO_TYPE_FILE ( 2|BIO_TYPE_SOURCE_SINK)
48# define BIO_TYPE_FD ( 4|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
49# define BIO_TYPE_SOCKET ( 5|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
50# define BIO_TYPE_NULL ( 6|BIO_TYPE_SOURCE_SINK)
51# define BIO_TYPE_SSL ( 7|BIO_TYPE_FILTER)
52# define BIO_TYPE_MD ( 8|BIO_TYPE_FILTER)
53# define BIO_TYPE_BUFFER ( 9|BIO_TYPE_FILTER)
54# define BIO_TYPE_CIPHER (10|BIO_TYPE_FILTER)
55# define BIO_TYPE_BASE64 (11|BIO_TYPE_FILTER)
56# define BIO_TYPE_CONNECT (12|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
57# define BIO_TYPE_ACCEPT (13|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
59# define BIO_TYPE_NBIO_TEST (16|BIO_TYPE_FILTER)
60# define BIO_TYPE_NULL_FILTER (17|BIO_TYPE_FILTER)
61# define BIO_TYPE_BIO (19|BIO_TYPE_SOURCE_SINK)
62# define BIO_TYPE_LINEBUFFER (20|BIO_TYPE_FILTER)
63# define BIO_TYPE_DGRAM (21|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
64# define BIO_TYPE_ASN1 (22|BIO_TYPE_FILTER)
65# define BIO_TYPE_COMP (23|BIO_TYPE_FILTER)
66# ifndef OPENSSL_NO_SCTP
67# define BIO_TYPE_DGRAM_SCTP (24|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR)
69# define BIO_TYPE_CORE_TO_PROV (25|BIO_TYPE_SOURCE_SINK)
71#define BIO_TYPE_START 128
77# define BIO_NOCLOSE 0x00
78# define BIO_CLOSE 0x01
83# define BIO_CTRL_RESET 1
84# define BIO_CTRL_EOF 2
85# define BIO_CTRL_INFO 3
86# define BIO_CTRL_SET 4
87# define BIO_CTRL_GET 5
88# define BIO_CTRL_PUSH 6
89# define BIO_CTRL_POP 7
90# define BIO_CTRL_GET_CLOSE 8
91# define BIO_CTRL_SET_CLOSE 9
92# define BIO_CTRL_PENDING 10
93# define BIO_CTRL_FLUSH 11
94# define BIO_CTRL_DUP 12
95# define BIO_CTRL_WPENDING 13
96# define BIO_CTRL_SET_CALLBACK 14
97# define BIO_CTRL_GET_CALLBACK 15
99# define BIO_CTRL_PEEK 29
100# define BIO_CTRL_SET_FILENAME 30
103# define BIO_CTRL_DGRAM_CONNECT 31
104# define BIO_CTRL_DGRAM_SET_CONNECTED 32
106# define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33
107# define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34
108# define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35
109# define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36
111# define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37
112# define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38
115# define BIO_CTRL_DGRAM_MTU_DISCOVER 39
118# define BIO_CTRL_DGRAM_QUERY_MTU 40
119# define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47
120# define BIO_CTRL_DGRAM_GET_MTU 41
121# define BIO_CTRL_DGRAM_SET_MTU 42
125# define BIO_CTRL_DGRAM_MTU_EXCEEDED 43
129# define BIO_CTRL_DGRAM_GET_PEER 46
130# define BIO_CTRL_DGRAM_SET_PEER 44
132# define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45
134# define BIO_CTRL_DGRAM_SET_DONT_FRAG 48
136# define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49
139# define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50
140# ifndef OPENSSL_NO_SCTP
142# define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51
143# define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52
144# define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53
145# define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60
146# define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61
147# define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62
148# define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63
149# define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64
150# define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65
151# define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70
154# define BIO_CTRL_DGRAM_SET_PEEK_MODE 71
163# define BIO_CTRL_GET_KTLS_SEND 73
164# define BIO_CTRL_GET_KTLS_RECV 76
166# define BIO_CTRL_DGRAM_SCTP_WAIT_FOR_DRY 77
167# define BIO_CTRL_DGRAM_SCTP_MSG_WAITING 78
170# define BIO_CTRL_SET_PREFIX 79
171# define BIO_CTRL_SET_INDENT 80
172# define BIO_CTRL_GET_INDENT 81
174# ifndef OPENSSL_NO_KTLS
175# define BIO_get_ktls_send(b) \
176 (BIO_ctrl(b, BIO_CTRL_GET_KTLS_SEND, 0, NULL) > 0)
177# define BIO_get_ktls_recv(b) \
178 (BIO_ctrl(b, BIO_CTRL_GET_KTLS_RECV, 0, NULL) > 0)
180# define BIO_get_ktls_send(b) (0)
181# define BIO_get_ktls_recv(b) (0)
185# define BIO_FP_READ 0x02
186# define BIO_FP_WRITE 0x04
187# define BIO_FP_APPEND 0x08
188# define BIO_FP_TEXT 0x10
190# define BIO_FLAGS_READ 0x01
191# define BIO_FLAGS_WRITE 0x02
192# define BIO_FLAGS_IO_SPECIAL 0x04
193# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
194# define BIO_FLAGS_SHOULD_RETRY 0x08
195# ifndef OPENSSL_NO_DEPRECATED_3_0
197# define BIO_FLAGS_UPLINK 0
200# define BIO_FLAGS_BASE64_NO_NL 0x100
207# define BIO_FLAGS_MEM_RDONLY 0x200
208# define BIO_FLAGS_NONCLEAR_RST 0x400
209# define BIO_FLAGS_IN_EOF 0x800
213typedef union bio_addr_st BIO_ADDR;
214typedef struct bio_addrinfo_st BIO_ADDRINFO;
216int BIO_get_new_index(
void);
217void BIO_set_flags(BIO *b,
int flags);
218int BIO_test_flags(
const BIO *b,
int flags);
219void BIO_clear_flags(BIO *b,
int flags);
221# define BIO_get_flags(b) BIO_test_flags(b, ~(0x0))
222# define BIO_set_retry_special(b) \
223 BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY))
224# define BIO_set_retry_read(b) \
225 BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY))
226# define BIO_set_retry_write(b) \
227 BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY))
230# define BIO_clear_retry_flags(b) \
231 BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
232# define BIO_get_retry_flags(b) \
233 BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
236# define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ)
237# define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE)
238# define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL)
239# define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS)
240# define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY)
252# define BIO_RR_SSL_X509_LOOKUP 0x01
254# define BIO_RR_CONNECT 0x02
256# define BIO_RR_ACCEPT 0x03
259# define BIO_CB_FREE 0x01
260# define BIO_CB_READ 0x02
261# define BIO_CB_WRITE 0x03
262# define BIO_CB_PUTS 0x04
263# define BIO_CB_GETS 0x05
264# define BIO_CB_CTRL 0x06
270# define BIO_CB_RETURN 0x80
271# define BIO_CB_return(a) ((a)|BIO_CB_RETURN)
272# define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN))
273# define BIO_cb_post(a) ((a)&BIO_CB_RETURN)
275# ifndef OPENSSL_NO_DEPRECATED_3_0
276typedef long (*BIO_callback_fn)(BIO *b,
int oper,
const char *argp,
int argi,
277 long argl,
long ret);
278OSSL_DEPRECATEDIN_3_0 BIO_callback_fn BIO_get_callback(
const BIO *b);
279OSSL_DEPRECATEDIN_3_0
void BIO_set_callback(BIO *b, BIO_callback_fn callback);
280OSSL_DEPRECATEDIN_3_0
long BIO_debug_callback(BIO *bio,
int cmd,
281 const char *argp,
int argi,
282 long argl,
long ret);
285typedef long (*BIO_callback_fn_ex)(BIO *b,
int oper,
const char *argp,
286 size_t len,
int argi,
287 long argl,
int ret,
size_t *processed);
288BIO_callback_fn_ex BIO_get_callback_ex(
const BIO *b);
289void BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback);
290long BIO_debug_callback_ex(BIO *bio,
int oper,
const char *argp,
size_t len,
291 int argi,
long argl,
int ret,
size_t *processed);
293char *BIO_get_callback_arg(
const BIO *b);
294void BIO_set_callback_arg(BIO *b,
char *arg);
296typedef struct bio_method_st BIO_METHOD;
298const char *BIO_method_name(
const BIO *b);
299int BIO_method_type(
const BIO *b);
301typedef int BIO_info_cb(BIO *,
int,
int);
302typedef BIO_info_cb bio_info_cb;
304SKM_DEFINE_STACK_OF_INTERNAL(BIO, BIO, BIO)
305#define sk_BIO_num(sk) OPENSSL_sk_num(ossl_check_const_BIO_sk_type(sk))
306#define sk_BIO_value(sk, idx) ((BIO *)OPENSSL_sk_value(ossl_check_const_BIO_sk_type(sk), (idx)))
307#define sk_BIO_new(cmp) ((STACK_OF(BIO) *)OPENSSL_sk_new(ossl_check_BIO_compfunc_type(cmp)))
308#define sk_BIO_new_null() ((STACK_OF(BIO) *)OPENSSL_sk_new_null())
309#define sk_BIO_new_reserve(cmp, n) ((STACK_OF(BIO) *)OPENSSL_sk_new_reserve(ossl_check_BIO_compfunc_type(cmp), (n)))
310#define sk_BIO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_BIO_sk_type(sk), (n))
311#define sk_BIO_free(sk) OPENSSL_sk_free(ossl_check_BIO_sk_type(sk))
312#define sk_BIO_zero(sk) OPENSSL_sk_zero(ossl_check_BIO_sk_type(sk))
313#define sk_BIO_delete(sk, i) ((BIO *)OPENSSL_sk_delete(ossl_check_BIO_sk_type(sk), (i)))
314#define sk_BIO_delete_ptr(sk, ptr) ((BIO *)OPENSSL_sk_delete_ptr(ossl_check_BIO_sk_type(sk), ossl_check_BIO_type(ptr)))
315#define sk_BIO_push(sk, ptr) OPENSSL_sk_push(ossl_check_BIO_sk_type(sk), ossl_check_BIO_type(ptr))
316#define sk_BIO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_BIO_sk_type(sk), ossl_check_BIO_type(ptr))
317#define sk_BIO_pop(sk) ((BIO *)OPENSSL_sk_pop(ossl_check_BIO_sk_type(sk)))
318#define sk_BIO_shift(sk) ((BIO *)OPENSSL_sk_shift(ossl_check_BIO_sk_type(sk)))
319#define sk_BIO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_BIO_sk_type(sk),ossl_check_BIO_freefunc_type(freefunc))
320#define sk_BIO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_BIO_sk_type(sk), ossl_check_BIO_type(ptr), (idx))
321#define sk_BIO_set(sk, idx, ptr) ((BIO *)OPENSSL_sk_set(ossl_check_BIO_sk_type(sk), (idx), ossl_check_BIO_type(ptr)))
322#define sk_BIO_find(sk, ptr) OPENSSL_sk_find(ossl_check_BIO_sk_type(sk), ossl_check_BIO_type(ptr))
323#define sk_BIO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_BIO_sk_type(sk), ossl_check_BIO_type(ptr))
324#define sk_BIO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_BIO_sk_type(sk), ossl_check_BIO_type(ptr), pnum)
325#define sk_BIO_sort(sk) OPENSSL_sk_sort(ossl_check_BIO_sk_type(sk))
326#define sk_BIO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_BIO_sk_type(sk))
327#define sk_BIO_dup(sk) ((STACK_OF(BIO) *)OPENSSL_sk_dup(ossl_check_const_BIO_sk_type(sk)))
328#define sk_BIO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(BIO) *)OPENSSL_sk_deep_copy(ossl_check_const_BIO_sk_type(sk), ossl_check_BIO_copyfunc_type(copyfunc), ossl_check_BIO_freefunc_type(freefunc)))
329#define sk_BIO_set_cmp_func(sk, cmp) ((sk_BIO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_BIO_sk_type(sk), ossl_check_BIO_compfunc_type(cmp)))
334typedef int asn1_ps_func (BIO *b,
unsigned char **pbuf,
int *plen,
337typedef void (*BIO_dgram_sctp_notification_handler_fn) (BIO *b,
340# ifndef OPENSSL_NO_SCTP
346 uint32_t snd_context;
356 uint32_t rcv_context;
369# define BIO_C_SET_CONNECT 100
370# define BIO_C_DO_STATE_MACHINE 101
371# define BIO_C_SET_NBIO 102
373# define BIO_C_SET_FD 104
374# define BIO_C_GET_FD 105
375# define BIO_C_SET_FILE_PTR 106
376# define BIO_C_GET_FILE_PTR 107
377# define BIO_C_SET_FILENAME 108
378# define BIO_C_SET_SSL 109
379# define BIO_C_GET_SSL 110
380# define BIO_C_SET_MD 111
381# define BIO_C_GET_MD 112
382# define BIO_C_GET_CIPHER_STATUS 113
383# define BIO_C_SET_BUF_MEM 114
384# define BIO_C_GET_BUF_MEM_PTR 115
385# define BIO_C_GET_BUFF_NUM_LINES 116
386# define BIO_C_SET_BUFF_SIZE 117
387# define BIO_C_SET_ACCEPT 118
388# define BIO_C_SSL_MODE 119
389# define BIO_C_GET_MD_CTX 120
391# define BIO_C_SET_BUFF_READ_DATA 122
392# define BIO_C_GET_CONNECT 123
393# define BIO_C_GET_ACCEPT 124
394# define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125
395# define BIO_C_GET_SSL_NUM_RENEGOTIATES 126
396# define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127
397# define BIO_C_FILE_SEEK 128
398# define BIO_C_GET_CIPHER_CTX 129
399# define BIO_C_SET_BUF_MEM_EOF_RETURN 130
401# define BIO_C_SET_BIND_MODE 131
402# define BIO_C_GET_BIND_MODE 132
403# define BIO_C_FILE_TELL 133
404# define BIO_C_GET_SOCKS 134
405# define BIO_C_SET_SOCKS 135
407# define BIO_C_SET_WRITE_BUF_SIZE 136
408# define BIO_C_GET_WRITE_BUF_SIZE 137
409# define BIO_C_MAKE_BIO_PAIR 138
410# define BIO_C_DESTROY_BIO_PAIR 139
411# define BIO_C_GET_WRITE_GUARANTEE 140
412# define BIO_C_GET_READ_REQUEST 141
413# define BIO_C_SHUTDOWN_WR 142
414# define BIO_C_NREAD0 143
415# define BIO_C_NREAD 144
416# define BIO_C_NWRITE0 145
417# define BIO_C_NWRITE 146
418# define BIO_C_RESET_READ_REQUEST 147
419# define BIO_C_SET_MD_CTX 148
421# define BIO_C_SET_PREFIX 149
422# define BIO_C_GET_PREFIX 150
423# define BIO_C_SET_SUFFIX 151
424# define BIO_C_GET_SUFFIX 152
426# define BIO_C_SET_EX_ARG 153
427# define BIO_C_GET_EX_ARG 154
429# define BIO_C_SET_CONNECT_MODE 155
431# define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg)
432# define BIO_get_app_data(s) BIO_get_ex_data(s,0)
434# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)
436# ifndef OPENSSL_NO_SOCK
439# define BIO_FAMILY_IPV4 4
440# define BIO_FAMILY_IPV6 6
441# define BIO_FAMILY_IPANY 256
444# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0, \
446# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1, \
448# define BIO_set_conn_address(b,addr) BIO_ctrl(b,BIO_C_SET_CONNECT,2, \
450# define BIO_set_conn_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,f)
451# define BIO_get_conn_hostname(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0))
452# define BIO_get_conn_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1))
453# define BIO_get_conn_address(b) ((const BIO_ADDR *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2))
454# define BIO_get_conn_ip_family(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL)
455# define BIO_set_conn_mode(b,n) BIO_ctrl(b,BIO_C_SET_CONNECT_MODE,(n),NULL)
458# define BIO_set_accept_name(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0, \
460# define BIO_set_accept_port(b,port) BIO_ctrl(b,BIO_C_SET_ACCEPT,1, \
462# define BIO_get_accept_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0))
463# define BIO_get_accept_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,1))
464# define BIO_get_peer_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,2))
465# define BIO_get_peer_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,3))
467# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(n)?(void *)"a":NULL)
468# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,3, \
470# define BIO_set_accept_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_ACCEPT,4,f)
471# define BIO_get_accept_ip_family(b) BIO_ctrl(b,BIO_C_GET_ACCEPT,4,NULL)
474# define BIO_BIND_NORMAL 0
475# define BIO_BIND_REUSEADDR BIO_SOCK_REUSEADDR
476# define BIO_BIND_REUSEADDR_IF_UNUSED BIO_SOCK_REUSEADDR
477# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL)
478# define BIO_get_bind_mode(b) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL)
481# define BIO_do_connect(b) BIO_do_handshake(b)
482# define BIO_do_accept(b) BIO_do_handshake(b)
484# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)
487# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd)
488# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)(c))
491# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)(fp))
492# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)(fpp))
495# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL)
496# define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)
507int BIO_read_filename(BIO *b,
const char *name);
509# define BIO_read_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \
510 BIO_CLOSE|BIO_FP_READ,(char *)(name))
512# define BIO_write_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \
513 BIO_CLOSE|BIO_FP_WRITE,name)
514# define BIO_append_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \
515 BIO_CLOSE|BIO_FP_APPEND,name)
516# define BIO_rw_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \
517 BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name)
525# define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)(ssl))
526# define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)(sslp))
527# define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL)
528# define BIO_set_ssl_renegotiate_bytes(b,num) \
529 BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL)
530# define BIO_get_num_renegotiates(b) \
531 BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL)
532# define BIO_set_ssl_renegotiate_timeout(b,seconds) \
533 BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL)
538# define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)(pp))
539# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)(bm))
540# define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0, \
542# define BIO_set_mem_eof_return(b,v) \
543 BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL)
546# define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL)
547# define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL)
548# define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0)
549# define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1)
550# define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf)
553# define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret))
555# define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL)
556# define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL)
557# define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL)
558# define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL)
559# define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL)
560# define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL)
562size_t BIO_ctrl_pending(BIO *b);
563size_t BIO_ctrl_wpending(BIO *b);
564# define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)
565# define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \
567# define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb)
570# define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL)
571# define BIO_buffer_peek(b,s,l) BIO_ctrl(b,BIO_CTRL_PEEK,(l),(s))
574# define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL)
575# define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL)
576# define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2)
577# define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL)
578# define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL)
580# define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL)
581# define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL)
582size_t BIO_ctrl_get_write_guarantee(BIO *b);
583size_t BIO_ctrl_get_read_request(BIO *b);
584int BIO_ctrl_reset_read_request(BIO *b);
587# define BIO_ctrl_dgram_connect(b,peer) \
588 (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)(peer))
589# define BIO_ctrl_set_connected(b,peer) \
590 (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, 0, (char *)(peer))
591# define BIO_dgram_recv_timedout(b) \
592 (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL)
593# define BIO_dgram_send_timedout(b) \
594 (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL)
595# define BIO_dgram_get_peer(b,peer) \
596 (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)(peer))
597# define BIO_dgram_set_peer(b,peer) \
598 (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)(peer))
599# define BIO_dgram_get_mtu_overhead(b) \
600 (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL)
603# define BIO_set_prefix(b,p) BIO_ctrl((b), BIO_CTRL_SET_PREFIX, 0, (void *)(p))
604# define BIO_set_indent(b,i) BIO_ctrl((b), BIO_CTRL_SET_INDENT, (i), NULL)
605# define BIO_get_indent(b) BIO_ctrl((b), BIO_CTRL_GET_INDENT, 0, NULL)
607#define BIO_get_ex_new_index(l, p, newf, dupf, freef) \
608 CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, l, p, newf, dupf, freef)
609int BIO_set_ex_data(BIO *bio,
int idx,
void *data);
610void *BIO_get_ex_data(
const BIO *bio,
int idx);
611uint64_t BIO_number_read(BIO *bio);
612uint64_t BIO_number_written(BIO *bio);
615int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix,
616 asn1_ps_func *prefix_free);
617int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix,
618 asn1_ps_func **pprefix_free);
619int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix,
620 asn1_ps_func *suffix_free);
621int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix,
622 asn1_ps_func **psuffix_free);
624const BIO_METHOD *BIO_s_file(
void);
625BIO *BIO_new_file(
const char *filename,
const char *mode);
626BIO *BIO_new_from_core_bio(OSSL_LIB_CTX *libctx, OSSL_CORE_BIO *corebio);
627# ifndef OPENSSL_NO_STDIO
628BIO *BIO_new_fp(FILE *stream,
int close_flag);
630BIO *BIO_new_ex(OSSL_LIB_CTX *libctx,
const BIO_METHOD *method);
631BIO *BIO_new(
const BIO_METHOD *type);
633void BIO_set_data(BIO *a,
void *ptr);
634void *BIO_get_data(BIO *a);
635void BIO_set_init(BIO *a,
int init);
636int BIO_get_init(BIO *a);
637void BIO_set_shutdown(BIO *a,
int shut);
638int BIO_get_shutdown(BIO *a);
639void BIO_vfree(BIO *a);
640int BIO_up_ref(BIO *a);
641int BIO_read(BIO *b,
void *data,
int dlen);
642int BIO_read_ex(BIO *b,
void *data,
size_t dlen,
size_t *readbytes);
643int BIO_gets(BIO *bp,
char *buf,
int size);
644int BIO_get_line(BIO *bio,
char *buf,
int size);
645int BIO_write(BIO *b,
const void *data,
int dlen);
646int BIO_write_ex(BIO *b,
const void *data,
size_t dlen,
size_t *written);
647int BIO_puts(BIO *bp,
const char *buf);
648int BIO_indent(BIO *b,
int indent,
int max);
649long BIO_ctrl(BIO *bp,
int cmd,
long larg,
void *parg);
650long BIO_callback_ctrl(BIO *b,
int cmd, BIO_info_cb *fp);
651void *BIO_ptr_ctrl(BIO *bp,
int cmd,
long larg);
652long BIO_int_ctrl(BIO *bp,
int cmd,
long larg,
int iarg);
653BIO *BIO_push(BIO *b, BIO *append);
655void BIO_free_all(BIO *a);
656BIO *BIO_find_type(BIO *b,
int bio_type);
657BIO *BIO_next(BIO *b);
658void BIO_set_next(BIO *b, BIO *next);
659BIO *BIO_get_retry_BIO(BIO *bio,
int *reason);
660int BIO_get_retry_reason(BIO *bio);
661void BIO_set_retry_reason(BIO *bio,
int reason);
662BIO *BIO_dup_chain(BIO *in);
664int BIO_nread0(BIO *bio,
char **buf);
665int BIO_nread(BIO *bio,
char **buf,
int num);
666int BIO_nwrite0(BIO *bio,
char **buf);
667int BIO_nwrite(BIO *bio,
char **buf,
int num);
669const BIO_METHOD *BIO_s_mem(
void);
670const BIO_METHOD *BIO_s_secmem(
void);
671BIO *BIO_new_mem_buf(
const void *buf,
int len);
672# ifndef OPENSSL_NO_SOCK
673const BIO_METHOD *BIO_s_socket(
void);
674const BIO_METHOD *BIO_s_connect(
void);
675const BIO_METHOD *BIO_s_accept(
void);
677const BIO_METHOD *BIO_s_fd(
void);
678const BIO_METHOD *BIO_s_log(
void);
679const BIO_METHOD *BIO_s_bio(
void);
680const BIO_METHOD *BIO_s_null(
void);
681const BIO_METHOD *BIO_f_null(
void);
682const BIO_METHOD *BIO_f_buffer(
void);
683const BIO_METHOD *BIO_f_readbuffer(
void);
684const BIO_METHOD *BIO_f_linebuffer(
void);
685const BIO_METHOD *BIO_f_nbio_test(
void);
686const BIO_METHOD *BIO_f_prefix(
void);
687const BIO_METHOD *BIO_s_core(
void);
688# ifndef OPENSSL_NO_DGRAM
689const BIO_METHOD *BIO_s_datagram(
void);
690int BIO_dgram_non_fatal_error(
int error);
691BIO *BIO_new_dgram(
int fd,
int close_flag);
692# ifndef OPENSSL_NO_SCTP
693const BIO_METHOD *BIO_s_datagram_sctp(
void);
694BIO *BIO_new_dgram_sctp(
int fd,
int close_flag);
695int BIO_dgram_is_sctp(BIO *bio);
696int BIO_dgram_sctp_notification_cb(BIO *b,
697 BIO_dgram_sctp_notification_handler_fn handle_notifications,
699int BIO_dgram_sctp_wait_for_dry(BIO *b);
700int BIO_dgram_sctp_msg_waiting(BIO *b);
704# ifndef OPENSSL_NO_SOCK
705int BIO_sock_should_retry(
int i);
706int BIO_sock_non_fatal_error(
int error);
707int BIO_socket_wait(
int fd,
int for_read, time_t max_time);
709int BIO_wait(BIO *bio, time_t max_time,
unsigned int nap_milliseconds);
710int BIO_do_connect_retry(BIO *bio,
int timeout,
int nap_milliseconds);
712int BIO_fd_should_retry(
int i);
713int BIO_fd_non_fatal_error(
int error);
714int BIO_dump_cb(
int (*cb) (
const void *data,
size_t len,
void *u),
715 void *u,
const void *s,
int len);
716int BIO_dump_indent_cb(
int (*cb) (
const void *data,
size_t len,
void *u),
717 void *u,
const void *s,
int len,
int indent);
718int BIO_dump(BIO *b,
const void *bytes,
int len);
719int BIO_dump_indent(BIO *b,
const void *bytes,
int len,
int indent);
720# ifndef OPENSSL_NO_STDIO
721int BIO_dump_fp(FILE *fp,
const void *s,
int len);
722int BIO_dump_indent_fp(FILE *fp,
const void *s,
int len,
int indent);
724int BIO_hex_string(BIO *out,
int indent,
int width,
const void *data,
727# ifndef OPENSSL_NO_SOCK
728BIO_ADDR *BIO_ADDR_new(
void);
729int BIO_ADDR_rawmake(BIO_ADDR *ap,
int family,
730 const void *where,
size_t wherelen,
unsigned short port);
731void BIO_ADDR_free(BIO_ADDR *);
732void BIO_ADDR_clear(BIO_ADDR *ap);
733int BIO_ADDR_family(
const BIO_ADDR *ap);
734int BIO_ADDR_rawaddress(
const BIO_ADDR *ap,
void *p,
size_t *l);
735unsigned short BIO_ADDR_rawport(
const BIO_ADDR *ap);
736char *BIO_ADDR_hostname_string(
const BIO_ADDR *ap,
int numeric);
737char *BIO_ADDR_service_string(
const BIO_ADDR *ap,
int numeric);
738char *BIO_ADDR_path_string(
const BIO_ADDR *ap);
740const BIO_ADDRINFO *BIO_ADDRINFO_next(
const BIO_ADDRINFO *bai);
741int BIO_ADDRINFO_family(
const BIO_ADDRINFO *bai);
742int BIO_ADDRINFO_socktype(
const BIO_ADDRINFO *bai);
743int BIO_ADDRINFO_protocol(
const BIO_ADDRINFO *bai);
744const BIO_ADDR *BIO_ADDRINFO_address(
const BIO_ADDRINFO *bai);
745void BIO_ADDRINFO_free(BIO_ADDRINFO *bai);
747enum BIO_hostserv_priorities {
748 BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV
750int BIO_parse_hostserv(
const char *hostserv,
char **host,
char **service,
751 enum BIO_hostserv_priorities hostserv_prio);
752enum BIO_lookup_type {
753 BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER
755int BIO_lookup(
const char *host,
const char *service,
756 enum BIO_lookup_type lookup_type,
757 int family,
int socktype, BIO_ADDRINFO **res);
758int BIO_lookup_ex(
const char *host,
const char *service,
759 int lookup_type,
int family,
int socktype,
int protocol,
761int BIO_sock_error(
int sock);
762int BIO_socket_ioctl(
int fd,
long type,
void *arg);
763int BIO_socket_nbio(
int fd,
int mode);
764int BIO_sock_init(
void);
765# ifndef OPENSSL_NO_DEPRECATED_1_1_0
766# define BIO_sock_cleanup() while(0) continue
768int BIO_set_tcp_ndelay(
int sock,
int turn_on);
769# ifndef OPENSSL_NO_DEPRECATED_1_1_0
770OSSL_DEPRECATEDIN_1_1_0
struct hostent *BIO_gethostbyname(
const char *name);
771OSSL_DEPRECATEDIN_1_1_0
int BIO_get_port(
const char *str,
unsigned short *port_ptr);
772OSSL_DEPRECATEDIN_1_1_0
int BIO_get_host_ip(
const char *str,
unsigned char *ip);
773OSSL_DEPRECATEDIN_1_1_0
int BIO_get_accept_socket(
char *host_port,
int mode);
774OSSL_DEPRECATEDIN_1_1_0
int BIO_accept(
int sock,
char **ip_port);
780enum BIO_sock_info_type {
781 BIO_SOCK_INFO_ADDRESS
783int BIO_sock_info(
int sock,
786# define BIO_SOCK_REUSEADDR 0x01
787# define BIO_SOCK_V6_ONLY 0x02
788# define BIO_SOCK_KEEPALIVE 0x04
789# define BIO_SOCK_NONBLOCK 0x08
790# define BIO_SOCK_NODELAY 0x10
792int BIO_socket(
int domain,
int socktype,
int protocol,
int options);
793int BIO_connect(
int sock,
const BIO_ADDR *addr,
int options);
794int BIO_bind(
int sock,
const BIO_ADDR *addr,
int options);
795int BIO_listen(
int sock,
const BIO_ADDR *addr,
int options);
796int BIO_accept_ex(
int accept_sock, BIO_ADDR *addr,
int options);
797int BIO_closesocket(
int sock);
799BIO *BIO_new_socket(
int sock,
int close_flag);
800BIO *BIO_new_connect(
const char *host_port);
801BIO *BIO_new_accept(
const char *host_port);
804BIO *BIO_new_fd(
int fd,
int close_flag);
806int BIO_new_bio_pair(BIO **bio1,
size_t writebuf1,
807 BIO **bio2,
size_t writebuf2);
814void BIO_copy_next_retry(BIO *b);
820# define ossl_bio__attr__(x)
821# if defined(__GNUC__) && defined(__STDC_VERSION__) \
822 && !defined(__MINGW32__) && !defined(__MINGW64__) \
823 && !defined(__APPLE__)
828# if __STDC_VERSION__ >= 199901L
829# undef ossl_bio__attr__
830# define ossl_bio__attr__ __attribute__
831# if __GNUC__*10 + __GNUC_MINOR__ >= 44
832# define ossl_bio__printf__ __gnu_printf__
834# define ossl_bio__printf__ __printf__
838int BIO_printf(BIO *bio,
const char *format, ...)
839ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 3)));
840int BIO_vprintf(BIO *bio, const
char *format, va_list args)
841ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 0)));
842int BIO_snprintf(
char *buf,
size_t n, const
char *format, ...)
843ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 4)));
844int BIO_vsnprintf(
char *buf,
size_t n, const
char *format, va_list args)
845ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 0)));
846# undef ossl_bio__attr__
847# undef ossl_bio__printf__
850BIO_METHOD *BIO_meth_new(
int type,
const char *name);
851void BIO_meth_free(BIO_METHOD *biom);
852int (*BIO_meth_get_write(
const BIO_METHOD *biom)) (BIO *,
const char *, int);
853int (*BIO_meth_get_write_ex(
const BIO_METHOD *biom)) (BIO *,
const char *, size_t,
855int BIO_meth_set_write(BIO_METHOD *biom,
856 int (*write) (BIO *,
const char *,
int));
857int BIO_meth_set_write_ex(BIO_METHOD *biom,
858 int (*bwrite) (BIO *,
const char *,
size_t,
size_t *));
859int (*BIO_meth_get_read(
const BIO_METHOD *biom)) (BIO *,
char *, int);
860int (*BIO_meth_get_read_ex(
const BIO_METHOD *biom)) (BIO *,
char *, size_t,
size_t *);
861int BIO_meth_set_read(BIO_METHOD *biom,
862 int (*read) (BIO *,
char *,
int));
863int BIO_meth_set_read_ex(BIO_METHOD *biom,
864 int (*bread) (BIO *,
char *,
size_t,
size_t *));
865int (*BIO_meth_get_puts(
const BIO_METHOD *biom)) (BIO *,
const char *);
866int BIO_meth_set_puts(BIO_METHOD *biom,
867 int (*puts) (BIO *,
const char *));
868int (*BIO_meth_get_gets(
const BIO_METHOD *biom)) (BIO *,
char *, int);
869int BIO_meth_set_gets(BIO_METHOD *biom,
870 int (*ossl_gets) (BIO *,
char *,
int));
871long (*BIO_meth_get_ctrl(
const BIO_METHOD *biom)) (BIO *, int, long,
void *);
872int BIO_meth_set_ctrl(BIO_METHOD *biom,
873 long (*ctrl) (BIO *,
int,
long,
void *));
874int (*BIO_meth_get_create(
const BIO_METHOD *bion)) (BIO *);
875int BIO_meth_set_create(BIO_METHOD *biom,
int (*create) (BIO *));
876int (*BIO_meth_get_destroy(
const BIO_METHOD *biom)) (BIO *);
877int BIO_meth_set_destroy(BIO_METHOD *biom,
int (*destroy) (BIO *));
878long (*BIO_meth_get_callback_ctrl(
const BIO_METHOD *biom))
879 (BIO *, int, BIO_info_cb *);
880int BIO_meth_set_callback_ctrl(BIO_METHOD *biom,
881 long (*callback_ctrl) (BIO *,
int,