diff options
Diffstat (limited to 'src/lib/libcrypto/bio')
-rw-r--r-- | src/lib/libcrypto/bio/b_dump.c | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/b_sock.c | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bf_buff.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio.h | 27 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio_cb.c | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bio_lib.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_acpt.c | 13 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_bio.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_conn.c | 6 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_file.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_log.c | 216 | ||||
-rw-r--r-- | src/lib/libcrypto/bio/bss_mem.c | 11 |
12 files changed, 45 insertions, 255 deletions
diff --git a/src/lib/libcrypto/bio/b_dump.c b/src/lib/libcrypto/bio/b_dump.c index 4dcf710bbe..3f673205c1 100644 --- a/src/lib/libcrypto/bio/b_dump.c +++ b/src/lib/libcrypto/bio/b_dump.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: b_dump.c,v 1.30 2024/03/02 09:21:24 tb Exp $ */ | 1 | /* $OpenBSD: b_dump.c,v 1.31 2025/05/10 05:54:38 tb Exp $ */ |
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 | * |
@@ -62,7 +62,6 @@ | |||
62 | #include <string.h> | 62 | #include <string.h> |
63 | 63 | ||
64 | #include <openssl/bio.h> | 64 | #include <openssl/bio.h> |
65 | #include <openssl/err.h> | ||
66 | 65 | ||
67 | #include "bytestring.h" | 66 | #include "bytestring.h" |
68 | 67 | ||
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index 00bbe9c37e..9ef9953b95 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: b_sock.c,v 1.71 2023/07/05 21:23:37 beck Exp $ */ | 1 | /* $OpenBSD: b_sock.c,v 1.72 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2017 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2017 Bob Beck <beck@openbsd.org> |
4 | * | 4 | * |
@@ -32,7 +32,8 @@ | |||
32 | 32 | ||
33 | #include <openssl/bio.h> | 33 | #include <openssl/bio.h> |
34 | #include <openssl/buffer.h> | 34 | #include <openssl/buffer.h> |
35 | #include <openssl/err.h> | 35 | |
36 | #include "err_local.h" | ||
36 | 37 | ||
37 | int | 38 | int |
38 | BIO_get_host_ip(const char *str, unsigned char *ip) | 39 | BIO_get_host_ip(const char *str, unsigned char *ip) |
diff --git a/src/lib/libcrypto/bio/bf_buff.c b/src/lib/libcrypto/bio/bf_buff.c index 226c16835a..36b6fabde3 100644 --- a/src/lib/libcrypto/bio/bf_buff.c +++ b/src/lib/libcrypto/bio/bf_buff.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bf_buff.c,v 1.28 2023/07/05 21:23:37 beck Exp $ */ | 1 | /* $OpenBSD: bf_buff.c,v 1.29 2025/05/10 05:54:38 tb Exp $ */ |
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 | * |
@@ -61,9 +61,9 @@ | |||
61 | #include <string.h> | 61 | #include <string.h> |
62 | 62 | ||
63 | #include <openssl/bio.h> | 63 | #include <openssl/bio.h> |
64 | #include <openssl/err.h> | ||
65 | 64 | ||
66 | #include "bio_local.h" | 65 | #include "bio_local.h" |
66 | #include "err_local.h" | ||
67 | 67 | ||
68 | static int buffer_write(BIO *h, const char *buf, int num); | 68 | static int buffer_write(BIO *h, const char *buf, int num); |
69 | static int buffer_read(BIO *h, char *buf, int size); | 69 | static int buffer_read(BIO *h, char *buf, int size); |
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index 8327ffc071..a8108054e7 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: bio.h,v 1.64 2024/05/19 07:12:50 jsg Exp $ */ | 1 | /* $OpenBSD: bio.h,v 1.65 2025/07/16 18:12:54 tb Exp $ */ |
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 |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -96,8 +96,8 @@ extern "C" { | |||
96 | #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ | 96 | #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */ |
97 | #define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ | 97 | #define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */ |
98 | #define BIO_TYPE_DGRAM (21|0x0400|0x0100) | 98 | #define BIO_TYPE_DGRAM (21|0x0400|0x0100) |
99 | #define BIO_TYPE_ASN1 (22|0x0200) /* filter */ | 99 | #define BIO_TYPE_ASN1 (22|0x0200) /* filter */ |
100 | #define BIO_TYPE_COMP (23|0x0200) /* filter */ | 100 | #define BIO_TYPE_COMP (23|0x0200) /* filter */ |
101 | 101 | ||
102 | #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ | 102 | #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ |
103 | #define BIO_TYPE_FILTER 0x0200 | 103 | #define BIO_TYPE_FILTER 0x0200 |
@@ -139,14 +139,14 @@ extern "C" { | |||
139 | #define BIO_CTRL_DGRAM_CONNECT 31 /* BIO dgram special */ | 139 | #define BIO_CTRL_DGRAM_CONNECT 31 /* BIO dgram special */ |
140 | #define BIO_CTRL_DGRAM_SET_CONNECTED 32 /* allow for an externally | 140 | #define BIO_CTRL_DGRAM_SET_CONNECTED 32 /* allow for an externally |
141 | * connected socket to be | 141 | * connected socket to be |
142 | * passed in */ | 142 | * passed in */ |
143 | #define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */ | 143 | #define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */ |
144 | #define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */ | 144 | #define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */ |
145 | #define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */ | 145 | #define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */ |
146 | #define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */ | 146 | #define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */ |
147 | 147 | ||
148 | #define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */ | 148 | #define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */ |
149 | #define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation tiemd out */ | 149 | #define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation timed out */ |
150 | 150 | ||
151 | /* #ifdef IP_MTU_DISCOVER */ | 151 | /* #ifdef IP_MTU_DISCOVER */ |
152 | #define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */ | 152 | #define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */ |
@@ -232,7 +232,7 @@ void BIO_clear_flags(BIO *b, int flags); | |||
232 | 232 | ||
233 | /* The next three are used in conjunction with the | 233 | /* The next three are used in conjunction with the |
234 | * BIO_should_io_special() condition. After this returns true, | 234 | * BIO_should_io_special() condition. After this returns true, |
235 | * BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO | 235 | * BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO |
236 | * stack and return the 'reason' for the special and the offending BIO. | 236 | * stack and return the 'reason' for the special and the offending BIO. |
237 | * Given a BIO, BIO_get_retry_reason(bio) will return the code. */ | 237 | * Given a BIO, BIO_get_retry_reason(bio) will return the code. */ |
238 | /* Returned from the SSL bio when the certificate retrieval code had an error */ | 238 | /* Returned from the SSL bio when the certificate retrieval code had an error */ |
@@ -380,7 +380,7 @@ int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, | |||
380 | #define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port) | 380 | #define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port) |
381 | #define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) | 381 | #define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) |
382 | #define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) | 382 | #define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) |
383 | #define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) | 383 | #define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2) |
384 | #define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0) | 384 | #define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0) |
385 | 385 | ||
386 | 386 | ||
@@ -571,7 +571,6 @@ const BIO_METHOD *BIO_s_socket(void); | |||
571 | const BIO_METHOD *BIO_s_connect(void); | 571 | const BIO_METHOD *BIO_s_connect(void); |
572 | const BIO_METHOD *BIO_s_accept(void); | 572 | const BIO_METHOD *BIO_s_accept(void); |
573 | const BIO_METHOD *BIO_s_fd(void); | 573 | const BIO_METHOD *BIO_s_fd(void); |
574 | const BIO_METHOD *BIO_s_log(void); | ||
575 | const BIO_METHOD *BIO_s_bio(void); | 574 | const BIO_METHOD *BIO_s_bio(void); |
576 | const BIO_METHOD *BIO_s_null(void); | 575 | const BIO_METHOD *BIO_s_null(void); |
577 | const BIO_METHOD *BIO_f_null(void); | 576 | const BIO_METHOD *BIO_f_null(void); |
diff --git a/src/lib/libcrypto/bio/bio_cb.c b/src/lib/libcrypto/bio/bio_cb.c index 18e9be8d68..990cb20708 100644 --- a/src/lib/libcrypto/bio/bio_cb.c +++ b/src/lib/libcrypto/bio/bio_cb.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_cb.c,v 1.19 2023/07/05 21:23:37 beck Exp $ */ | 1 | /* $OpenBSD: bio_cb.c,v 1.20 2025/05/10 05:54:38 tb Exp $ */ |
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 | * |
@@ -60,7 +60,6 @@ | |||
60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
61 | #include <string.h> | 61 | #include <string.h> |
62 | 62 | ||
63 | #include <openssl/err.h> | ||
64 | #include <openssl/bio.h> | 63 | #include <openssl/bio.h> |
65 | 64 | ||
66 | #include "bio_local.h" | 65 | #include "bio_local.h" |
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index 463d2ad23a..04e8f4c295 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_lib.c,v 1.54 2024/07/09 06:14:59 beck Exp $ */ | 1 | /* $OpenBSD: bio_lib.c,v 1.55 2025/05/10 05:54:38 tb Exp $ */ |
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 | * |
@@ -62,10 +62,10 @@ | |||
62 | 62 | ||
63 | #include <openssl/bio.h> | 63 | #include <openssl/bio.h> |
64 | #include <openssl/crypto.h> | 64 | #include <openssl/crypto.h> |
65 | #include <openssl/err.h> | ||
66 | #include <openssl/stack.h> | 65 | #include <openssl/stack.h> |
67 | 66 | ||
68 | #include "bio_local.h" | 67 | #include "bio_local.h" |
68 | #include "err_local.h" | ||
69 | 69 | ||
70 | /* | 70 | /* |
71 | * Helper function to work out whether to call the new style callback or the old | 71 | * Helper function to work out whether to call the new style callback or the old |
diff --git a/src/lib/libcrypto/bio/bss_acpt.c b/src/lib/libcrypto/bio/bss_acpt.c index d74c710a7f..60e61100b1 100644 --- a/src/lib/libcrypto/bio/bss_acpt.c +++ b/src/lib/libcrypto/bio/bss_acpt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bss_acpt.c,v 1.31 2023/07/05 21:23:37 beck Exp $ */ | 1 | /* $OpenBSD: bss_acpt.c,v 1.33 2025/06/02 12:18:21 jsg Exp $ */ |
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 | * |
@@ -65,9 +65,9 @@ | |||
65 | 65 | ||
66 | #include <openssl/bio.h> | 66 | #include <openssl/bio.h> |
67 | #include <openssl/buffer.h> | 67 | #include <openssl/buffer.h> |
68 | #include <openssl/err.h> | ||
69 | 68 | ||
70 | #include "bio_local.h" | 69 | #include "bio_local.h" |
70 | #include "err_local.h" | ||
71 | 71 | ||
72 | #define SOCKET_PROTOCOL IPPROTO_TCP | 72 | #define SOCKET_PROTOCOL IPPROTO_TCP |
73 | 73 | ||
@@ -261,11 +261,12 @@ again: | |||
261 | if (c->bio_chain != NULL) { | 261 | if (c->bio_chain != NULL) { |
262 | if ((dbio = BIO_dup_chain(c->bio_chain)) == NULL) | 262 | if ((dbio = BIO_dup_chain(c->bio_chain)) == NULL) |
263 | goto err; | 263 | goto err; |
264 | if (!BIO_push(dbio, bio)) goto err; | 264 | if (!BIO_push(dbio, bio)) |
265 | bio = dbio; | 265 | goto err; |
266 | bio = dbio; | ||
266 | } | 267 | } |
267 | if (BIO_push(b, bio) | 268 | if (BIO_push(b, bio) == NULL) |
268 | == NULL) goto err; | 269 | goto err; |
269 | 270 | ||
270 | c->state = ACPT_S_OK; | 271 | c->state = ACPT_S_OK; |
271 | return (1); | 272 | return (1); |
diff --git a/src/lib/libcrypto/bio/bss_bio.c b/src/lib/libcrypto/bio/bss_bio.c index 39d8d1e46c..f1d1bbeecd 100644 --- a/src/lib/libcrypto/bio/bss_bio.c +++ b/src/lib/libcrypto/bio/bss_bio.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bss_bio.c,v 1.29 2024/07/09 06:14:59 beck Exp $ */ | 1 | /* $OpenBSD: bss_bio.c,v 1.30 2025/05/10 05:54:38 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -81,10 +81,10 @@ | |||
81 | #include <sys/types.h> | 81 | #include <sys/types.h> |
82 | 82 | ||
83 | #include <openssl/bio.h> | 83 | #include <openssl/bio.h> |
84 | #include <openssl/err.h> | ||
85 | #include <openssl/crypto.h> | 84 | #include <openssl/crypto.h> |
86 | 85 | ||
87 | #include "bio_local.h" | 86 | #include "bio_local.h" |
87 | #include "err_local.h" | ||
88 | 88 | ||
89 | static int bio_new(BIO *bio); | 89 | static int bio_new(BIO *bio); |
90 | static int bio_free(BIO *bio); | 90 | static int bio_free(BIO *bio); |
diff --git a/src/lib/libcrypto/bio/bss_conn.c b/src/lib/libcrypto/bio/bss_conn.c index 3b0e3d3bdd..14f410f59d 100644 --- a/src/lib/libcrypto/bio/bss_conn.c +++ b/src/lib/libcrypto/bio/bss_conn.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bss_conn.c,v 1.41 2024/04/19 09:54:36 tb Exp $ */ | 1 | /* $OpenBSD: bss_conn.c,v 1.43 2025/06/02 12:18:21 jsg Exp $ */ |
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 | * |
@@ -68,9 +68,9 @@ | |||
68 | 68 | ||
69 | #include <openssl/bio.h> | 69 | #include <openssl/bio.h> |
70 | #include <openssl/buffer.h> | 70 | #include <openssl/buffer.h> |
71 | #include <openssl/err.h> | ||
72 | 71 | ||
73 | #include "bio_local.h" | 72 | #include "bio_local.h" |
73 | #include "err_local.h" | ||
74 | 74 | ||
75 | #define SOCKET_PROTOCOL IPPROTO_TCP | 75 | #define SOCKET_PROTOCOL IPPROTO_TCP |
76 | 76 | ||
@@ -141,7 +141,7 @@ conn_state(BIO *b, BIO_CONNECT *c) | |||
141 | } | 141 | } |
142 | for (; *p != '\0'; p++) { | 142 | for (; *p != '\0'; p++) { |
143 | if ((*p == ':') || (*p == '/')) | 143 | if ((*p == ':') || (*p == '/')) |
144 | break; | 144 | break; |
145 | } | 145 | } |
146 | 146 | ||
147 | i= *p; | 147 | i= *p; |
diff --git a/src/lib/libcrypto/bio/bss_file.c b/src/lib/libcrypto/bio/bss_file.c index 9b6ca2bdd8..21f71718bb 100644 --- a/src/lib/libcrypto/bio/bss_file.c +++ b/src/lib/libcrypto/bio/bss_file.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bss_file.c,v 1.35 2023/07/05 21:23:37 beck Exp $ */ | 1 | /* $OpenBSD: bss_file.c,v 1.36 2025/05/10 05:54:38 tb Exp $ */ |
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 | * |
@@ -88,9 +88,9 @@ | |||
88 | #include <string.h> | 88 | #include <string.h> |
89 | 89 | ||
90 | #include <openssl/bio.h> | 90 | #include <openssl/bio.h> |
91 | #include <openssl/err.h> | ||
92 | 91 | ||
93 | #include "bio_local.h" | 92 | #include "bio_local.h" |
93 | #include "err_local.h" | ||
94 | 94 | ||
95 | static int file_write(BIO *h, const char *buf, int num); | 95 | static int file_write(BIO *h, const char *buf, int num); |
96 | static int file_read(BIO *h, char *buf, int size); | 96 | static int file_read(BIO *h, char *buf, int size); |
diff --git a/src/lib/libcrypto/bio/bss_log.c b/src/lib/libcrypto/bio/bss_log.c deleted file mode 100644 index 9e2e882646..0000000000 --- a/src/lib/libcrypto/bio/bss_log.c +++ /dev/null | |||
@@ -1,216 +0,0 @@ | |||
1 | /* $OpenBSD: bss_log.c,v 1.24 2023/07/05 21:23:37 beck Exp $ */ | ||
2 | /* ==================================================================== | ||
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * | ||
9 | * 1. Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in | ||
14 | * the documentation and/or other materials provided with the | ||
15 | * distribution. | ||
16 | * | ||
17 | * 3. All advertising materials mentioning features or use of this | ||
18 | * software must display the following acknowledgment: | ||
19 | * "This product includes software developed by the OpenSSL Project | ||
20 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
21 | * | ||
22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
23 | * endorse or promote products derived from this software without | ||
24 | * prior written permission. For written permission, please contact | ||
25 | * licensing@OpenSSL.org. | ||
26 | * | ||
27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
28 | * nor may "OpenSSL" appear in their names without prior written | ||
29 | * permission of the OpenSSL Project. | ||
30 | * | ||
31 | * 6. Redistributions of any form whatsoever must retain the following | ||
32 | * acknowledgment: | ||
33 | * "This product includes software developed by the OpenSSL Project | ||
34 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
35 | * | ||
36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
48 | * ==================================================================== | ||
49 | * | ||
50 | * This product includes cryptographic software written by Eric Young | ||
51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
52 | * Hudson (tjh@cryptsoft.com). | ||
53 | * | ||
54 | */ | ||
55 | |||
56 | /* | ||
57 | Why BIO_s_log? | ||
58 | |||
59 | BIO_s_log is useful for system daemons (or services under NT). | ||
60 | It is one-way BIO, it sends all stuff to syslogd (on system that | ||
61 | commonly use that), or event log (on NT), or OPCOM (on OpenVMS). | ||
62 | |||
63 | */ | ||
64 | |||
65 | #include <errno.h> | ||
66 | #include <stdio.h> | ||
67 | #include <string.h> | ||
68 | #include <syslog.h> | ||
69 | |||
70 | #include <openssl/buffer.h> | ||
71 | #include <openssl/err.h> | ||
72 | |||
73 | #include "bio_local.h" | ||
74 | |||
75 | #ifndef NO_SYSLOG | ||
76 | |||
77 | static int slg_write(BIO *h, const char *buf, int num); | ||
78 | static int slg_puts(BIO *h, const char *str); | ||
79 | static long slg_ctrl(BIO *h, int cmd, long arg1, void *arg2); | ||
80 | static int slg_new(BIO *h); | ||
81 | static int slg_free(BIO *data); | ||
82 | static void xopenlog(BIO* bp, char* name, int level); | ||
83 | static void xsyslog(BIO* bp, int priority, const char* string); | ||
84 | static void xcloselog(BIO* bp); | ||
85 | |||
86 | static const BIO_METHOD methods_slg = { | ||
87 | .type = BIO_TYPE_MEM, | ||
88 | .name = "syslog", | ||
89 | .bwrite = slg_write, | ||
90 | .bputs = slg_puts, | ||
91 | .ctrl = slg_ctrl, | ||
92 | .create = slg_new, | ||
93 | .destroy = slg_free | ||
94 | }; | ||
95 | |||
96 | const BIO_METHOD * | ||
97 | BIO_s_log(void) | ||
98 | { | ||
99 | return (&methods_slg); | ||
100 | } | ||
101 | LCRYPTO_ALIAS(BIO_s_log); | ||
102 | |||
103 | static int | ||
104 | slg_new(BIO *bi) | ||
105 | { | ||
106 | bi->init = 1; | ||
107 | bi->num = 0; | ||
108 | bi->ptr = NULL; | ||
109 | xopenlog(bi, "application", LOG_DAEMON); | ||
110 | return (1); | ||
111 | } | ||
112 | |||
113 | static int | ||
114 | slg_free(BIO *a) | ||
115 | { | ||
116 | if (a == NULL) | ||
117 | return (0); | ||
118 | xcloselog(a); | ||
119 | return (1); | ||
120 | } | ||
121 | |||
122 | static int | ||
123 | slg_write(BIO *b, const char *in, int inl) | ||
124 | { | ||
125 | int ret = inl; | ||
126 | char* buf; | ||
127 | char* pp; | ||
128 | int priority, i; | ||
129 | static const struct { | ||
130 | int strl; | ||
131 | char str[10]; | ||
132 | int log_level; | ||
133 | } | ||
134 | mapping[] = { | ||
135 | { 6, "PANIC ", LOG_EMERG }, | ||
136 | { 6, "EMERG ", LOG_EMERG }, | ||
137 | { 4, "EMR ", LOG_EMERG }, | ||
138 | { 6, "ALERT ", LOG_ALERT }, | ||
139 | { 4, "ALR ", LOG_ALERT }, | ||
140 | { 5, "CRIT ", LOG_CRIT }, | ||
141 | { 4, "CRI ", LOG_CRIT }, | ||
142 | { 6, "ERROR ", LOG_ERR }, | ||
143 | { 4, "ERR ", LOG_ERR }, | ||
144 | { 8, "WARNING ", LOG_WARNING }, | ||
145 | { 5, "WARN ", LOG_WARNING }, | ||
146 | { 4, "WAR ", LOG_WARNING }, | ||
147 | { 7, "NOTICE ", LOG_NOTICE }, | ||
148 | { 5, "NOTE ", LOG_NOTICE }, | ||
149 | { 4, "NOT ", LOG_NOTICE }, | ||
150 | { 5, "INFO ", LOG_INFO }, | ||
151 | { 4, "INF ", LOG_INFO }, | ||
152 | { 6, "DEBUG ", LOG_DEBUG }, | ||
153 | { 4, "DBG ", LOG_DEBUG }, | ||
154 | { 0, "", LOG_ERR } /* The default */ | ||
155 | }; | ||
156 | |||
157 | if ((buf = malloc(inl + 1)) == NULL) { | ||
158 | return (0); | ||
159 | } | ||
160 | strlcpy(buf, in, inl + 1); | ||
161 | i = 0; | ||
162 | while (strncmp(buf, mapping[i].str, mapping[i].strl) != 0) | ||
163 | i++; | ||
164 | priority = mapping[i].log_level; | ||
165 | pp = buf + mapping[i].strl; | ||
166 | |||
167 | xsyslog(b, priority, pp); | ||
168 | |||
169 | free(buf); | ||
170 | return (ret); | ||
171 | } | ||
172 | |||
173 | static long | ||
174 | slg_ctrl(BIO *b, int cmd, long num, void *ptr) | ||
175 | { | ||
176 | switch (cmd) { | ||
177 | case BIO_CTRL_SET: | ||
178 | xcloselog(b); | ||
179 | xopenlog(b, ptr, num); | ||
180 | break; | ||
181 | default: | ||
182 | break; | ||
183 | } | ||
184 | return (0); | ||
185 | } | ||
186 | |||
187 | static int | ||
188 | slg_puts(BIO *bp, const char *str) | ||
189 | { | ||
190 | int n, ret; | ||
191 | |||
192 | n = strlen(str); | ||
193 | ret = slg_write(bp, str, n); | ||
194 | return (ret); | ||
195 | } | ||
196 | |||
197 | |||
198 | static void | ||
199 | xopenlog(BIO* bp, char* name, int level) | ||
200 | { | ||
201 | openlog(name, LOG_PID|LOG_CONS, level); | ||
202 | } | ||
203 | |||
204 | static void | ||
205 | xsyslog(BIO *bp, int priority, const char *string) | ||
206 | { | ||
207 | syslog(priority, "%s", string); | ||
208 | } | ||
209 | |||
210 | static void | ||
211 | xcloselog(BIO* bp) | ||
212 | { | ||
213 | closelog(); | ||
214 | } | ||
215 | |||
216 | #endif /* NO_SYSLOG */ | ||
diff --git a/src/lib/libcrypto/bio/bss_mem.c b/src/lib/libcrypto/bio/bss_mem.c index 6d0d54db84..0fa6317a2b 100644 --- a/src/lib/libcrypto/bio/bss_mem.c +++ b/src/lib/libcrypto/bio/bss_mem.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bss_mem.c,v 1.22 2023/07/05 21:23:37 beck Exp $ */ | 1 | /* $OpenBSD: bss_mem.c,v 1.27 2025/05/31 11:31:16 tb Exp $ */ |
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 | * |
@@ -62,10 +62,10 @@ | |||
62 | #include <string.h> | 62 | #include <string.h> |
63 | 63 | ||
64 | #include <openssl/bio.h> | 64 | #include <openssl/bio.h> |
65 | #include <openssl/err.h> | ||
66 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> |
67 | 66 | ||
68 | #include "bio_local.h" | 67 | #include "bio_local.h" |
68 | #include "err_local.h" | ||
69 | 69 | ||
70 | struct bio_mem { | 70 | struct bio_mem { |
71 | BUF_MEM *buf; | 71 | BUF_MEM *buf; |
@@ -140,6 +140,7 @@ BIO_new_mem_buf(const void *buf, int buf_len) | |||
140 | return NULL; | 140 | return NULL; |
141 | 141 | ||
142 | bm = bio->ptr; | 142 | bm = bio->ptr; |
143 | free(bm->buf->data); | ||
143 | bm->buf->data = (void *)buf; /* Trust in the BIO_FLAGS_MEM_RDONLY flag. */ | 144 | bm->buf->data = (void *)buf; /* Trust in the BIO_FLAGS_MEM_RDONLY flag. */ |
144 | bm->buf->length = buf_len; | 145 | bm->buf->length = buf_len; |
145 | bm->buf->max = buf_len; | 146 | bm->buf->max = buf_len; |
@@ -162,6 +163,12 @@ mem_new(BIO *bio) | |||
162 | free(bm); | 163 | free(bm); |
163 | return 0; | 164 | return 0; |
164 | } | 165 | } |
166 | if (BUF_MEM_grow_clean(bm->buf, 64) != 64) { | ||
167 | BUF_MEM_free(bm->buf); | ||
168 | free(bm); | ||
169 | return 0; | ||
170 | } | ||
171 | bm->buf->length = 0; | ||
165 | 172 | ||
166 | bio->shutdown = 1; | 173 | bio->shutdown = 1; |
167 | bio->init = 1; | 174 | bio->init = 1; |