From 94b1984e8297c4fb48e7f12b2c5d5fb952257fde Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 7 Jan 2022 09:02:17 +0000 Subject: [PATCH] Add a new, mostly empty, bio_local.h and include it in the files that will need it in the upcoming bump. discussed with jsing --- lib/libcrypto/Makefile | 3 +- lib/libcrypto/asn1/bio_asn1.c | 4 ++- lib/libcrypto/bio/bf_buff.c | 4 ++- lib/libcrypto/bio/bf_nbio.c | 4 ++- lib/libcrypto/bio/bf_null.c | 4 ++- lib/libcrypto/bio/bio_cb.c | 4 ++- lib/libcrypto/bio/bio_lib.c | 4 ++- lib/libcrypto/bio/bio_local.h | 66 +++++++++++++++++++++++++++++++++++ lib/libcrypto/bio/bio_meth.c | 4 ++- lib/libcrypto/bio/bss_acpt.c | 4 ++- lib/libcrypto/bio/bss_bio.c | 4 ++- lib/libcrypto/bio/bss_conn.c | 4 ++- lib/libcrypto/bio/bss_dgram.c | 4 ++- lib/libcrypto/bio/bss_fd.c | 4 ++- lib/libcrypto/bio/bss_file.c | 4 ++- lib/libcrypto/bio/bss_log.c | 4 ++- lib/libcrypto/bio/bss_mem.c | 4 ++- lib/libcrypto/bio/bss_null.c | 4 ++- lib/libcrypto/bio/bss_sock.c | 4 ++- lib/libcrypto/err/err_prn.c | 4 ++- lib/libcrypto/evp/bio_b64.c | 3 +- lib/libcrypto/evp/bio_enc.c | 3 +- lib/libcrypto/evp/bio_md.c | 3 +- 23 files changed, 128 insertions(+), 22 deletions(-) create mode 100644 lib/libcrypto/bio/bio_local.h diff --git a/lib/libcrypto/Makefile b/lib/libcrypto/Makefile index ad5f4f5876c..c707dcc8f33 100644 --- a/lib/libcrypto/Makefile +++ b/lib/libcrypto/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.63 2021/12/25 12:21:36 jsing Exp $ +# $OpenBSD: Makefile,v 1.64 2022/01/07 09:02:17 tb Exp $ LIB= crypto LIBREBUILD=y @@ -29,6 +29,7 @@ CFLAGS+= -DOPENSSL_NO_HW_PADLOCK # XXX enable this? CFLAGS+= -I${LCRYPTO_SRC} CFLAGS+= -I${LCRYPTO_SRC}/asn1 +CFLAGS+= -I${LCRYPTO_SRC}/bio CFLAGS+= -I${LCRYPTO_SRC}/bn CFLAGS+= -I${LCRYPTO_SRC}/bytestring CFLAGS+= -I${LCRYPTO_SRC}/ec diff --git a/lib/libcrypto/asn1/bio_asn1.c b/lib/libcrypto/asn1/bio_asn1.c index 016e570480c..6bc42009f7e 100644 --- a/lib/libcrypto/asn1/bio_asn1.c +++ b/lib/libcrypto/asn1/bio_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_asn1.c,v 1.15 2021/12/25 13:17:48 jsing Exp $ */ +/* $OpenBSD: bio_asn1.c,v 1.16 2022/01/07 09:02:17 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -67,6 +67,8 @@ #include #include +#include "bio_local.h" + /* Must be large enough for biggest tag+length */ #define DEFAULT_ASN1_BUF_SIZE 20 diff --git a/lib/libcrypto/bio/bf_buff.c b/lib/libcrypto/bio/bf_buff.c index 5b9ee35da84..42414bb51a0 100644 --- a/lib/libcrypto/bio/bf_buff.c +++ b/lib/libcrypto/bio/bf_buff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bf_buff.c,v 1.25 2018/05/01 13:29:09 tb Exp $ */ +/* $OpenBSD: bf_buff.c,v 1.26 2022/01/07 09:02:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -63,6 +63,8 @@ #include #include +#include "bio_local.h" + static int buffer_write(BIO *h, const char *buf, int num); static int buffer_read(BIO *h, char *buf, int size); static int buffer_puts(BIO *h, const char *str); diff --git a/lib/libcrypto/bio/bf_nbio.c b/lib/libcrypto/bio/bf_nbio.c index 05fa9161fbb..c0a5ab2bcb3 100644 --- a/lib/libcrypto/bio/bf_nbio.c +++ b/lib/libcrypto/bio/bf_nbio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bf_nbio.c,v 1.20 2018/05/01 13:29:09 tb Exp $ */ +/* $OpenBSD: bf_nbio.c,v 1.21 2022/01/07 09:02:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -62,6 +62,8 @@ #include +#include "bio_local.h" + /* BIO_put and BIO_get both add to the digest, * BIO_gets returns the digest */ diff --git a/lib/libcrypto/bio/bf_null.c b/lib/libcrypto/bio/bf_null.c index 25abb8a5744..1a935cf26bd 100644 --- a/lib/libcrypto/bio/bf_null.c +++ b/lib/libcrypto/bio/bf_null.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bf_null.c,v 1.12 2018/05/01 13:29:09 tb Exp $ */ +/* $OpenBSD: bf_null.c,v 1.13 2022/01/07 09:02:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -61,6 +61,8 @@ #include +#include "bio_local.h" + /* BIO_put and BIO_get both add to the digest, * BIO_gets returns the digest */ diff --git a/lib/libcrypto/bio/bio_cb.c b/lib/libcrypto/bio/bio_cb.c index 52cdd24177b..2ca411cd26e 100644 --- a/lib/libcrypto/bio/bio_cb.c +++ b/lib/libcrypto/bio/bio_cb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_cb.c,v 1.17 2021/03/25 09:26:17 tb Exp $ */ +/* $OpenBSD: bio_cb.c,v 1.18 2022/01/07 09:02:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -63,6 +63,8 @@ #include #include +#include "bio_local.h" + long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, long ret) diff --git a/lib/libcrypto/bio/bio_lib.c b/lib/libcrypto/bio/bio_lib.c index f129062d6e1..59c13172964 100644 --- a/lib/libcrypto/bio/bio_lib.c +++ b/lib/libcrypto/bio/bio_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_lib.c,v 1.33 2022/01/05 20:48:44 tb Exp $ */ +/* $OpenBSD: bio_lib.c,v 1.34 2022/01/07 09:02:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -64,6 +64,8 @@ #include #include +#include "bio_local.h" + int BIO_get_new_index(void) { diff --git a/lib/libcrypto/bio/bio_local.h b/lib/libcrypto/bio/bio_local.h new file mode 100644 index 00000000000..9c2e8f48083 --- /dev/null +++ b/lib/libcrypto/bio/bio_local.h @@ -0,0 +1,66 @@ +/* $OpenBSD: bio_local.h,v 1.1 2022/01/07 09:02:17 tb Exp $ */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_BIO_LOCAL_H +#define HEADER_BIO_LOCAL_H + +__BEGIN_HIDDEN_DECLS + +__END_HIDDEN_DECLS + +#endif /* !HEADER_BIO_LOCAL_H */ diff --git a/lib/libcrypto/bio/bio_meth.c b/lib/libcrypto/bio/bio_meth.c index 4327c010b17..b9c07d5111c 100644 --- a/lib/libcrypto/bio/bio_meth.c +++ b/lib/libcrypto/bio/bio_meth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_meth.c,v 1.6 2018/06/02 04:41:12 tb Exp $ */ +/* $OpenBSD: bio_meth.c,v 1.7 2022/01/07 09:02:17 tb Exp $ */ /* * Copyright (c) 2018 Theo Buehler * @@ -19,6 +19,8 @@ #include +#include "bio_local.h" + BIO_METHOD * BIO_meth_new(int type, const char *name) { diff --git a/lib/libcrypto/bio/bss_acpt.c b/lib/libcrypto/bio/bss_acpt.c index c95ddde7bb5..a619bd7c5d2 100644 --- a/lib/libcrypto/bio/bss_acpt.c +++ b/lib/libcrypto/bio/bss_acpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_acpt.c,v 1.29 2018/05/12 18:51:59 tb Exp $ */ +/* $OpenBSD: bss_acpt.c,v 1.30 2022/01/07 09:02:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -67,6 +67,8 @@ #include #include +#include "bio_local.h" + #define SOCKET_PROTOCOL IPPROTO_TCP typedef struct bio_accept_st { diff --git a/lib/libcrypto/bio/bss_bio.c b/lib/libcrypto/bio/bss_bio.c index 74f86a51ee7..c92d35d1188 100644 --- a/lib/libcrypto/bio/bss_bio.c +++ b/lib/libcrypto/bio/bss_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_bio.c,v 1.24 2018/05/01 13:29:09 tb Exp $ */ +/* $OpenBSD: bss_bio.c,v 1.25 2022/01/07 09:02:17 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. * @@ -84,6 +84,8 @@ #include #include +#include "bio_local.h" + static int bio_new(BIO *bio); static int bio_free(BIO *bio); static int bio_read(BIO *bio, char *buf, int size); diff --git a/lib/libcrypto/bio/bss_conn.c b/lib/libcrypto/bio/bss_conn.c index 46a37b06087..8ed8d2076d6 100644 --- a/lib/libcrypto/bio/bss_conn.c +++ b/lib/libcrypto/bio/bss_conn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_conn.c,v 1.35 2018/05/12 18:51:59 tb Exp $ */ +/* $OpenBSD: bss_conn.c,v 1.36 2022/01/07 09:02:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -70,6 +70,8 @@ #include #include +#include "bio_local.h" + #define SOCKET_PROTOCOL IPPROTO_TCP typedef struct bio_connect_st { diff --git a/lib/libcrypto/bio/bss_dgram.c b/lib/libcrypto/bio/bss_dgram.c index 794b6d1b56a..fa6e2db9178 100644 --- a/lib/libcrypto/bio/bss_dgram.c +++ b/lib/libcrypto/bio/bss_dgram.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_dgram.c,v 1.42 2018/05/12 17:47:53 tb Exp $ */ +/* $OpenBSD: bss_dgram.c,v 1.43 2022/01/07 09:02:17 tb Exp $ */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. @@ -72,6 +72,8 @@ #include +#include "bio_local.h" + #ifndef OPENSSL_NO_DGRAM diff --git a/lib/libcrypto/bio/bss_fd.c b/lib/libcrypto/bio/bss_fd.c index bbe08efc4ea..7d7c4279130 100644 --- a/lib/libcrypto/bio/bss_fd.c +++ b/lib/libcrypto/bio/bss_fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_fd.c,v 1.19 2018/05/01 13:29:09 tb Exp $ */ +/* $OpenBSD: bss_fd.c,v 1.20 2022/01/07 09:02:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -65,6 +65,8 @@ #include +#include "bio_local.h" + static int fd_write(BIO *h, const char *buf, int num); static int fd_read(BIO *h, char *buf, int size); static int fd_puts(BIO *h, const char *str); diff --git a/lib/libcrypto/bio/bss_file.c b/lib/libcrypto/bio/bss_file.c index fe937388b2c..0c9b7550254 100644 --- a/lib/libcrypto/bio/bss_file.c +++ b/lib/libcrypto/bio/bss_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_file.c,v 1.33 2018/05/30 00:23:04 tb Exp $ */ +/* $OpenBSD: bss_file.c,v 1.34 2022/01/07 09:02:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -90,6 +90,8 @@ #include #include +#include "bio_local.h" + static int file_write(BIO *h, const char *buf, int num); static int file_read(BIO *h, char *buf, int size); static int file_puts(BIO *h, const char *str); diff --git a/lib/libcrypto/bio/bss_log.c b/lib/libcrypto/bio/bss_log.c index 7ef1312d79b..296c87ff898 100644 --- a/lib/libcrypto/bio/bss_log.c +++ b/lib/libcrypto/bio/bss_log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_log.c,v 1.22 2018/05/01 13:29:10 tb Exp $ */ +/* $OpenBSD: bss_log.c,v 1.23 2022/01/07 09:02:17 tb Exp $ */ /* ==================================================================== * Copyright (c) 1999 The OpenSSL Project. All rights reserved. * @@ -70,6 +70,8 @@ #include #include +#include "bio_local.h" + #ifndef NO_SYSLOG static int slg_write(BIO *h, const char *buf, int num); diff --git a/lib/libcrypto/bio/bss_mem.c b/lib/libcrypto/bio/bss_mem.c index e76e1ad2e72..3632ffed0bf 100644 --- a/lib/libcrypto/bio/bss_mem.c +++ b/lib/libcrypto/bio/bss_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_mem.c,v 1.17 2018/05/12 18:51:59 tb Exp $ */ +/* $OpenBSD: bss_mem.c,v 1.18 2022/01/07 09:02:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -64,6 +64,8 @@ #include #include +#include "bio_local.h" + static int mem_write(BIO *h, const char *buf, int num); static int mem_read(BIO *h, char *buf, int size); static int mem_puts(BIO *h, const char *str); diff --git a/lib/libcrypto/bio/bss_null.c b/lib/libcrypto/bio/bss_null.c index c6de844da5f..8a15b36b31f 100644 --- a/lib/libcrypto/bio/bss_null.c +++ b/lib/libcrypto/bio/bss_null.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_null.c,v 1.11 2018/05/01 13:29:10 tb Exp $ */ +/* $OpenBSD: bss_null.c,v 1.12 2022/01/07 09:02:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -62,6 +62,8 @@ #include +#include "bio_local.h" + static int null_write(BIO *h, const char *buf, int num); static int null_read(BIO *h, char *buf, int size); static int null_puts(BIO *h, const char *str); diff --git a/lib/libcrypto/bio/bss_sock.c b/lib/libcrypto/bio/bss_sock.c index 9c650a8041d..3b9a87fd8a8 100644 --- a/lib/libcrypto/bio/bss_sock.c +++ b/lib/libcrypto/bio/bss_sock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_sock.c,v 1.24 2018/05/01 13:29:10 tb Exp $ */ +/* $OpenBSD: bss_sock.c,v 1.25 2022/01/07 09:02:17 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -65,6 +65,8 @@ #include +#include "bio_local.h" + static int sock_write(BIO *h, const char *buf, int num); static int sock_read(BIO *h, char *buf, int size); static int sock_puts(BIO *h, const char *str); diff --git a/lib/libcrypto/err/err_prn.c b/lib/libcrypto/err/err_prn.c index 48166829d44..6b5c455f069 100644 --- a/lib/libcrypto/err/err_prn.c +++ b/lib/libcrypto/err/err_prn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err_prn.c,v 1.18 2017/02/07 15:52:33 jsing Exp $ */ +/* $OpenBSD: err_prn.c,v 1.19 2022/01/07 09:02:18 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -64,6 +64,8 @@ #include #include +#include "bio_local.h" + void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u), void *u) { diff --git a/lib/libcrypto/evp/bio_b64.c b/lib/libcrypto/evp/bio_b64.c index abe266b604c..c1ec25d9c4d 100644 --- a/lib/libcrypto/evp/bio_b64.c +++ b/lib/libcrypto/evp/bio_b64.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_b64.c,v 1.23 2021/12/12 21:30:13 tb Exp $ */ +/* $OpenBSD: bio_b64.c,v 1.24 2022/01/07 09:02:18 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -63,6 +63,7 @@ #include #include +#include "bio_local.h" #include "evp_locl.h" static int b64_write(BIO *h, const char *buf, int num); diff --git a/lib/libcrypto/evp/bio_enc.c b/lib/libcrypto/evp/bio_enc.c index de9267a0d52..6ab07e13d94 100644 --- a/lib/libcrypto/evp/bio_enc.c +++ b/lib/libcrypto/evp/bio_enc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_enc.c,v 1.24 2021/12/12 21:30:13 tb Exp $ */ +/* $OpenBSD: bio_enc.c,v 1.25 2022/01/07 09:02:18 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -63,6 +63,7 @@ #include #include +#include "bio_local.h" #include "evp_locl.h" static int enc_write(BIO *h, const char *buf, int num); diff --git a/lib/libcrypto/evp/bio_md.c b/lib/libcrypto/evp/bio_md.c index e35510c17c0..a83088a9637 100644 --- a/lib/libcrypto/evp/bio_md.c +++ b/lib/libcrypto/evp/bio_md.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_md.c,v 1.16 2021/12/12 21:30:13 tb Exp $ */ +/* $OpenBSD: bio_md.c,v 1.17 2022/01/07 09:02:18 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -62,6 +62,7 @@ #include #include +#include "bio_local.h" #include "evp_locl.h" /* BIO_put and BIO_get both add to the digest, -- 2.20.1