BIO_S_NULL(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’… BIO_S_NULL(3) β€” like, the manual page bestie

okay so this is from the libcrypto library β€” you know, the crypto one β€” and it's the whole scoop on BIO_s_null, aka the null data sink. yes she's literally a black hole for bytes and I'm obsessed πŸ’–


✨ SYNOPSIS ✨

the whole vibe check, copy it exactly bestie:

#include <openssl/bio.h>

const BIO_METHOD *
BIO_s_null(void);

πŸ¦‹ DESCRIPTION πŸ¦‹

so BIO_s_null() hands you back the null sink BIO method. that's it, that's the function πŸŽ€

and what does a null sink do? nothing! that's her whole personality, and she ate. data written to the null sink is just... discarded πŸ—‘οΈβœ¨ gone, deleted, not answering. and reads return EOF, periodt.

a null sink BIO behaves in a similar manner to the null(4) device β€” yep, same energy as /dev/null, iykyk πŸ’€

here's the fun part though: a null BIO can be placed on the end of a chain to discard any data passed through it. lowkey iconic plumbing.

and a null sink is useful if, for example, an application wishes to digest some data by writing through a digest bio but not send the digested data anywhere πŸ‘€ like β€” you wanna hash it but you don't wanna send it anywhere, right? since a BIO chain must normally include a source/sink BIO, this can be achieved by adding a null sink BIO to the end of the chain. slay, problem solved 🌸


🌈 RETURN VALUES 🌈

BIO_s_null() returns the null sink BIO method. simple, clean, no notes πŸ’…

and okay here's the specific-lore bit bestie, don't skip it: when called on a null sink BIO object, BIO_method_type(3) returns the constant BIO_TYPE_NULL, and BIO_method_name(3) returns a pointer to the static string "NULL".

🚨 and this is the part where people get it twisted β€” that "NULL" is not to be confused with a NUL string, nor with a NULL pointer. three completely different creatures babe, do not mix them up 😭

🧚 SEE ALSO 🧚

  • BIO_new(3) β€” go read it, she's the main character of chain-building 🫢

πŸ‘‘ HISTORY πŸ‘‘

BIO_s_null() first appeared in SSLeay 0.6.0 and has been available since OpenBSD 2.4. a true vintage icon, she's been serving since forever ⭐


kay that's the page!! this one was rendered on the Debian build, dated July 16, 2025, filed under BIO_S_NULL(3) β€” mwah, go discard some bytes responsibly πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from