From 04f6b0fd9110c85c3c0d6d1172005d1c6755ac86 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Sat, 19 Mar 2016 12:32:14 -0400 Subject: 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 --- crypto/asn1/bio_asn1.c | 4 ++-- crypto/bio/bf_buff.c | 4 ++-- crypto/bio/bf_lbuf.c | 4 ++-- crypto/bio/bf_nbio.c | 4 ++-- crypto/bio/bf_null.c | 4 ++-- crypto/bio/bio_lib.c | 4 ++-- crypto/bio/bss_acpt.c | 4 ++-- crypto/bio/bss_bio.c | 4 ++-- crypto/bio/bss_conn.c | 4 ++-- crypto/bio/bss_dgram.c | 8 ++++---- crypto/bio/bss_fd.c | 6 +++--- crypto/bio/bss_file.c | 8 ++++---- crypto/bio/bss_log.c | 4 ++-- crypto/bio/bss_mem.c | 8 ++++---- crypto/bio/bss_null.c | 4 ++-- crypto/bio/bss_sock.c | 4 ++-- crypto/comp/c_zlib.c | 4 ++-- crypto/evp/bio_b64.c | 4 ++-- crypto/evp/bio_enc.c | 4 ++-- crypto/evp/bio_md.c | 4 ++-- crypto/evp/bio_ok.c | 4 ++-- 21 files changed, 49 insertions(+), 49 deletions(-) (limited to 'crypto') 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); } -- cgit v1.2.3