BIO_FIND_TYPE(3ossl)

πŸ’– BIO_FIND_TYPE β€” bestie edition πŸ’–

okay so this is the BIO_FIND_TYPE(3ossl) page from the OpenSSL manual, and it's literally all about walking a BIO chain like it's a group chat and you're scrolling for the one message that matters. no cap.

✨ NAME ✨

BIO_find_type, BIO_next, BIO_method_type β€” BIO chain traversal, aka "how do I find my fave in a whole crowd of BIOs" πŸ¦‹


✨ SYNOPSIS ✨

#include <openssl/bio.h>

BIO *BIO_find_type(BIO *b, int bio_type);
BIO *BIO_next(BIO *b);
int BIO_method_type(const BIO *b);

✨ DESCRIPTION ✨

so BIO_find_type() is the search bestie πŸ” β€” it hunts for a BIO of a given type in a chain, and it starts the hunt at BIO b.

if type is a specific type (think something like BIO_TYPE_MEM), then it goes looking for a BIO of exactly that type. if type is a general type (think something like BIO_TYPE_SOURCE_SINK), then it goes looking for the next matching BIO of that general type instead.

BIO_find_type() hands you back the next matching BIO, or NULL if there's just... nothing there 😭. and heads up β€” if type is BIO_TYPE_NONE, it will not find a match. like, at all. it's giving "searching for the void."

the general types that are defined are: BIO_TYPE_DESCRIPTOR, BIO_TYPE_FILTER, and BIO_TYPE_SOURCE_SINK. πŸ’…

for the full list of specific types, go peek at the <openssl/bio.h> header file β€” that's where they all live.

BIO_next() returns the next BIO in a chain. you can use it to walk through every BIO in a chain, or you can team it up with BIO_find_type() to catch all the BIOs of a certain type. dynamic duo energy fr fr 🫢

BIO_method_type() returns the type of a BIO.


✨ RETURN VALUES ✨

  • BIO_find_type() β€” returns a matching BIO, or NULL for no match. no match = no vibe πŸ’€
  • BIO_next() β€” returns the next BIO in a chain.
  • BIO_method_type() β€” returns the type of the BIO b.

✨ EXAMPLES ✨

here's us traversing a chain, looking for digest BIOs (the main characters, obviously πŸ‘‘):

BIO *btmp;

btmp = in_bio; /* in_bio is chain to search through */
do {
    btmp = BIO_find_type(btmp, BIO_TYPE_MD);
    if (btmp == NULL)
        break; /* Not found */
    /* btmp is a digest BIO, do something with it ...*/
    ...

    btmp = BIO_next(btmp);
} while (btmp);

Copyright 2000-2024 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>.


lowkey important: that license thing is not a suggestion bestie, actually comply with it πŸ’œ

and that's the whole page!! this was OpenSSL 3.5.9, dated 2026-09-29, and honestly? iconic. slay, go traverse your chains responsibly πŸŽ€βœ¨

πŸ“¦ where this page comes from