diff options
author | schwarze <> | 2022-12-16 13:41:55 +0000 |
---|---|---|
committer | schwarze <> | 2022-12-16 13:41:55 +0000 |
commit | 6777ddb358a28ff896be81dbbfce1f14e0a836e0 (patch) | |
tree | c86cfa2845b8dbb2e966a35f402a8007996539e0 /src/lib/libcrypto/bio/bio_lib.c | |
parent | 4049dbe994284a40aeef67c382535608578d7ee0 (diff) | |
download | openbsd-6777ddb358a28ff896be81dbbfce1f14e0a836e0.tar.gz openbsd-6777ddb358a28ff896be81dbbfce1f14e0a836e0.tar.bz2 openbsd-6777ddb358a28ff896be81dbbfce1f14e0a836e0.zip |
Revert BIO_push(3) cycle prevention (bio_lib.c rev. 1.42).
jsing@ worries that cycle prevention might increase risk because
software that is not checking return values (and indeed, not checking
is likely common in practice) might silently behave incorrectly
with cycle prevention whereas without, it will likely either crash
right away through infinite recursion or at least hang in an infinite
loop when trying to use the cyclic chain, in both cases making it
likely that the bug will be found and fixed.
Besides, tb@ points out that BIO_set_next(3) ought to behave as
similarly as possible to BIO_push(3), but adding cycle prevention
to BIO_set_next(3) would be even less convincing because that
function does not provide a return value, encouraging users to
expect that it will always succeed. While a safe idiom for checking
the success of BIO_set_next(3) could easily be designed, let's be
realistic: application software would be highly unlikely to pick up
such an idiom.
Diffstat (limited to 'src/lib/libcrypto/bio/bio_lib.c')
-rw-r--r-- | src/lib/libcrypto/bio/bio_lib.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index 3eb0869ca9..31b1e7305d 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.42 2022/12/07 23:08:47 schwarze Exp $ */ | 1 | /* $OpenBSD: bio_lib.c,v 1.43 2022/12/16 13:41:55 schwarze 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 | * |
@@ -637,12 +637,6 @@ BIO_push(BIO *b, BIO *bio) | |||
637 | 637 | ||
638 | if (b == NULL) | 638 | if (b == NULL) |
639 | return (bio); | 639 | return (bio); |
640 | |||
641 | /* If this would create a cycle, change nothing and fail. */ | ||
642 | for (lb = bio; lb != NULL; lb = lb->next_bio) | ||
643 | if (lb == b) | ||
644 | return NULL; | ||
645 | |||
646 | lb = b; | 640 | lb = b; |
647 | while (lb->next_bio != NULL) | 641 | while (lb->next_bio != NULL) |
648 | lb = lb->next_bio; | 642 | lb = lb->next_bio; |