summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio/bio.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bio/bio.h')
-rw-r--r--src/lib/libcrypto/bio/bio.h165
1 files changed, 87 insertions, 78 deletions
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h
index 05699ab212..4f1d02ada5 100644
--- a/src/lib/libcrypto/bio/bio.h
+++ b/src/lib/libcrypto/bio/bio.h
@@ -151,7 +151,7 @@ extern "C" {
151 151
152#define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */ 152#define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */
153#define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation tiemd out */ 153#define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation tiemd out */
154 154
155/* #ifdef IP_MTU_DISCOVER */ 155/* #ifdef IP_MTU_DISCOVER */
156#define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */ 156#define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */
157/* #endif */ 157/* #endif */
@@ -282,9 +282,10 @@ void BIO_clear_flags(BIO *b, int flags);
282#define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) 282#define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN))
283#define BIO_cb_post(a) ((a)&BIO_CB_RETURN) 283#define BIO_cb_post(a) ((a)&BIO_CB_RETURN)
284 284
285long (*BIO_get_callback(const BIO *b)) (struct bio_st *,int,const char *,int, long,long); 285long (*BIO_get_callback(const BIO *b))(struct bio_st *, int, const char *,
286void BIO_set_callback(BIO *b, 286 int, long, long);
287 long (*callback)(struct bio_st *,int,const char *,int, long,long)); 287void BIO_set_callback(BIO *b,
288 long (*callback)(struct bio_st *, int, const char *, int, long, long));
288char *BIO_get_callback_arg(const BIO *b); 289char *BIO_get_callback_arg(const BIO *b);
289void BIO_set_callback_arg(BIO *b, char *arg); 290void BIO_set_callback_arg(BIO *b, char *arg);
290 291
@@ -293,8 +294,7 @@ int BIO_method_type(const BIO *b);
293 294
294typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); 295typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long);
295 296
296typedef struct bio_method_st 297typedef struct bio_method_st {
297 {
298 int type; 298 int type;
299 const char *name; 299 const char *name;
300 int (*bwrite)(BIO *, const char *, int); 300 int (*bwrite)(BIO *, const char *, int);
@@ -304,14 +304,13 @@ typedef struct bio_method_st
304 long (*ctrl)(BIO *, int, long, void *); 304 long (*ctrl)(BIO *, int, long, void *);
305 int (*create)(BIO *); 305 int (*create)(BIO *);
306 int (*destroy)(BIO *); 306 int (*destroy)(BIO *);
307 long (*callback_ctrl)(BIO *, int, bio_info_cb *); 307 long (*callback_ctrl)(BIO *, int, bio_info_cb *);
308 } BIO_METHOD; 308} BIO_METHOD;
309 309
310struct bio_st 310struct bio_st {
311 {
312 BIO_METHOD *method; 311 BIO_METHOD *method;
313 /* bio, mode, argp, argi, argl, ret */ 312 /* bio, mode, argp, argi, argl, ret */
314 long (*callback)(struct bio_st *,int,const char *,int, long,long); 313 long (*callback)(struct bio_st *, int, const char *, int, long, long);
315 char *cb_arg; /* first argument for the callback */ 314 char *cb_arg; /* first argument for the callback */
316 315
317 int init; 316 int init;
@@ -327,12 +326,11 @@ struct bio_st
327 unsigned long num_write; 326 unsigned long num_write;
328 327
329 CRYPTO_EX_DATA ex_data; 328 CRYPTO_EX_DATA ex_data;
330 }; 329};
331 330
332DECLARE_STACK_OF(BIO) 331DECLARE_STACK_OF(BIO)
333 332
334typedef struct bio_f_buffer_ctx_struct 333typedef struct bio_f_buffer_ctx_struct {
335 {
336 /* Buffers are setup like this: 334 /* Buffers are setup like this:
337 * 335 *
338 * <---------------------- size -----------------------> 336 * <---------------------- size ----------------------->
@@ -346,30 +344,28 @@ typedef struct bio_f_buffer_ctx_struct
346 int ibuf_size; /* how big is the input buffer */ 344 int ibuf_size; /* how big is the input buffer */
347 int obuf_size; /* how big is the output buffer */ 345 int obuf_size; /* how big is the output buffer */
348 346
349 char *ibuf; /* the char array */ 347 char *ibuf; /* the char array */
350 int ibuf_len; /* how many bytes are in it */ 348 int ibuf_len; /* how many bytes are in it */
351 int ibuf_off; /* write/read offset */ 349 int ibuf_off; /* write/read offset */
352 350
353 char *obuf; /* the char array */ 351 char *obuf; /* the char array */
354 int obuf_len; /* how many bytes are in it */ 352 int obuf_len; /* how many bytes are in it */
355 int obuf_off; /* write/read offset */ 353 int obuf_off; /* write/read offset */
356 } BIO_F_BUFFER_CTX; 354} BIO_F_BUFFER_CTX;
357 355
358/* Prefix and suffix callback in ASN1 BIO */ 356/* Prefix and suffix callback in ASN1 BIO */
359typedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, void *parg); 357typedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, void *parg);
360 358
361#ifndef OPENSSL_NO_SCTP 359#ifndef OPENSSL_NO_SCTP
362/* SCTP parameter structs */ 360/* SCTP parameter structs */
363struct bio_dgram_sctp_sndinfo 361struct bio_dgram_sctp_sndinfo {
364 {
365 uint16_t snd_sid; 362 uint16_t snd_sid;
366 uint16_t snd_flags; 363 uint16_t snd_flags;
367 uint32_t snd_ppid; 364 uint32_t snd_ppid;
368 uint32_t snd_context; 365 uint32_t snd_context;
369 }; 366};
370 367
371struct bio_dgram_sctp_rcvinfo 368struct bio_dgram_sctp_rcvinfo {
372 {
373 uint16_t rcv_sid; 369 uint16_t rcv_sid;
374 uint16_t rcv_ssn; 370 uint16_t rcv_ssn;
375 uint16_t rcv_flags; 371 uint16_t rcv_flags;
@@ -377,13 +373,12 @@ struct bio_dgram_sctp_rcvinfo
377 uint32_t rcv_tsn; 373 uint32_t rcv_tsn;
378 uint32_t rcv_cumtsn; 374 uint32_t rcv_cumtsn;
379 uint32_t rcv_context; 375 uint32_t rcv_context;
380 }; 376};
381 377
382struct bio_dgram_sctp_prinfo 378struct bio_dgram_sctp_prinfo {
383 {
384 uint16_t pr_policy; 379 uint16_t pr_policy;
385 uint32_t pr_value; 380 uint32_t pr_value;
386 }; 381};
387#endif 382#endif
388 383
389/* connect BIO stuff */ 384/* connect BIO stuff */
@@ -519,7 +514,7 @@ struct bio_dgram_sctp_prinfo
519/* If you are wondering why this isn't defined, its because CONST_STRICT is 514/* If you are wondering why this isn't defined, its because CONST_STRICT is
520 * purely a compile-time kludge to allow const to be checked. 515 * purely a compile-time kludge to allow const to be checked.
521 */ 516 */
522int BIO_read_filename(BIO *b,const char *name); 517int BIO_read_filename(BIO *b, const char *name);
523#else 518#else
524#define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ 519#define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
525 BIO_CLOSE|BIO_FP_READ,(char *)name) 520 BIO_CLOSE|BIO_FP_READ,(char *)name)
@@ -611,22 +606,27 @@ int BIO_ctrl_reset_read_request(BIO *b);
611/* These two aren't currently implemented */ 606/* These two aren't currently implemented */
612/* int BIO_get_ex_num(BIO *bio); */ 607/* int BIO_get_ex_num(BIO *bio); */
613/* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ 608/* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */
614int BIO_set_ex_data(BIO *bio,int idx,void *data); 609int BIO_set_ex_data(BIO *bio, int idx, void *data);
615void *BIO_get_ex_data(BIO *bio,int idx); 610void *BIO_get_ex_data(BIO *bio, int idx);
616int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 611int
617 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 612BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
613CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
618unsigned long BIO_number_read(BIO *bio); 614unsigned long BIO_number_read(BIO *bio);
619unsigned long BIO_number_written(BIO *bio); 615unsigned long BIO_number_written(BIO *bio);
620 616
621/* For BIO_f_asn1() */ 617/* For BIO_f_asn1() */
622int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, 618int
623 asn1_ps_func *prefix_free); 619BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix,
624int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, 620asn1_ps_func *prefix_free);
625 asn1_ps_func **pprefix_free); 621int
626int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, 622BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix,
627 asn1_ps_func *suffix_free); 623asn1_ps_func **pprefix_free);
628int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, 624int
629 asn1_ps_func **psuffix_free); 625BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix,
626asn1_ps_func *suffix_free);
627int
628BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix,
629asn1_ps_func **psuffix_free);
630 630
631# ifndef OPENSSL_NO_FP_API 631# ifndef OPENSSL_NO_FP_API
632BIO_METHOD *BIO_s_file(void ); 632BIO_METHOD *BIO_s_file(void );
@@ -635,22 +635,23 @@ BIO *BIO_new_fp(FILE *stream, int close_flag);
635# define BIO_s_file_internal BIO_s_file 635# define BIO_s_file_internal BIO_s_file
636# endif 636# endif
637BIO * BIO_new(BIO_METHOD *type); 637BIO * BIO_new(BIO_METHOD *type);
638int BIO_set(BIO *a,BIO_METHOD *type); 638int BIO_set(BIO *a, BIO_METHOD *type);
639int BIO_free(BIO *a); 639int BIO_free(BIO *a);
640void BIO_vfree(BIO *a); 640void BIO_vfree(BIO *a);
641int BIO_read(BIO *b, void *data, int len); 641int BIO_read(BIO *b, void *data, int len);
642int BIO_gets(BIO *bp,char *buf, int size); 642int BIO_gets(BIO *bp, char *buf, int size);
643int BIO_write(BIO *b, const void *data, int len); 643int BIO_write(BIO *b, const void *data, int len);
644int BIO_puts(BIO *bp,const char *buf); 644int BIO_puts(BIO *bp, const char *buf);
645int BIO_indent(BIO *b,int indent,int max); 645int BIO_indent(BIO *b, int indent, int max);
646long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); 646long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg);
647long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long)); 647long BIO_callback_ctrl(BIO *b, int cmd,
648char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); 648 void (*fp)(struct bio_st *, int, const char *, int, long, long));
649long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg); 649char * BIO_ptr_ctrl(BIO *bp, int cmd, long larg);
650BIO * BIO_push(BIO *b,BIO *append); 650long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg);
651BIO * BIO_push(BIO *b, BIO *append);
651BIO * BIO_pop(BIO *b); 652BIO * BIO_pop(BIO *b);
652void BIO_free_all(BIO *a); 653void BIO_free_all(BIO *a);
653BIO * BIO_find_type(BIO *b,int bio_type); 654BIO * BIO_find_type(BIO *b, int bio_type);
654BIO * BIO_next(BIO *b); 655BIO * BIO_next(BIO *b);
655BIO * BIO_get_retry_BIO(BIO *bio, int *reason); 656BIO * BIO_get_retry_BIO(BIO *bio, int *reason);
656int BIO_get_retry_reason(BIO *bio); 657int BIO_get_retry_reason(BIO *bio);
@@ -661,8 +662,8 @@ int BIO_nread(BIO *bio, char **buf, int num);
661int BIO_nwrite0(BIO *bio, char **buf); 662int BIO_nwrite0(BIO *bio, char **buf);
662int BIO_nwrite(BIO *bio, char **buf, int num); 663int BIO_nwrite(BIO *bio, char **buf, int num);
663 664
664long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, 665long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi,
665 long argl,long ret); 666 long argl, long ret);
666 667
667BIO_METHOD *BIO_s_mem(void); 668BIO_METHOD *BIO_s_mem(void);
668BIO *BIO_new_mem_buf(void *buf, int len); 669BIO *BIO_new_mem_buf(void *buf, int len);
@@ -696,12 +697,14 @@ int BIO_dgram_non_fatal_error(int error);
696 697
697int BIO_fd_should_retry(int i); 698int BIO_fd_should_retry(int i);
698int BIO_fd_non_fatal_error(int error); 699int BIO_fd_non_fatal_error(int error);
699int BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u), 700int
700 void *u, const char *s, int len); 701BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u),
701int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u), 702void *u, const char *s, int len);
702 void *u, const char *s, int len, int indent); 703int
703int BIO_dump(BIO *b,const char *bytes,int len); 704BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u),
704int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent); 705void *u, const char *s, int len, int indent);
706int BIO_dump(BIO *b, const char *bytes, int len);
707int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent);
705#ifndef OPENSSL_NO_FP_API 708#ifndef OPENSSL_NO_FP_API
706int BIO_dump_fp(FILE *fp, const char *s, int len); 709int BIO_dump_fp(FILE *fp, const char *s, int len);
707int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); 710int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent);
@@ -717,23 +720,24 @@ struct hostent *BIO_gethostbyname(const char *name);
717 */ 720 */
718int BIO_sock_error(int sock); 721int BIO_sock_error(int sock);
719int BIO_socket_ioctl(int fd, long type, void *arg); 722int BIO_socket_ioctl(int fd, long type, void *arg);
720int BIO_socket_nbio(int fd,int mode); 723int BIO_socket_nbio(int fd, int mode);
721int BIO_get_port(const char *str, unsigned short *port_ptr); 724int BIO_get_port(const char *str, unsigned short *port_ptr);
722int BIO_get_host_ip(const char *str, unsigned char *ip); 725int BIO_get_host_ip(const char *str, unsigned char *ip);
723int BIO_get_accept_socket(char *host_port,int mode); 726int BIO_get_accept_socket(char *host_port, int mode);
724int BIO_accept(int sock,char **ip_port); 727int BIO_accept(int sock, char **ip_port);
725int BIO_sock_init(void ); 728int BIO_sock_init(void );
726void BIO_sock_cleanup(void); 729void BIO_sock_cleanup(void);
727int BIO_set_tcp_ndelay(int sock,int turn_on); 730int BIO_set_tcp_ndelay(int sock, int turn_on);
728 731
729BIO *BIO_new_socket(int sock, int close_flag); 732BIO *BIO_new_socket(int sock, int close_flag);
730BIO *BIO_new_dgram(int fd, int close_flag); 733BIO *BIO_new_dgram(int fd, int close_flag);
731#ifndef OPENSSL_NO_SCTP 734#ifndef OPENSSL_NO_SCTP
732BIO *BIO_new_dgram_sctp(int fd, int close_flag); 735BIO *BIO_new_dgram_sctp(int fd, int close_flag);
733int BIO_dgram_is_sctp(BIO *bio); 736int BIO_dgram_is_sctp(BIO *bio);
734int BIO_dgram_sctp_notification_cb(BIO *b, 737int
735 void (*handle_notifications)(BIO *bio, void *context, void *buf), 738BIO_dgram_sctp_notification_cb(BIO *b,
736 void *context); 739 void (*handle_notifications)(BIO *bio, void *context, void *buf),
740void *context);
737int BIO_dgram_sctp_wait_for_dry(BIO *b); 741int BIO_dgram_sctp_wait_for_dry(BIO *b);
738int BIO_dgram_sctp_msg_waiting(BIO *b); 742int BIO_dgram_sctp_msg_waiting(BIO *b);
739#endif 743#endif
@@ -741,8 +745,9 @@ BIO *BIO_new_fd(int fd, int close_flag);
741BIO *BIO_new_connect(char *host_port); 745BIO *BIO_new_connect(char *host_port);
742BIO *BIO_new_accept(char *host_port); 746BIO *BIO_new_accept(char *host_port);
743 747
744int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, 748int
745 BIO **bio2, size_t writebuf2); 749BIO_new_bio_pair(BIO **bio1, size_t writebuf1,
750BIO **bio2, size_t writebuf2);
746/* If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. 751/* If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints.
747 * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. 752 * Otherwise returns 0 and sets *bio1 and *bio2 to NULL.
748 * Size 0 uses default value. 753 * Size 0 uses default value.
@@ -757,14 +762,18 @@ void BIO_copy_next_retry(BIO *b);
757#else 762#else
758# define __bio_h__attr__(x) 763# define __bio_h__attr__(x)
759#endif 764#endif
760int BIO_printf(BIO *bio, const char *format, ...) 765int
761 __bio_h__attr__((__format__(__printf__,2,3))); 766BIO_printf(BIO *bio, const char *format, ...)
762int BIO_vprintf(BIO *bio, const char *format, va_list args) 767__bio_h__attr__((__format__(__printf__, 2, 3)));
763 __bio_h__attr__((__format__(__printf__,2,0))); 768int
764int BIO_snprintf(char *buf, size_t n, const char *format, ...) 769BIO_vprintf(BIO *bio, const char *format, va_list args)
765 __bio_h__attr__((__format__(__printf__,3,4))); 770__bio_h__attr__((__format__(__printf__, 2, 0)));
766int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) 771int
767 __bio_h__attr__((__format__(__printf__,3,0))); 772BIO_snprintf(char *buf, size_t n, const char *format, ...)
773__bio_h__attr__((__format__(__printf__, 3, 4)));
774int
775BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
776__bio_h__attr__((__format__(__printf__, 3, 0)));
768#undef __bio_h__attr__ 777#undef __bio_h__attr__
769 778
770/* BEGIN ERROR CODES */ 779/* BEGIN ERROR CODES */