From: David Benjamin Date: Sat, 19 Mar 2016 16:32:14 +0000 (-0400) Subject: RT4660: BIO_METHODs should be const. X-Git-Tag: OpenSSL_1_1_0-pre5~255 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=04f6b0fd9110c85c3c0d6d1172005d1c6755ac86;p=oweals%2Fopenssl.git RT4660: BIO_METHODs should be const. BIO_new, etc., don't need a non-const BIO_METHOD. This allows all the built-in method tables to live in .rodata. Reviewed-by: Richard Levitte --- diff --git a/apps/s_server.c b/apps/s_server.c index b33d76860c..08acc476a7 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -421,7 +421,7 @@ static int ebcdic_gets(BIO *bp, char *buf, int size); static int ebcdic_puts(BIO *bp, const char *str); # define BIO_TYPE_EBCDIC_FILTER (18|0x0200) -static BIO_METHOD methods_ebcdic = { +static const BIO_METHOD methods_ebcdic = { BIO_TYPE_EBCDIC_FILTER, "EBCDIC/ASCII filter", ebcdic_write, @@ -439,7 +439,7 @@ typedef struct { char buff[1]; } EBCDIC_OUTBUFF; -BIO_METHOD *BIO_f_ebcdic_filter() +const BIO_METHOD *BIO_f_ebcdic_filter() { return (&methods_ebcdic); } diff --git a/crypto/asn1/bio_asn1.c b/crypto/asn1/bio_asn1.c index 33998e7264..80206aa4f6 100644 --- a/crypto/asn1/bio_asn1.c +++ b/crypto/asn1/bio_asn1.c @@ -124,7 +124,7 @@ static int asn1_bio_setup_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx, asn1_bio_state_t ex_state, asn1_bio_state_t other_state); -static BIO_METHOD methods_asn1 = { +static const BIO_METHOD methods_asn1 = { BIO_TYPE_ASN1, "asn1", asn1_bio_write, @@ -137,7 +137,7 @@ static BIO_METHOD methods_asn1 = { asn1_bio_callback_ctrl, }; -BIO_METHOD *BIO_f_asn1(void) +const BIO_METHOD *BIO_f_asn1(void) { return (&methods_asn1); } diff --git a/crypto/bio/bf_buff.c b/crypto/bio/bf_buff.c index 1486a18335..6040c85119 100644 --- a/crypto/bio/bf_buff.c +++ b/crypto/bio/bf_buff.c @@ -70,7 +70,7 @@ static int buffer_free(BIO *data); static long buffer_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp); #define DEFAULT_BUFFER_SIZE 4096 -static BIO_METHOD methods_buffer = { +static const BIO_METHOD methods_buffer = { BIO_TYPE_BUFFER, "buffer", buffer_write, @@ -83,7 +83,7 @@ static BIO_METHOD methods_buffer = { buffer_callback_ctrl, }; -BIO_METHOD *BIO_f_buffer(void) +const BIO_METHOD *BIO_f_buffer(void) { return (&methods_buffer); } diff --git a/crypto/bio/bf_lbuf.c b/crypto/bio/bf_lbuf.c index 96ee9206af..77462f2445 100644 --- a/crypto/bio/bf_lbuf.c +++ b/crypto/bio/bf_lbuf.c @@ -75,7 +75,7 @@ static long linebuffer_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp); /* #define DEBUG */ -static BIO_METHOD methods_linebuffer = { +static const BIO_METHOD methods_linebuffer = { BIO_TYPE_LINEBUFFER, "linebuffer", linebuffer_write, @@ -88,7 +88,7 @@ static BIO_METHOD methods_linebuffer = { linebuffer_callback_ctrl, }; -BIO_METHOD *BIO_f_linebuffer(void) +const BIO_METHOD *BIO_f_linebuffer(void) { return (&methods_linebuffer); } diff --git a/crypto/bio/bf_nbio.c b/crypto/bio/bf_nbio.c index e78bca5059..c8bf580e1d 100644 --- a/crypto/bio/bf_nbio.c +++ b/crypto/bio/bf_nbio.c @@ -79,7 +79,7 @@ typedef struct nbio_test_st { int lwn; } NBIO_TEST; -static BIO_METHOD methods_nbiof = { +static const BIO_METHOD methods_nbiof = { BIO_TYPE_NBIO_TEST, "non-blocking IO test filter", nbiof_write, @@ -92,7 +92,7 @@ static BIO_METHOD methods_nbiof = { nbiof_callback_ctrl, }; -BIO_METHOD *BIO_f_nbio_test(void) +const BIO_METHOD *BIO_f_nbio_test(void) { return (&methods_nbiof); } diff --git a/crypto/bio/bf_null.c b/crypto/bio/bf_null.c index 1481445486..e3b87d24e5 100644 --- a/crypto/bio/bf_null.c +++ b/crypto/bio/bf_null.c @@ -72,7 +72,7 @@ static long nullf_ctrl(BIO *h, int cmd, long arg1, void *arg2); static int nullf_new(BIO *h); static int nullf_free(BIO *data); static long nullf_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp); -static BIO_METHOD methods_nullf = { +static const BIO_METHOD methods_nullf = { BIO_TYPE_NULL_FILTER, "NULL filter", nullf_write, @@ -85,7 +85,7 @@ static BIO_METHOD methods_nullf = { nullf_callback_ctrl, }; -BIO_METHOD *BIO_f_null(void) +const BIO_METHOD *BIO_f_null(void) { return (&methods_nullf); } diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c index 522525b129..9357553d36 100644 --- a/crypto/bio/bio_lib.c +++ b/crypto/bio/bio_lib.c @@ -62,7 +62,7 @@ #include #include -BIO *BIO_new(BIO_METHOD *method) +BIO *BIO_new(const BIO_METHOD *method) { BIO *ret = OPENSSL_malloc(sizeof(*ret)); @@ -77,7 +77,7 @@ BIO *BIO_new(BIO_METHOD *method) return (ret); } -int BIO_set(BIO *bio, BIO_METHOD *method) +int BIO_set(BIO *bio, const BIO_METHOD *method) { bio->method = method; bio->callback = NULL; diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c index a0a70c4484..8cd66fe1ee 100644 --- a/crypto/bio/bss_acpt.c +++ b/crypto/bio/bss_acpt.c @@ -99,7 +99,7 @@ static void BIO_ACCEPT_free(BIO_ACCEPT *a); # define ACPT_S_ACCEPT 5 # define ACPT_S_OK 6 -static BIO_METHOD methods_acceptp = { +static const BIO_METHOD methods_acceptp = { BIO_TYPE_ACCEPT, "socket accept", acpt_write, @@ -112,7 +112,7 @@ static BIO_METHOD methods_acceptp = { NULL, }; -BIO_METHOD *BIO_s_accept(void) +const BIO_METHOD *BIO_s_accept(void) { return (&methods_acceptp); } diff --git a/crypto/bio/bss_bio.c b/crypto/bio/bss_bio.c index 4caa2331ff..518fa35c2f 100644 --- a/crypto/bio/bss_bio.c +++ b/crypto/bio/bss_bio.c @@ -81,7 +81,7 @@ static int bio_puts(BIO *bio, const char *str); static int bio_make_pair(BIO *bio1, BIO *bio2); static void bio_destroy_pair(BIO *bio); -static BIO_METHOD methods_biop = { +static const BIO_METHOD methods_biop = { BIO_TYPE_BIO, "BIO pair", bio_write, @@ -94,7 +94,7 @@ static BIO_METHOD methods_biop = { NULL /* no bio_callback_ctrl */ }; -BIO_METHOD *BIO_s_bio(void) +const BIO_METHOD *BIO_s_bio(void) { return &methods_biop; } diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index 492fe01c03..a4949b3d60 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -103,7 +103,7 @@ void BIO_CONNECT_free(BIO_CONNECT *a); #define BIO_CONN_S_OK 5 #define BIO_CONN_S_BLOCKED_CONNECT 6 -static BIO_METHOD methods_connectp = { +static const BIO_METHOD methods_connectp = { BIO_TYPE_CONNECT, "socket connect", conn_write, @@ -285,7 +285,7 @@ void BIO_CONNECT_free(BIO_CONNECT *a) OPENSSL_free(a); } -BIO_METHOD *BIO_s_connect(void) +const BIO_METHOD *BIO_s_connect(void) { return (&methods_connectp); } diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c index 5a52e7c3cb..cf2f9f66b5 100644 --- a/crypto/bio/bss_dgram.c +++ b/crypto/bio/bss_dgram.c @@ -125,7 +125,7 @@ static int BIO_dgram_should_retry(int s); static void get_current_time(struct timeval *t); -static BIO_METHOD methods_dgramp = { +static const BIO_METHOD methods_dgramp = { BIO_TYPE_DGRAM, "datagram socket", dgram_write, @@ -139,7 +139,7 @@ static BIO_METHOD methods_dgramp = { }; # ifndef OPENSSL_NO_SCTP -static BIO_METHOD methods_dgramp_sctp = { +static const BIO_METHOD methods_dgramp_sctp = { BIO_TYPE_DGRAM_SCTP, "datagram sctp socket", dgram_sctp_write, @@ -189,7 +189,7 @@ typedef struct bio_dgram_sctp_data_st { } bio_dgram_sctp_data; # endif -BIO_METHOD *BIO_s_datagram(void) +const BIO_METHOD *BIO_s_datagram(void) { return (&methods_dgramp); } @@ -858,7 +858,7 @@ static int dgram_puts(BIO *bp, const char *str) } # ifndef OPENSSL_NO_SCTP -BIO_METHOD *BIO_s_datagram_sctp(void) +const BIO_METHOD *BIO_s_datagram_sctp(void) { return (&methods_dgramp_sctp); } diff --git a/crypto/bio/bss_fd.c b/crypto/bio/bss_fd.c index 48921eee99..983e9fe08c 100644 --- a/crypto/bio/bss_fd.c +++ b/crypto/bio/bss_fd.c @@ -79,7 +79,7 @@ int BIO_fd_should_retry(int i) return 0; } -BIO_METHOD *BIO_s_fd(void) +const BIO_METHOD *BIO_s_fd(void) { return NULL; } @@ -105,7 +105,7 @@ static int fd_new(BIO *h); static int fd_free(BIO *data); int BIO_fd_should_retry(int s); -static BIO_METHOD methods_fdp = { +static const BIO_METHOD methods_fdp = { BIO_TYPE_FD, "file descriptor", fd_write, fd_read, @@ -117,7 +117,7 @@ static BIO_METHOD methods_fdp = { NULL, }; -BIO_METHOD *BIO_s_fd(void) +const BIO_METHOD *BIO_s_fd(void) { return (&methods_fdp); } diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c index d53d52bd14..643a855a8d 100644 --- a/crypto/bio/bss_file.c +++ b/crypto/bio/bss_file.c @@ -96,7 +96,7 @@ static int file_gets(BIO *h, char *str, int size); static long file_ctrl(BIO *h, int cmd, long arg1, void *arg2); static int file_new(BIO *h); static int file_free(BIO *data); -static BIO_METHOD methods_filep = { +static const BIO_METHOD methods_filep = { BIO_TYPE_FILE, "FILE pointer", file_write, @@ -198,7 +198,7 @@ BIO *BIO_new_fp(FILE *stream, int close_flag) return (ret); } -BIO_METHOD *BIO_s_file(void) +const BIO_METHOD *BIO_s_file(void) { return (&methods_filep); } @@ -479,7 +479,7 @@ static int file_free(BIO *a) return 0; } -static BIO_METHOD methods_filep = { +static const BIO_METHOD methods_filep = { BIO_TYPE_FILE, "FILE pointer", file_write, @@ -492,7 +492,7 @@ static BIO_METHOD methods_filep = { NULL, }; -BIO_METHOD *BIO_s_file(void) +const BIO_METHOD *BIO_s_file(void) { return (&methods_filep); } diff --git a/crypto/bio/bss_log.c b/crypto/bio/bss_log.c index 560f1b7aa3..a6bc0e779a 100644 --- a/crypto/bio/bss_log.c +++ b/crypto/bio/bss_log.c @@ -128,7 +128,7 @@ static void xopenlog(BIO *bp, char *name, int level); static void xsyslog(BIO *bp, int priority, const char *string); static void xcloselog(BIO *bp); -static BIO_METHOD methods_slg = { +static const BIO_METHOD methods_slg = { BIO_TYPE_MEM, "syslog", slg_write, NULL, @@ -140,7 +140,7 @@ static BIO_METHOD methods_slg = { NULL, }; -BIO_METHOD *BIO_s_log(void) +const BIO_METHOD *BIO_s_log(void) { return (&methods_slg); } diff --git a/crypto/bio/bss_mem.c b/crypto/bio/bss_mem.c index 4d4554719c..68ac90d0af 100644 --- a/crypto/bio/bss_mem.c +++ b/crypto/bio/bss_mem.c @@ -68,7 +68,7 @@ static long mem_ctrl(BIO *h, int cmd, long arg1, void *arg2); static int mem_new(BIO *h); static int secmem_new(BIO *h); static int mem_free(BIO *data); -static BIO_METHOD mem_method = { +static const BIO_METHOD mem_method = { BIO_TYPE_MEM, "memory buffer", mem_write, @@ -80,7 +80,7 @@ static BIO_METHOD mem_method = { mem_free, NULL, }; -static BIO_METHOD secmem_method = { +static const BIO_METHOD secmem_method = { BIO_TYPE_MEM, "secure memory buffer", mem_write, @@ -98,12 +98,12 @@ static BIO_METHOD secmem_method = { * should_retry is not set */ -BIO_METHOD *BIO_s_mem(void) +const BIO_METHOD *BIO_s_mem(void) { return (&mem_method); } -BIO_METHOD *BIO_s_secmem(void) +const BIO_METHOD *BIO_s_secmem(void) { return(&secmem_method); } diff --git a/crypto/bio/bss_null.c b/crypto/bio/bss_null.c index 3a1d77d254..c5e24844d1 100644 --- a/crypto/bio/bss_null.c +++ b/crypto/bio/bss_null.c @@ -67,7 +67,7 @@ static int null_gets(BIO *h, char *str, int size); static long null_ctrl(BIO *h, int cmd, long arg1, void *arg2); static int null_new(BIO *h); static int null_free(BIO *data); -static BIO_METHOD null_method = { +static const BIO_METHOD null_method = { BIO_TYPE_NULL, "NULL", null_write, @@ -80,7 +80,7 @@ static BIO_METHOD null_method = { NULL, }; -BIO_METHOD *BIO_s_null(void) +const BIO_METHOD *BIO_s_null(void) { return (&null_method); } diff --git a/crypto/bio/bss_sock.c b/crypto/bio/bss_sock.c index 8d87c8c338..85d7d661fb 100644 --- a/crypto/bio/bss_sock.c +++ b/crypto/bio/bss_sock.c @@ -78,7 +78,7 @@ static int sock_new(BIO *h); static int sock_free(BIO *data); int BIO_sock_should_retry(int s); -static BIO_METHOD methods_sockp = { +static const BIO_METHOD methods_sockp = { BIO_TYPE_SOCKET, "socket", sock_write, @@ -91,7 +91,7 @@ static BIO_METHOD methods_sockp = { NULL, }; -BIO_METHOD *BIO_s_socket(void) +const BIO_METHOD *BIO_s_socket(void) { return (&methods_sockp); } diff --git a/crypto/comp/c_zlib.c b/crypto/comp/c_zlib.c index c78bbcfde8..138d686601 100644 --- a/crypto/comp/c_zlib.c +++ b/crypto/comp/c_zlib.c @@ -331,7 +331,7 @@ static int bio_zlib_write(BIO *b, const char *in, int inl); static long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr); static long bio_zlib_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp); -static BIO_METHOD bio_meth_zlib = { +static const BIO_METHOD bio_meth_zlib = { BIO_TYPE_COMP, "zlib", bio_zlib_write, @@ -344,7 +344,7 @@ static BIO_METHOD bio_meth_zlib = { bio_zlib_callback_ctrl }; -BIO_METHOD *BIO_f_zlib(void) +const BIO_METHOD *BIO_f_zlib(void) { return &bio_meth_zlib; } diff --git a/crypto/evp/bio_b64.c b/crypto/evp/bio_b64.c index 097b0958f1..93e4166b48 100644 --- a/crypto/evp/bio_b64.c +++ b/crypto/evp/bio_b64.c @@ -93,7 +93,7 @@ typedef struct b64_struct { char tmp[B64_BLOCK_SIZE]; } BIO_B64_CTX; -static BIO_METHOD methods_b64 = { +static const BIO_METHOD methods_b64 = { BIO_TYPE_BASE64, "base64 encoding", b64_write, b64_read, @@ -105,7 +105,7 @@ static BIO_METHOD methods_b64 = { b64_callback_ctrl, }; -BIO_METHOD *BIO_f_base64(void) +const BIO_METHOD *BIO_f_base64(void) { return (&methods_b64); } diff --git a/crypto/evp/bio_enc.c b/crypto/evp/bio_enc.c index 9754031e2b..e89c1df098 100644 --- a/crypto/evp/bio_enc.c +++ b/crypto/evp/bio_enc.c @@ -90,7 +90,7 @@ typedef struct enc_struct { char buf[ENC_BLOCK_SIZE + BUF_OFFSET + 2]; } BIO_ENC_CTX; -static BIO_METHOD methods_enc = { +static const BIO_METHOD methods_enc = { BIO_TYPE_CIPHER, "cipher", enc_write, enc_read, @@ -102,7 +102,7 @@ static BIO_METHOD methods_enc = { enc_callback_ctrl, }; -BIO_METHOD *BIO_f_cipher(void) +const BIO_METHOD *BIO_f_cipher(void) { return (&methods_enc); } diff --git a/crypto/evp/bio_md.c b/crypto/evp/bio_md.c index 30a506ebba..90dffa1313 100644 --- a/crypto/evp/bio_md.c +++ b/crypto/evp/bio_md.c @@ -78,7 +78,7 @@ static int md_new(BIO *h); static int md_free(BIO *data); static long md_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp); -static BIO_METHOD methods_md = { +static const BIO_METHOD methods_md = { BIO_TYPE_MD, "message digest", md_write, md_read, @@ -90,7 +90,7 @@ static BIO_METHOD methods_md = { md_callback_ctrl, }; -BIO_METHOD *BIO_f_md(void) +const BIO_METHOD *BIO_f_md(void) { return (&methods_md); } diff --git a/crypto/evp/bio_ok.c b/crypto/evp/bio_ok.c index ec5d7199f5..a29777ced0 100644 --- a/crypto/evp/bio_ok.c +++ b/crypto/evp/bio_ok.c @@ -155,7 +155,7 @@ typedef struct ok_struct { unsigned char buf[IOBS]; } BIO_OK_CTX; -static BIO_METHOD methods_ok = { +static const BIO_METHOD methods_ok = { BIO_TYPE_CIPHER, "reliable", ok_write, ok_read, @@ -167,7 +167,7 @@ static BIO_METHOD methods_ok = { ok_callback_ctrl, }; -BIO_METHOD *BIO_f_reliable(void) +const BIO_METHOD *BIO_f_reliable(void) { return (&methods_ok); } diff --git a/doc/crypto/BIO_f_base64.pod b/doc/crypto/BIO_f_base64.pod index d1d7bf0bd0..c25ac51124 100644 --- a/doc/crypto/BIO_f_base64.pod +++ b/doc/crypto/BIO_f_base64.pod @@ -9,7 +9,7 @@ BIO_f_base64 - base64 BIO filter #include #include - BIO_METHOD * BIO_f_base64(void); + const BIO_METHOD * BIO_f_base64(void); =head1 DESCRIPTION diff --git a/doc/crypto/BIO_f_buffer.pod b/doc/crypto/BIO_f_buffer.pod index d07c41917f..edaa3513df 100644 --- a/doc/crypto/BIO_f_buffer.pod +++ b/doc/crypto/BIO_f_buffer.pod @@ -8,7 +8,7 @@ BIO_f_buffer - buffering BIO #include - BIO_METHOD * BIO_f_buffer(void); + const BIO_METHOD * BIO_f_buffer(void); #define BIO_get_buffer_num_lines(b) #define BIO_set_read_buffer_size(b,size) diff --git a/doc/crypto/BIO_f_cipher.pod b/doc/crypto/BIO_f_cipher.pod index fd8762a4fe..947d1523e3 100644 --- a/doc/crypto/BIO_f_cipher.pod +++ b/doc/crypto/BIO_f_cipher.pod @@ -9,7 +9,7 @@ BIO_f_cipher, BIO_set_cipher, BIO_get_cipher_status, BIO_get_cipher_ctx - cipher #include #include - BIO_METHOD * BIO_f_cipher(void); + const BIO_METHOD * BIO_f_cipher(void); void BIO_set_cipher(BIO *b,const EVP_CIPHER *cipher, unsigned char *key, unsigned char *iv, int enc); int BIO_get_cipher_status(BIO *b) diff --git a/doc/crypto/BIO_f_md.pod b/doc/crypto/BIO_f_md.pod index d9aec082f8..b0fe0143bd 100644 --- a/doc/crypto/BIO_f_md.pod +++ b/doc/crypto/BIO_f_md.pod @@ -9,7 +9,7 @@ BIO_f_md, BIO_set_md, BIO_get_md, BIO_get_md_ctx - message digest BIO filter #include #include - BIO_METHOD * BIO_f_md(void); + const BIO_METHOD * BIO_f_md(void); int BIO_set_md(BIO *b,EVP_MD *md); int BIO_get_md(BIO *b,EVP_MD **mdp); int BIO_get_md_ctx(BIO *b,EVP_MD_CTX **mdcp); diff --git a/doc/crypto/BIO_f_null.pod b/doc/crypto/BIO_f_null.pod index b057c18408..6ee84915e1 100644 --- a/doc/crypto/BIO_f_null.pod +++ b/doc/crypto/BIO_f_null.pod @@ -8,7 +8,7 @@ BIO_f_null - null filter #include - BIO_METHOD * BIO_f_null(void); + const BIO_METHOD * BIO_f_null(void); =head1 DESCRIPTION diff --git a/doc/crypto/BIO_f_ssl.pod b/doc/crypto/BIO_f_ssl.pod index 4d49dc789b..46eecd11e2 100644 --- a/doc/crypto/BIO_f_ssl.pod +++ b/doc/crypto/BIO_f_ssl.pod @@ -12,7 +12,7 @@ BIO_ssl_shutdown - SSL BIO #include #include - BIO_METHOD *BIO_f_ssl(void); + const BIO_METHOD *BIO_f_ssl(void); #define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl) #define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp) diff --git a/doc/crypto/BIO_new.pod b/doc/crypto/BIO_new.pod index d6d87c3901..4c9299bb3c 100644 --- a/doc/crypto/BIO_new.pod +++ b/doc/crypto/BIO_new.pod @@ -8,8 +8,8 @@ BIO_new, BIO_set, BIO_up_ref, BIO_free, BIO_vfree, BIO_free_all - BIO allocation #include - BIO * BIO_new(BIO_METHOD *type); - int BIO_set(BIO *a,BIO_METHOD *type); + BIO * BIO_new(const BIO_METHOD *type); + int BIO_set(BIO *a,const BIO_METHOD *type); int BIO_up_ref(BIO *a); int BIO_free(BIO *a); void BIO_vfree(BIO *a); diff --git a/doc/crypto/BIO_s_accept.pod b/doc/crypto/BIO_s_accept.pod index ec8fa3a0ca..e0877e0d8e 100644 --- a/doc/crypto/BIO_s_accept.pod +++ b/doc/crypto/BIO_s_accept.pod @@ -10,7 +10,7 @@ BIO_get_bind_mode, BIO_do_accept - accept BIO #include - BIO_METHOD *BIO_s_accept(void); + const BIO_METHOD *BIO_s_accept(void); long BIO_set_accept_port(BIO *b, char *name); char *BIO_get_accept_port(BIO *b); diff --git a/doc/crypto/BIO_s_bio.pod b/doc/crypto/BIO_s_bio.pod index 0daa518a15..ce3cf6e383 100644 --- a/doc/crypto/BIO_s_bio.pod +++ b/doc/crypto/BIO_s_bio.pod @@ -11,7 +11,7 @@ BIO_ctrl_get_read_request, BIO_ctrl_reset_read_request - BIO pair BIO #include - BIO_METHOD *BIO_s_bio(void); + const BIO_METHOD *BIO_s_bio(void); #define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) #define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) diff --git a/doc/crypto/BIO_s_connect.pod b/doc/crypto/BIO_s_connect.pod index 7adb78da70..bd3cf81d5b 100644 --- a/doc/crypto/BIO_s_connect.pod +++ b/doc/crypto/BIO_s_connect.pod @@ -11,7 +11,7 @@ BIO_set_nbio, BIO_do_connect - connect BIO #include - BIO_METHOD * BIO_s_connect(void); + const BIO_METHOD * BIO_s_connect(void); BIO *BIO_new_connect(char *name); diff --git a/doc/crypto/BIO_s_fd.pod b/doc/crypto/BIO_s_fd.pod index 2f6b033f0a..7c7cee9843 100644 --- a/doc/crypto/BIO_s_fd.pod +++ b/doc/crypto/BIO_s_fd.pod @@ -8,7 +8,7 @@ BIO_s_fd, BIO_set_fd, BIO_get_fd, BIO_new_fd - file descriptor BIO #include - BIO_METHOD * BIO_s_fd(void); + const BIO_METHOD * BIO_s_fd(void); #define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) #define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) diff --git a/doc/crypto/BIO_s_file.pod b/doc/crypto/BIO_s_file.pod index 5adc569793..5ba0d34dd4 100644 --- a/doc/crypto/BIO_s_file.pod +++ b/doc/crypto/BIO_s_file.pod @@ -10,7 +10,7 @@ BIO_rw_filename - FILE bio #include - BIO_METHOD * BIO_s_file(void); + const BIO_METHOD * BIO_s_file(void); BIO *BIO_new_file(const char *filename, const char *mode); BIO *BIO_new_fp(FILE *stream, int flags); diff --git a/doc/crypto/BIO_s_mem.pod b/doc/crypto/BIO_s_mem.pod index b9ce5da6e2..03e291dce3 100644 --- a/doc/crypto/BIO_s_mem.pod +++ b/doc/crypto/BIO_s_mem.pod @@ -9,8 +9,8 @@ BIO_get_mem_ptr, BIO_new_mem_buf - memory BIO #include - BIO_METHOD * BIO_s_mem(void); - BIO_METHOD * BIO_s_secmem(void); + const BIO_METHOD * BIO_s_mem(void); + const BIO_METHOD * BIO_s_secmem(void); BIO_set_mem_eof_return(BIO *b,int v) long BIO_get_mem_data(BIO *b, char **pp) diff --git a/doc/crypto/BIO_s_null.pod b/doc/crypto/BIO_s_null.pod index e5514f7238..00905ecbea 100644 --- a/doc/crypto/BIO_s_null.pod +++ b/doc/crypto/BIO_s_null.pod @@ -8,7 +8,7 @@ BIO_s_null - null data sink #include - BIO_METHOD * BIO_s_null(void); + const BIO_METHOD * BIO_s_null(void); =head1 DESCRIPTION diff --git a/doc/crypto/BIO_s_socket.pod b/doc/crypto/BIO_s_socket.pod index 1c8d3a9110..13efb50edc 100644 --- a/doc/crypto/BIO_s_socket.pod +++ b/doc/crypto/BIO_s_socket.pod @@ -8,7 +8,7 @@ BIO_s_socket, BIO_new_socket - socket BIO #include - BIO_METHOD *BIO_s_socket(void); + const BIO_METHOD *BIO_s_socket(void); long BIO_set_fd(BIO *b, int fd, long close_flag); long BIO_get_fd(BIO *b, int *c); diff --git a/include/openssl/asn1.h b/include/openssl/asn1.h index 360914d7d2..4c30a74400 100644 --- a/include/openssl/asn1.h +++ b/include/openssl/asn1.h @@ -887,7 +887,7 @@ unsigned long ASN1_SCTX_get_flags(ASN1_SCTX *p); void ASN1_SCTX_set_app_data(ASN1_SCTX *p, void *data); void *ASN1_SCTX_get_app_data(ASN1_SCTX *p); -BIO_METHOD *BIO_f_asn1(void); +const BIO_METHOD *BIO_f_asn1(void); BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); diff --git a/include/openssl/bio.h b/include/openssl/bio.h index 3b2265fbab..5389770b6a 100644 --- a/include/openssl/bio.h +++ b/include/openssl/bio.h @@ -310,7 +310,7 @@ typedef struct bio_method_st { } BIO_METHOD; struct bio_st { - BIO_METHOD *method; + const BIO_METHOD *method; /* bio, mode, argp, argi, argl, ret */ long (*callback) (struct bio_st *, int, const char *, int, long, long); char *cb_arg; /* first argument for the callback */ @@ -627,13 +627,13 @@ int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, asn1_ps_func **psuffix_free); -BIO_METHOD *BIO_s_file(void); +const BIO_METHOD *BIO_s_file(void); BIO *BIO_new_file(const char *filename, const char *mode); # ifndef OPENSSL_NO_STDIO BIO *BIO_new_fp(FILE *stream, int close_flag); # endif -BIO *BIO_new(BIO_METHOD *type); -int BIO_set(BIO *a, BIO_METHOD *type); +BIO *BIO_new(const BIO_METHOD *type); +int BIO_set(BIO *a, const BIO_METHOD *type); int BIO_free(BIO *a); void BIO_vfree(BIO *a); int BIO_up_ref(BIO *a); @@ -665,31 +665,29 @@ int BIO_nwrite(BIO *bio, char **buf, int num); long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, long ret); -BIO_METHOD *BIO_s_mem(void); -BIO_METHOD *BIO_s_secmem(void); +const BIO_METHOD *BIO_s_mem(void); +const BIO_METHOD *BIO_s_secmem(void); BIO *BIO_new_mem_buf(const void *buf, int len); -BIO_METHOD *BIO_s_socket(void); -BIO_METHOD *BIO_s_connect(void); -BIO_METHOD *BIO_s_accept(void); -BIO_METHOD *BIO_s_fd(void); -BIO_METHOD *BIO_s_log(void); -BIO_METHOD *BIO_s_bio(void); -BIO_METHOD *BIO_s_null(void); -BIO_METHOD *BIO_f_null(void); -BIO_METHOD *BIO_f_buffer(void); +const BIO_METHOD *BIO_s_socket(void); +const BIO_METHOD *BIO_s_connect(void); +const BIO_METHOD *BIO_s_accept(void); +const BIO_METHOD *BIO_s_fd(void); +const BIO_METHOD *BIO_s_log(void); +const BIO_METHOD *BIO_s_bio(void); +const BIO_METHOD *BIO_s_null(void); +const BIO_METHOD *BIO_f_null(void); +const BIO_METHOD *BIO_f_buffer(void); # ifdef OPENSSL_SYS_VMS -BIO_METHOD *BIO_f_linebuffer(void); +const BIO_METHOD *BIO_f_linebuffer(void); # endif -BIO_METHOD *BIO_f_nbio_test(void); +const BIO_METHOD *BIO_f_nbio_test(void); # ifndef OPENSSL_NO_DGRAM -BIO_METHOD *BIO_s_datagram(void); +const BIO_METHOD *BIO_s_datagram(void); # ifndef OPENSSL_NO_SCTP -BIO_METHOD *BIO_s_datagram_sctp(void); +const BIO_METHOD *BIO_s_datagram_sctp(void); # endif # endif -/* BIO_METHOD *BIO_f_ber(void); */ - int BIO_sock_should_retry(int i); int BIO_sock_non_fatal_error(int error); int BIO_dgram_non_fatal_error(int error); diff --git a/include/openssl/comp.h b/include/openssl/comp.h index de4eb32561..9fa71efd55 100644 --- a/include/openssl/comp.h +++ b/include/openssl/comp.h @@ -83,7 +83,7 @@ void COMP_zlib_cleanup(void); # ifdef HEADER_BIO_H # ifdef ZLIB -BIO_METHOD *BIO_f_zlib(void); +const BIO_METHOD *BIO_f_zlib(void); # endif # endif diff --git a/include/openssl/evp.h b/include/openssl/evp.h index af05e66481..25a3e6f937 100644 --- a/include/openssl/evp.h +++ b/include/openssl/evp.h @@ -682,10 +682,10 @@ int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); -BIO_METHOD *BIO_f_md(void); -BIO_METHOD *BIO_f_base64(void); -BIO_METHOD *BIO_f_cipher(void); -BIO_METHOD *BIO_f_reliable(void); +const BIO_METHOD *BIO_f_md(void); +const BIO_METHOD *BIO_f_base64(void); +const BIO_METHOD *BIO_f_cipher(void); +const BIO_METHOD *BIO_f_reliable(void); __owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, const unsigned char *i, int enc); diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h index 980cb6226f..87d9e11acc 100644 --- a/include/openssl/ssl.h +++ b/include/openssl/ssl.h @@ -1367,7 +1367,7 @@ DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) SSL_ctrl(s, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) -__owur BIO_METHOD *BIO_f_ssl(void); +__owur const BIO_METHOD *BIO_f_ssl(void); __owur BIO *BIO_new_ssl(SSL_CTX *ctx, int client); __owur BIO *BIO_new_ssl_connect(SSL_CTX *ctx); __owur BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); diff --git a/ssl/bio_ssl.c b/ssl/bio_ssl.c index c433cf5073..c3afc57f5f 100644 --- a/ssl/bio_ssl.c +++ b/ssl/bio_ssl.c @@ -81,7 +81,7 @@ typedef struct bio_ssl_st { unsigned long last_time; } BIO_SSL; -static BIO_METHOD methods_sslp = { +static const BIO_METHOD methods_sslp = { BIO_TYPE_SSL, "ssl", ssl_write, ssl_read, @@ -93,7 +93,7 @@ static BIO_METHOD methods_sslp = { ssl_callback_ctrl, }; -BIO_METHOD *BIO_f_ssl(void) +const BIO_METHOD *BIO_f_ssl(void) { return (&methods_sslp); }