From 82267b005082127062ce8593ce4963d09c361e2e Mon Sep 17 00:00:00 2001 From: tb <> Date: Tue, 1 May 2018 13:29:10 +0000 Subject: const for BIO_{new,set}() and most of the BIO_{f,s}_*() family of functions. ok beck, jsing --- src/lib/libcrypto/asn1/asn1.h | 4 ++-- src/lib/libcrypto/asn1/bio_asn1.c | 6 +++--- src/lib/libcrypto/bio/bf_buff.c | 6 +++--- src/lib/libcrypto/bio/bf_nbio.c | 6 +++--- src/lib/libcrypto/bio/bf_null.c | 6 +++--- src/lib/libcrypto/bio/bio.h | 28 ++++++++++++++-------------- src/lib/libcrypto/bio/bio_lib.c | 6 +++--- src/lib/libcrypto/bio/bss_acpt.c | 6 +++--- src/lib/libcrypto/bio/bss_bio.c | 6 +++--- src/lib/libcrypto/bio/bss_conn.c | 6 +++--- src/lib/libcrypto/bio/bss_fd.c | 6 +++--- src/lib/libcrypto/bio/bss_log.c | 6 +++--- src/lib/libcrypto/bio/bss_null.c | 6 +++--- src/lib/libcrypto/bio/bss_sock.c | 6 +++--- 14 files changed, 52 insertions(+), 52 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h index 80923ad6e4..b1bf40dc63 100644 --- a/src/lib/libcrypto/asn1/asn1.h +++ b/src/lib/libcrypto/asn1/asn1.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1.h,v 1.47 2018/04/25 12:07:40 tb Exp $ */ +/* $OpenBSD: asn1.h,v 1.48 2018/05/01 13:29:09 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1187,7 +1187,7 @@ void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags); unsigned long ASN1_PCTX_get_str_flags(const ASN1_PCTX *p); void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags); -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/src/lib/libcrypto/asn1/bio_asn1.c b/src/lib/libcrypto/asn1/bio_asn1.c index 02ad310639..93bcb33888 100644 --- a/src/lib/libcrypto/asn1/bio_asn1.c +++ b/src/lib/libcrypto/asn1/bio_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_asn1.c,v 1.12 2015/12/23 01:46:33 mmcc Exp $ */ +/* $OpenBSD: bio_asn1.c,v 1.13 2018/05/01 13:29:09 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -125,7 +125,7 @@ static int asn1_bio_setup_ex(BIO *b, BIO_ASN1_BUF_CTX *ctx, asn1_ps_func *setup, asn1_bio_state_t ex_state, asn1_bio_state_t other_state); -static BIO_METHOD methods_asn1 = { +static const BIO_METHOD methods_asn1 = { .type = BIO_TYPE_ASN1, .name = "asn1", .bwrite = asn1_bio_write, @@ -138,7 +138,7 @@ static BIO_METHOD methods_asn1 = { .callback_ctrl = asn1_bio_callback_ctrl }; -BIO_METHOD * +const BIO_METHOD * BIO_f_asn1(void) { return (&methods_asn1); diff --git a/src/lib/libcrypto/bio/bf_buff.c b/src/lib/libcrypto/bio/bf_buff.c index 30765b03ca..5b9ee35da8 100644 --- a/src/lib/libcrypto/bio/bf_buff.c +++ b/src/lib/libcrypto/bio/bf_buff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bf_buff.c,v 1.24 2017/01/29 17:49:22 beck Exp $ */ +/* $OpenBSD: bf_buff.c,v 1.25 2018/05/01 13:29:09 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -73,7 +73,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 = { .type = BIO_TYPE_BUFFER, .name = "buffer", .bwrite = buffer_write, @@ -86,7 +86,7 @@ static BIO_METHOD methods_buffer = { .callback_ctrl = buffer_callback_ctrl }; -BIO_METHOD * +const BIO_METHOD * BIO_f_buffer(void) { return (&methods_buffer); diff --git a/src/lib/libcrypto/bio/bf_nbio.c b/src/lib/libcrypto/bio/bf_nbio.c index 24e2e7e8b9..05fa9161fb 100644 --- a/src/lib/libcrypto/bio/bf_nbio.c +++ b/src/lib/libcrypto/bio/bf_nbio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bf_nbio.c,v 1.19 2015/02/07 13:19:15 doug Exp $ */ +/* $OpenBSD: bf_nbio.c,v 1.20 2018/05/01 13:29:09 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -80,7 +80,7 @@ typedef struct nbio_test_st { int lwn; } NBIO_TEST; -static BIO_METHOD methods_nbiof = { +static const BIO_METHOD methods_nbiof = { .type = BIO_TYPE_NBIO_TEST, .name = "non-blocking IO test filter", .bwrite = nbiof_write, @@ -93,7 +93,7 @@ static BIO_METHOD methods_nbiof = { .callback_ctrl = nbiof_callback_ctrl }; -BIO_METHOD * +const BIO_METHOD * BIO_f_nbio_test(void) { return (&methods_nbiof); diff --git a/src/lib/libcrypto/bio/bf_null.c b/src/lib/libcrypto/bio/bf_null.c index 09d54b6b21..25abb8a574 100644 --- a/src/lib/libcrypto/bio/bf_null.c +++ b/src/lib/libcrypto/bio/bf_null.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bf_null.c,v 1.11 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: bf_null.c,v 1.12 2018/05/01 13:29:09 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -73,7 +73,7 @@ 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 = { .type = BIO_TYPE_NULL_FILTER, .name = "NULL filter", .bwrite = nullf_write, @@ -86,7 +86,7 @@ static BIO_METHOD methods_nullf = { .callback_ctrl = nullf_callback_ctrl }; -BIO_METHOD * +const BIO_METHOD * BIO_f_null(void) { return (&methods_nullf); diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index d0e2f3550c..8a473ca20a 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bio.h,v 1.40 2018/03/17 15:05:55 tb Exp $ */ +/* $OpenBSD: bio.h,v 1.41 2018/05/01 13:29:09 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -286,7 +286,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 */ @@ -601,8 +601,8 @@ BIO_METHOD *BIO_s_file(void ); BIO *BIO_new_file(const char *filename, const char *mode); BIO *BIO_new_fp(FILE *stream, int close_flag); # define BIO_s_file_internal BIO_s_file -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); int BIO_up_ref(BIO *bio); void *BIO_get_data(BIO *a); @@ -643,16 +643,16 @@ long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, BIO_METHOD *BIO_s_mem(void); BIO *BIO_new_mem_buf(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); -BIO_METHOD *BIO_f_nbio_test(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); +const BIO_METHOD *BIO_f_nbio_test(void); #ifndef OPENSSL_NO_DGRAM BIO_METHOD *BIO_s_datagram(void); #endif diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index ddab542881..de039a7f5d 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_lib.c,v 1.27 2018/02/22 16:38:43 jsing Exp $ */ +/* $OpenBSD: bio_lib.c,v 1.28 2018/05/01 13:29:09 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -79,7 +79,7 @@ BIO_get_new_index(void) } BIO * -BIO_new(BIO_METHOD *method) +BIO_new(const BIO_METHOD *method) { BIO *ret = NULL; @@ -96,7 +96,7 @@ BIO_new(BIO_METHOD *method) } int -BIO_set(BIO *bio, BIO_METHOD *method) +BIO_set(BIO *bio, const BIO_METHOD *method) { bio->method = method; bio->callback = NULL; diff --git a/src/lib/libcrypto/bio/bss_acpt.c b/src/lib/libcrypto/bio/bss_acpt.c index 20508a7d5e..b270199da1 100644 --- a/src/lib/libcrypto/bio/bss_acpt.c +++ b/src/lib/libcrypto/bio/bss_acpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_acpt.c,v 1.27 2017/01/29 17:49:22 beck Exp $ */ +/* $OpenBSD: bss_acpt.c,v 1.28 2018/05/01 13:29:09 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -100,7 +100,7 @@ static void BIO_ACCEPT_free(BIO_ACCEPT *a); #define ACPT_S_GET_ACCEPT_SOCKET 2 #define ACPT_S_OK 3 -static BIO_METHOD methods_acceptp = { +static const BIO_METHOD methods_acceptp = { .type = BIO_TYPE_ACCEPT, .name = "socket accept", .bwrite = acpt_write, @@ -111,7 +111,7 @@ static BIO_METHOD methods_acceptp = { .destroy = acpt_free }; -BIO_METHOD * +const BIO_METHOD * BIO_s_accept(void) { return (&methods_acceptp); diff --git a/src/lib/libcrypto/bio/bss_bio.c b/src/lib/libcrypto/bio/bss_bio.c index 20eb9a9829..74f86a51ee 100644 --- a/src/lib/libcrypto/bio/bss_bio.c +++ b/src/lib/libcrypto/bio/bss_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_bio.c,v 1.23 2017/01/29 17:49:22 beck Exp $ */ +/* $OpenBSD: bss_bio.c,v 1.24 2018/05/01 13:29:09 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. * @@ -94,7 +94,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 = { .type = BIO_TYPE_BIO, .name = "BIO pair", .bwrite = bio_write, @@ -105,7 +105,7 @@ static BIO_METHOD methods_biop = { .destroy = bio_free }; -BIO_METHOD * +const BIO_METHOD * BIO_s_bio(void) { return &methods_biop; diff --git a/src/lib/libcrypto/bio/bss_conn.c b/src/lib/libcrypto/bio/bss_conn.c index 555273882c..575d163371 100644 --- a/src/lib/libcrypto/bio/bss_conn.c +++ b/src/lib/libcrypto/bio/bss_conn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_conn.c,v 1.33 2017/01/29 17:49:22 beck Exp $ */ +/* $OpenBSD: bss_conn.c,v 1.34 2018/05/01 13:29:09 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -106,7 +106,7 @@ static void conn_close_socket(BIO *data); BIO_CONNECT *BIO_CONNECT_new(void); void BIO_CONNECT_free(BIO_CONNECT *a); -static BIO_METHOD methods_connectp = { +static const BIO_METHOD methods_connectp = { .type = BIO_TYPE_CONNECT, .name = "socket connect", .bwrite = conn_write, @@ -319,7 +319,7 @@ BIO_CONNECT_free(BIO_CONNECT *a) free(a); } -BIO_METHOD * +const BIO_METHOD * BIO_s_connect(void) { return (&methods_connectp); diff --git a/src/lib/libcrypto/bio/bss_fd.c b/src/lib/libcrypto/bio/bss_fd.c index b21dbd92ed..bbe08efc4e 100644 --- a/src/lib/libcrypto/bio/bss_fd.c +++ b/src/lib/libcrypto/bio/bss_fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_fd.c,v 1.18 2015/02/12 03:54:07 jsing Exp $ */ +/* $OpenBSD: bss_fd.c,v 1.19 2018/05/01 13:29:09 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -74,7 +74,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 = { .type = BIO_TYPE_FD, .name = "file descriptor", .bwrite = fd_write, @@ -86,7 +86,7 @@ static BIO_METHOD methods_fdp = { .destroy = fd_free }; -BIO_METHOD * +const BIO_METHOD * BIO_s_fd(void) { return (&methods_fdp); diff --git a/src/lib/libcrypto/bio/bss_log.c b/src/lib/libcrypto/bio/bss_log.c index fcaa985aa0..7ef1312d79 100644 --- a/src/lib/libcrypto/bio/bss_log.c +++ b/src/lib/libcrypto/bio/bss_log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_log.c,v 1.21 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: bss_log.c,v 1.22 2018/05/01 13:29:10 tb Exp $ */ /* ==================================================================== * Copyright (c) 1999 The OpenSSL Project. All rights reserved. * @@ -81,7 +81,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 = { .type = BIO_TYPE_MEM, .name = "syslog", .bwrite = slg_write, @@ -91,7 +91,7 @@ static BIO_METHOD methods_slg = { .destroy = slg_free }; -BIO_METHOD * +const BIO_METHOD * BIO_s_log(void) { return (&methods_slg); diff --git a/src/lib/libcrypto/bio/bss_null.c b/src/lib/libcrypto/bio/bss_null.c index 42ee626b13..c6de844da5 100644 --- a/src/lib/libcrypto/bio/bss_null.c +++ b/src/lib/libcrypto/bio/bss_null.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_null.c,v 1.10 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: bss_null.c,v 1.11 2018/05/01 13:29:10 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -70,7 +70,7 @@ 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 = { .type = BIO_TYPE_NULL, .name = "NULL", .bwrite = null_write, @@ -82,7 +82,7 @@ static BIO_METHOD null_method = { .destroy = null_free }; -BIO_METHOD * +const BIO_METHOD * BIO_s_null(void) { return (&null_method); diff --git a/src/lib/libcrypto/bio/bss_sock.c b/src/lib/libcrypto/bio/bss_sock.c index dd470eb65e..9c650a8041 100644 --- a/src/lib/libcrypto/bio/bss_sock.c +++ b/src/lib/libcrypto/bio/bss_sock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_sock.c,v 1.23 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: bss_sock.c,v 1.24 2018/05/01 13:29:10 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -73,7 +73,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 = { .type = BIO_TYPE_SOCKET, .name = "socket", .bwrite = sock_write, @@ -84,7 +84,7 @@ static BIO_METHOD methods_sockp = { .destroy = sock_free }; -BIO_METHOD * +const BIO_METHOD * BIO_s_socket(void) { return (&methods_sockp); -- cgit v1.2.3-55-g6feb