summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorschwarze <>2022-12-16 16:02:17 +0000
committerschwarze <>2022-12-16 16:02:17 +0000
commite3c1dbeb9eb2028277ed68307ae16673ebabae9b (patch)
tree1fe8a51ed4d1b78123a65034706668fb9e62e816 /src/lib
parent6777ddb358a28ff896be81dbbfce1f14e0a836e0 (diff)
downloadopenbsd-e3c1dbeb9eb2028277ed68307ae16673ebabae9b.tar.gz
openbsd-e3c1dbeb9eb2028277ed68307ae16673ebabae9b.tar.bz2
openbsd-e3c1dbeb9eb2028277ed68307ae16673ebabae9b.zip
add a CAVEATS section warning the user to not create cycles;
OK tb@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/man/BIO_push.335
1 files changed, 34 insertions, 1 deletions
diff --git a/src/lib/libcrypto/man/BIO_push.3 b/src/lib/libcrypto/man/BIO_push.3
index 413f8249a6..46c736e2c2 100644
--- a/src/lib/libcrypto/man/BIO_push.3
+++ b/src/lib/libcrypto/man/BIO_push.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_push.3,v 1.13 2022/12/16 13:41:55 schwarze Exp $ 1.\" $OpenBSD: BIO_push.3,v 1.14 2022/12/16 16:02:17 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL doc/man3/BIO_push.pod 791bfd91 Nov 19 20:38:27 2021 +0100 3.\" OpenSSL doc/man3/BIO_push.pod 791bfd91 Nov 19 20:38:27 2021 +0100
4.\" OpenSSL doc/man7/bio.pod 1cb7eff4 Sep 10 13:56:40 2019 +0100 4.\" OpenSSL doc/man7/bio.pod 1cb7eff4 Sep 10 13:56:40 2019 +0100
@@ -300,3 +300,36 @@ Both functions have been available since
300first appeared in OpenSSL 1.1.0 300first appeared in OpenSSL 1.1.0
301and has been available since 301and has been available since
302.Ox 7.1 . 302.Ox 7.1 .
303.Sh CAVEATS
304Creating a cyclic chain results in undefined behavior.
305For example, infinite recursion or infinite loops may ensue.
306.Pp
307If it is unknown whether
308.Fa b
309and
310.Fa new_tail
311are already members of the same chain and whether joining them would
312create a cycle, the calling code can use the following safe idiom:
313.Bd -literal -offset indent
314BIO *btest;
315
316for (btest = new_tail; btest != NULL; btest = BIO_next(btest))
317 if (btest == b)
318 /* Bail out because this would create a cycle. */
319BIO_push(b, new_tail); /* This is now safe. */
320.Ed
321.Pp
322The same idiom can be used with
323.Fn BIO_set_next
324instead of
325.Fn BIO_push .
326.Pp
327Often, the safe idiom is not needed because it is already known that
328.Fa b
329and
330.Fa new_tail
331are not members of the same chain, for example when
332.Fa b
333or
334.Fa new_tail
335was created right before.