BIO_F_READBUFFER(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’– BIO_f_readbuffer β€” the manual, but make it make sense πŸ’–

okay so this is BIO_F_READBUFFER(3ossl), straight out of the OpenSSL lineup (yes, that OpenSSL β€” the crypto one, main character energy fr fr). Buckle up bestie, we're learning about a read-only buffering BIO that's out here supporting BIO_tell() and BIO_seek() πŸŽ€


✨ NAME ✨

BIO_f_readbuffer β€” a read only buffering BIO that supports BIO_tell() and BIO_seek() πŸ¦‹


🌸 SYNOPSIS 🌸

#include <openssl/bio.h>

const BIO_METHOD *BIO_f_readbuffer(void);

πŸ’… DESCRIPTION πŸ’…

BIO_f_readbuffer() returns the read buffering BIO method. That's it, that's the whole vibe of the function β€” it hands you the method, periodt.

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). So yeah, it's giving "glow-up for your sad little untellable BIO" ✨

Data read from a read buffering BIO comes from an internal buffer which is filled from the next BIO in the chain. Think of it like your bestie holding your iced coffee while you dig for your keys β€” the buffer's got it, you just ask πŸ’–

BIO_gets() is supported for read buffering BIOs. Writing data to a read buffering BIO is not supported β€” it's read only, no cap, don't try it πŸ™ˆ

Calling BIO_reset() on a read buffering BIO does not clear any buffered data. Yes, really. The data stays. It is not letting go 😭


πŸ”₯ 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. Very demure, very mindful of the chain 🧚

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. So basically it delivers unless the next BIO ghosts you πŸ’€

The internal buffer can grow to cache the entire contents of the next BIO in the chain. Lowkey a hoarder, highkey efficient πŸ‘‘

BIO_seek() uses the internal buffer, so that it can only seek into data that is already read. No time travel, bestie β€” past the buffer is uncharted territory 🌈


⭐ RETURN VALUES ⭐

BIO_f_readbuffer() returns the read buffering BIO method. (Same energy both times, because that's literally what it does 🫢)


πŸ¦‹ SEE ALSO πŸ¦‹

iykyk, go read those next πŸ‘‘


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 <https://www.openssl.org/source/license.html>.


that's the whole page, bestie πŸ’œ this was version 3.5.0, dated 2026-09-25, page BIO_F_READBUFFER(3ossl) β€” slay, go forth and buffer responsibly πŸ“βœ¨

πŸ“¦ where this page comes from