Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: openssl/crypto/bio/bio.h

Issue 9254031: Upgrade chrome's OpenSSL to same version Android ships with. (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/openssl/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « openssl/crypto/bio/bf_nbio.c ('k') | openssl/crypto/bio/bio_cb.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* crypto/bio/bio.h */ 1 /* crypto/bio/bio.h */
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This package is an SSL implementation written 5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com). 6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL. 7 * The implementation was written so as to conform with Netscapes SSL.
8 * 8 *
9 * This library is free for commercial and non-commercial use as long as 9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions 10 * the following conditions are aheared to. The following conditions
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 #define BIO_TYPE_CONNECT (12|0x0400|0x0100) /* socket - connect */ 88 #define BIO_TYPE_CONNECT (12|0x0400|0x0100) /* socket - connect */
89 #define BIO_TYPE_ACCEPT (13|0x0400|0x0100) /* socket for accept */ 89 #define BIO_TYPE_ACCEPT (13|0x0400|0x0100) /* socket for accept */
90 #define BIO_TYPE_PROXY_CLIENT (14|0x0200) /* client proxy BIO */ 90 #define BIO_TYPE_PROXY_CLIENT (14|0x0200) /* client proxy BIO */
91 #define BIO_TYPE_PROXY_SERVER (15|0x0200) /* server proxy BIO */ 91 #define BIO_TYPE_PROXY_SERVER (15|0x0200) /* server proxy BIO */
92 #define BIO_TYPE_NBIO_TEST (16|0x0200) /* server proxy BIO */ 92 #define BIO_TYPE_NBIO_TEST (16|0x0200) /* server proxy BIO */
93 #define BIO_TYPE_NULL_FILTER (17|0x0200) 93 #define BIO_TYPE_NULL_FILTER (17|0x0200)
94 #define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */ 94 #define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */
95 #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ 95 #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */
96 #define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ 96 #define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */
97 #define BIO_TYPE_DGRAM (21|0x0400|0x0100) 97 #define BIO_TYPE_DGRAM (21|0x0400|0x0100)
98 #define BIO_TYPE_ASN1 (22|0x0200) /* filter */
98 #define BIO_TYPE_COMP (23|0x0200) /* filter */ 99 #define BIO_TYPE_COMP (23|0x0200) /* filter */
99 100
100 #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ 101 #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */
101 #define BIO_TYPE_FILTER 0x0200 102 #define BIO_TYPE_FILTER 0x0200
102 #define BIO_TYPE_SOURCE_SINK 0x0400 103 #define BIO_TYPE_SOURCE_SINK 0x0400
103 104
104 /* BIO_FILENAME_READ|BIO_CLOSE to open or close on free. 105 /* BIO_FILENAME_READ|BIO_CLOSE to open or close on free.
105 * BIO_set_fp(in,stdin,BIO_NOCLOSE); */ 106 * BIO_set_fp(in,stdin,BIO_NOCLOSE); */
106 #define BIO_NOCLOSE 0x00 107 #define BIO_NOCLOSE 0x00
107 #define BIO_CLOSE 0x01 108 #define BIO_CLOSE 0x01
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 void BIO_set_callback(BIO *b, 259 void BIO_set_callback(BIO *b,
259 long (*callback)(struct bio_st *,int,const char *,int, long,long)); 260 long (*callback)(struct bio_st *,int,const char *,int, long,long));
260 char *BIO_get_callback_arg(const BIO *b); 261 char *BIO_get_callback_arg(const BIO *b);
261 void BIO_set_callback_arg(BIO *b, char *arg); 262 void BIO_set_callback_arg(BIO *b, char *arg);
262 263
263 const char * BIO_method_name(const BIO *b); 264 const char * BIO_method_name(const BIO *b);
264 int BIO_method_type(const BIO *b); 265 int BIO_method_type(const BIO *b);
265 266
266 typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); 267 typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long);
267 268
268 #ifndef OPENSSL_SYS_WIN16
269 typedef struct bio_method_st 269 typedef struct bio_method_st
270 { 270 {
271 int type; 271 int type;
272 const char *name; 272 const char *name;
273 int (*bwrite)(BIO *, const char *, int); 273 int (*bwrite)(BIO *, const char *, int);
274 int (*bread)(BIO *, char *, int); 274 int (*bread)(BIO *, char *, int);
275 int (*bputs)(BIO *, const char *); 275 int (*bputs)(BIO *, const char *);
276 int (*bgets)(BIO *, char *, int); 276 int (*bgets)(BIO *, char *, int);
277 long (*ctrl)(BIO *, int, long, void *); 277 long (*ctrl)(BIO *, int, long, void *);
278 int (*create)(BIO *); 278 int (*create)(BIO *);
279 int (*destroy)(BIO *); 279 int (*destroy)(BIO *);
280 long (*callback_ctrl)(BIO *, int, bio_info_cb *); 280 long (*callback_ctrl)(BIO *, int, bio_info_cb *);
281 } BIO_METHOD; 281 } BIO_METHOD;
282 #else
283 typedef struct bio_method_st
284 {
285 int type;
286 const char *name;
287 int (_far *bwrite)();
288 int (_far *bread)();
289 int (_far *bputs)();
290 int (_far *bgets)();
291 long (_far *ctrl)();
292 int (_far *create)();
293 int (_far *destroy)();
294 long (_far *callback_ctrl)();
295 } BIO_METHOD;
296 #endif
297 282
298 struct bio_st 283 struct bio_st
299 { 284 {
300 BIO_METHOD *method; 285 BIO_METHOD *method;
301 /* bio, mode, argp, argi, argl, ret */ 286 /* bio, mode, argp, argi, argl, ret */
302 long (*callback)(struct bio_st *,int,const char *,int, long,long); 287 long (*callback)(struct bio_st *,int,const char *,int, long,long);
303 char *cb_arg; /* first argument for the callback */ 288 char *cb_arg; /* first argument for the callback */
304 289
305 int init; 290 int init;
306 int shutdown; 291 int shutdown;
307 int flags; /* extra storage */ 292 int flags; /* extra storage */
308 int retry_reason; 293 int retry_reason;
309 int num; 294 int num;
310 void *ptr; 295 void *ptr;
311 struct bio_st *next_bio; /* used by filter BIOs */ 296 struct bio_st *next_bio; /* used by filter BIOs */
312 struct bio_st *prev_bio; /* used by filter BIOs */ 297 struct bio_st *prev_bio; /* used by filter BIOs */
313 int references; 298 int references;
314 unsigned long num_read; 299 unsigned long num_read;
315 unsigned long num_write; 300 unsigned long num_write;
316 301
317 CRYPTO_EX_DATA ex_data; 302 CRYPTO_EX_DATA ex_data;
318 }; 303 };
319 304
320 DECLARE_STACK_OF(BIO) 305 DECLARE_STACK_OF(BIO)
321 306
322 typedef struct bio_f_buffer_ctx_struct 307 typedef struct bio_f_buffer_ctx_struct
323 { 308 {
309 /* Buffers are setup like this:
310 *
311 * <---------------------- size ----------------------->
312 * +---------------------------------------------------+
313 * | consumed | remaining | free space |
314 * +---------------------------------------------------+
315 * <-- off --><------- len ------->
316 */
317
324 /* BIO *bio; */ /* this is now in the BIO struct */ 318 /* BIO *bio; */ /* this is now in the BIO struct */
325 int ibuf_size; /* how big is the input buffer */ 319 int ibuf_size; /* how big is the input buffer */
326 int obuf_size; /* how big is the output buffer */ 320 int obuf_size; /* how big is the output buffer */
327 321
328 char *ibuf; /* the char array */ 322 char *ibuf; /* the char array */
329 int ibuf_len; /* how many bytes are in it */ 323 int ibuf_len; /* how many bytes are in it */
330 int ibuf_off; /* write/read offset */ 324 int ibuf_off; /* write/read offset */
331 325
332 char *obuf; /* the char array */ 326 char *obuf; /* the char array */
333 int obuf_len; /* how many bytes are in it */ 327 int obuf_len; /* how many bytes are in it */
334 int obuf_off; /* write/read offset */ 328 int obuf_off; /* write/read offset */
335 } BIO_F_BUFFER_CTX; 329 } BIO_F_BUFFER_CTX;
336 330
331 /* Prefix and suffix callback in ASN1 BIO */
332 typedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, void *parg);
333
337 /* connect BIO stuff */ 334 /* connect BIO stuff */
338 #define BIO_CONN_S_BEFORE 1 335 #define BIO_CONN_S_BEFORE 1
339 #define BIO_CONN_S_GET_IP 2 336 #define BIO_CONN_S_GET_IP 2
340 #define BIO_CONN_S_GET_PORT 3 337 #define BIO_CONN_S_GET_PORT 3
341 #define BIO_CONN_S_CREATE_SOCKET 4 338 #define BIO_CONN_S_CREATE_SOCKET 4
342 #define BIO_CONN_S_CONNECT 5 339 #define BIO_CONN_S_CONNECT 5
343 #define BIO_CONN_S_OK 6 340 #define BIO_CONN_S_OK 6
344 #define BIO_CONN_S_BLOCKED_CONNECT 7 341 #define BIO_CONN_S_BLOCKED_CONNECT 7
345 #define BIO_CONN_S_NBIO 8 342 #define BIO_CONN_S_NBIO 8
346 /*#define BIO_CONN_get_param_hostname BIO_ctrl */ 343 /*#define BIO_CONN_get_param_hostname BIO_ctrl */
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 #define BIO_C_GET_WRITE_GUARANTEE 140 386 #define BIO_C_GET_WRITE_GUARANTEE 140
390 #define BIO_C_GET_READ_REQUEST 141 387 #define BIO_C_GET_READ_REQUEST 141
391 #define BIO_C_SHUTDOWN_WR 142 388 #define BIO_C_SHUTDOWN_WR 142
392 #define BIO_C_NREAD0 143 389 #define BIO_C_NREAD0 143
393 #define BIO_C_NREAD 144 390 #define BIO_C_NREAD 144
394 #define BIO_C_NWRITE0 145 391 #define BIO_C_NWRITE0 145
395 #define BIO_C_NWRITE 146 392 #define BIO_C_NWRITE 146
396 #define BIO_C_RESET_READ_REQUEST 147 393 #define BIO_C_RESET_READ_REQUEST 147
397 #define BIO_C_SET_MD_CTX 148 394 #define BIO_C_SET_MD_CTX 148
398 395
396 #define BIO_C_SET_PREFIX 149
397 #define BIO_C_GET_PREFIX 150
398 #define BIO_C_SET_SUFFIX 151
399 #define BIO_C_GET_SUFFIX 152
400
401 #define BIO_C_SET_EX_ARG 153
402 #define BIO_C_GET_EX_ARG 154
399 403
400 #define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) 404 #define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg)
401 #define BIO_get_app_data(s) BIO_get_ex_data(s,0) 405 #define BIO_get_app_data(s) BIO_get_ex_data(s,0)
402 406
403 /* BIO_s_connect() and BIO_s_socks4a_connect() */ 407 /* BIO_s_connect() and BIO_s_socks4a_connect() */
404 #define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)nam e) 408 #define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)nam e)
405 #define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port) 409 #define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port)
406 #define BIO_set_conn_ip(b,ip) BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip) 410 #define BIO_set_conn_ip(b,ip) BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip)
407 #define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)por t) 411 #define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)por t)
408 #define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) 412 #define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 /* These two aren't currently implemented */ 556 /* These two aren't currently implemented */
553 /* int BIO_get_ex_num(BIO *bio); */ 557 /* int BIO_get_ex_num(BIO *bio); */
554 /* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */ 558 /* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */
555 int BIO_set_ex_data(BIO *bio,int idx,void *data); 559 int BIO_set_ex_data(BIO *bio,int idx,void *data);
556 void *BIO_get_ex_data(BIO *bio,int idx); 560 void *BIO_get_ex_data(BIO *bio,int idx);
557 int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 561 int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
558 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 562 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
559 unsigned long BIO_number_read(BIO *bio); 563 unsigned long BIO_number_read(BIO *bio);
560 unsigned long BIO_number_written(BIO *bio); 564 unsigned long BIO_number_written(BIO *bio);
561 565
566 /* For BIO_f_asn1() */
567 int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix,
568 asn1_ps_func *prefix_free);
569 int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix,
570 asn1_ps_func **pprefix_free);
571 int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix,
572 asn1_ps_func *suffix_free);
573 int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix,
574 asn1_ps_func **psuffix_free);
575
562 # ifndef OPENSSL_NO_FP_API 576 # ifndef OPENSSL_NO_FP_API
563 # if defined(OPENSSL_SYS_WIN16) && defined(_WINDLL)
564 BIO_METHOD *BIO_s_file_internal(void);
565 BIO *BIO_new_file_internal(char *filename, char *mode);
566 BIO *BIO_new_fp_internal(FILE *stream, int close_flag);
567 # define BIO_s_file BIO_s_file_internal
568 # define BIO_new_file BIO_new_file_internal
569 # define BIO_new_fp BIO_new_fp_internal
570 # else /* FP_API */
571 BIO_METHOD *BIO_s_file(void ); 577 BIO_METHOD *BIO_s_file(void );
572 BIO *BIO_new_file(const char *filename, const char *mode); 578 BIO *BIO_new_file(const char *filename, const char *mode);
573 BIO *BIO_new_fp(FILE *stream, int close_flag); 579 BIO *BIO_new_fp(FILE *stream, int close_flag);
574 # define BIO_s_file_internal»» BIO_s_file 580 # define BIO_s_file_internal» BIO_s_file
575 # define BIO_new_file_internal» BIO_new_file
576 # define BIO_new_fp_internal»» BIO_s_file
577 # endif /* FP_API */
578 # endif 581 # endif
579 BIO * BIO_new(BIO_METHOD *type); 582 BIO * BIO_new(BIO_METHOD *type);
580 int BIO_set(BIO *a,BIO_METHOD *type); 583 int BIO_set(BIO *a,BIO_METHOD *type);
581 int BIO_free(BIO *a); 584 int BIO_free(BIO *a);
582 void BIO_vfree(BIO *a); 585 void BIO_vfree(BIO *a);
583 int BIO_read(BIO *b, void *data, int len); 586 int BIO_read(BIO *b, void *data, int len);
584 int BIO_gets(BIO *bp,char *buf, int size); 587 int BIO_gets(BIO *bp,char *buf, int size);
585 int BIO_write(BIO *b, const void *data, int len); 588 int BIO_write(BIO *b, const void *data, int len);
586 int BIO_puts(BIO *bp,const char *buf); 589 int BIO_puts(BIO *bp,const char *buf);
587 int BIO_indent(BIO *b,int indent,int max); 590 int BIO_indent(BIO *b,int indent,int max);
588 long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); 591 long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg);
589 long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const c har *, int, long, long)); 592 long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const c har *, int, long, long));
590 char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); 593 char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg);
591 long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg); 594 long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg);
592 BIO * BIO_push(BIO *b,BIO *append); 595 BIO * BIO_push(BIO *b,BIO *append);
593 BIO * BIO_pop(BIO *b); 596 BIO * BIO_pop(BIO *b);
594 void BIO_free_all(BIO *a); 597 void BIO_free_all(BIO *a);
595 BIO * BIO_find_type(BIO *b,int bio_type); 598 BIO * BIO_find_type(BIO *b,int bio_type);
596 BIO * BIO_next(BIO *b); 599 BIO * BIO_next(BIO *b);
597 BIO * BIO_get_retry_BIO(BIO *bio, int *reason); 600 BIO * BIO_get_retry_BIO(BIO *bio, int *reason);
598 int BIO_get_retry_reason(BIO *bio); 601 int BIO_get_retry_reason(BIO *bio);
599 BIO * BIO_dup_chain(BIO *in); 602 BIO * BIO_dup_chain(BIO *in);
600 603
601 int BIO_nread0(BIO *bio, char **buf); 604 int BIO_nread0(BIO *bio, char **buf);
602 int BIO_nread(BIO *bio, char **buf, int num); 605 int BIO_nread(BIO *bio, char **buf, int num);
603 int BIO_nwrite0(BIO *bio, char **buf); 606 int BIO_nwrite0(BIO *bio, char **buf);
604 int BIO_nwrite(BIO *bio, char **buf, int num); 607 int BIO_nwrite(BIO *bio, char **buf, int num);
605 608
606 #ifndef OPENSSL_SYS_WIN16
607 long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, 609 long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,
608 long argl,long ret); 610 long argl,long ret);
609 #else
610 long _far _loadds BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,
611 long argl,long ret);
612 #endif
613 611
614 BIO_METHOD *BIO_s_mem(void); 612 BIO_METHOD *BIO_s_mem(void);
615 BIO *BIO_new_mem_buf(void *buf, int len); 613 BIO *BIO_new_mem_buf(void *buf, int len);
616 BIO_METHOD *BIO_s_socket(void); 614 BIO_METHOD *BIO_s_socket(void);
617 BIO_METHOD *BIO_s_connect(void); 615 BIO_METHOD *BIO_s_connect(void);
618 BIO_METHOD *BIO_s_accept(void); 616 BIO_METHOD *BIO_s_accept(void);
619 BIO_METHOD *BIO_s_fd(void); 617 BIO_METHOD *BIO_s_fd(void);
620 #ifndef OPENSSL_SYS_OS2 618 #ifndef OPENSSL_SYS_OS2
621 BIO_METHOD *BIO_s_log(void); 619 BIO_METHOD *BIO_s_log(void);
622 #endif 620 #endif
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 #define BIO_R_UNABLE_TO_LISTEN_SOCKET 119 770 #define BIO_R_UNABLE_TO_LISTEN_SOCKET 119
773 #define BIO_R_UNINITIALIZED 120 771 #define BIO_R_UNINITIALIZED 120
774 #define BIO_R_UNSUPPORTED_METHOD 121 772 #define BIO_R_UNSUPPORTED_METHOD 121
775 #define BIO_R_WRITE_TO_READ_ONLY_BIO 126 773 #define BIO_R_WRITE_TO_READ_ONLY_BIO 126
776 #define BIO_R_WSASTARTUP 122 774 #define BIO_R_WSASTARTUP 122
777 775
778 #ifdef __cplusplus 776 #ifdef __cplusplus
779 } 777 }
780 #endif 778 #endif
781 #endif 779 #endif
OLDNEW
« no previous file with comments | « openssl/crypto/bio/bf_nbio.c ('k') | openssl/crypto/bio/bio_cb.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698