diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2021-03-09 17:25:26 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2021-03-11 07:57:31 +1000 |
commit | a30823c80f8c1f4ac22fb358cab65ce4e81a5046 (patch) | |
tree | 4932e6285f6fc31b31097ce448c510d5f45530e8 /doc | |
parent | c8511e89804749e82d1212fba1dc06c86a266ee4 (diff) |
Add new filter BIO BIO_f_readbuffer()
This allows BIO_tell() and BIO_seek() to work for BIO's that do
not support these methods. The main use case for this is file/fd BIO's
that use stdin.
This works for stdin taken from input redirection (command < file),
and stdin via pipe (cat file | command).
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14407)
Diffstat (limited to 'doc')
-rw-r--r-- | doc/build.info | 6 | ||||
-rw-r--r-- | doc/man3/BIO_f_readbuffer.pod | 61 | ||||
-rw-r--r-- | doc/man7/bio.pod | 3 |
3 files changed, 69 insertions, 1 deletions
diff --git a/doc/build.info b/doc/build.info index e53b3d1007..0a13f26927 100644 --- a/doc/build.info +++ b/doc/build.info @@ -570,6 +570,10 @@ DEPEND[html/man3/BIO_f_prefix.html]=man3/BIO_f_prefix.pod GENERATE[html/man3/BIO_f_prefix.html]=man3/BIO_f_prefix.pod DEPEND[man/man3/BIO_f_prefix.3]=man3/BIO_f_prefix.pod GENERATE[man/man3/BIO_f_prefix.3]=man3/BIO_f_prefix.pod +DEPEND[html/man3/BIO_f_readbuffer.html]=man3/BIO_f_readbuffer.pod +GENERATE[html/man3/BIO_f_readbuffer.html]=man3/BIO_f_readbuffer.pod +DEPEND[man/man3/BIO_f_readbuffer.3]=man3/BIO_f_readbuffer.pod +GENERATE[man/man3/BIO_f_readbuffer.3]=man3/BIO_f_readbuffer.pod DEPEND[html/man3/BIO_f_ssl.html]=man3/BIO_f_ssl.pod GENERATE[html/man3/BIO_f_ssl.html]=man3/BIO_f_ssl.pod DEPEND[man/man3/BIO_f_ssl.3]=man3/BIO_f_ssl.pod @@ -2772,6 +2776,7 @@ html/man3/BIO_f_cipher.html \ html/man3/BIO_f_md.html \ html/man3/BIO_f_null.html \ html/man3/BIO_f_prefix.html \ +html/man3/BIO_f_readbuffer.html \ html/man3/BIO_f_ssl.html \ html/man3/BIO_find_type.html \ html/man3/BIO_get_data.html \ @@ -3342,6 +3347,7 @@ man/man3/BIO_f_cipher.3 \ man/man3/BIO_f_md.3 \ man/man3/BIO_f_null.3 \ man/man3/BIO_f_prefix.3 \ +man/man3/BIO_f_readbuffer.3 \ man/man3/BIO_f_ssl.3 \ man/man3/BIO_find_type.3 \ man/man3/BIO_get_data.3 \ diff --git a/doc/man3/BIO_f_readbuffer.pod b/doc/man3/BIO_f_readbuffer.pod new file mode 100644 index 0000000000..35e708f9ad --- /dev/null +++ b/doc/man3/BIO_f_readbuffer.pod @@ -0,0 +1,61 @@ +=pod + +=head1 NAME + +BIO_f_readbuffer +- read only buffering BIO that supports BIO_tell() and BIO_seek() + +=head1 SYNOPSIS + + #include <openssl/bio.h> + + const BIO_METHOD *BIO_f_readbuffer(void); + +=head1 DESCRIPTION + +BIO_f_readbuffer() returns the read buffering BIO method. + +This BIO filter can be inserted on top of BIO's that do not support BIO_tell() +or BIO_seek() (e.g. A file BIO that uses stdin). + +Data read from a read buffering BIO comes from an internal buffer which is +filled from the next BIO in the chain. + +BIO_gets() is supported for read buffering BIOs. +Writing data to a read buffering BIO is not supported. + +Calling BIO_reset() on a read buffering BIO does not clear any buffered data. + +=head1 NOTES + +Read buffering BIOs implement BIO_read_ex() by using BIO_read_ex() operations +on the next BIO (e.g. a file BIO) in the chain and storing the result in an +internal buffer, from which bytes are given back to the caller as appropriate +for the call. BIO_read_ex() is guaranteed to give the caller the number of bytes +it asks for, unless there's an error or end of communication is reached in the +next BIO. The internal buffer can grow to cache the entire contents of the next +BIO in the chain. BIO_seek() uses the internal buffer, so that it can only seek +into data that is already read. + +=head1 RETURN VALUES + +BIO_f_readbuffer() returns the read buffering BIO method. + +=head1 SEE ALSO + +L<bio(7)>, +L<BIO_read(3)>, +L<BIO_gets(3)>, +L<BIO_reset(3)>, +L<BIO_ctrl(3)>. + +=head1 COPYRIGHT + +Copyright 2021 The OpenSSL Project Authors. All Rights Reserved. + +Licensed under the Apache License 2.0 (the "License"). You may not use +this file except in compliance with the License. You can obtain a copy +in the file LICENSE in the source distribution or at +L<https://www.openssl.org/source/license.html>. + +=cut diff --git a/doc/man7/bio.pod b/doc/man7/bio.pod index bb23e56961..092bdde184 100644 --- a/doc/man7/bio.pod +++ b/doc/man7/bio.pod @@ -64,6 +64,7 @@ L<BIO_ctrl(3)>, L<BIO_f_base64(3)>, L<BIO_f_buffer(3)>, L<BIO_f_cipher(3)>, L<BIO_f_md(3)>, L<BIO_f_null(3)>, L<BIO_f_ssl(3)>, +L<BIO_f_readbuffer(3)>, L<BIO_find_type(3)>, L<BIO_new(3)>, L<BIO_new_bio_pair(3)>, L<BIO_push(3)>, L<BIO_read_ex(3)>, @@ -76,7 +77,7 @@ L<BIO_should_retry(3)> =head1 COPYRIGHT -Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy |