BIO_FIND_TYPE(3SSL)

πŸ’– BIO_FIND_TYPE πŸ’–

okay bestie, welcome to the OpenSSL manual, section 3SSL πŸŽ€ this one's all about BIO chain traversal and honestly? it's giving "walking down the chain and checking everyone's vibe" ✨


✨ NAME ✨

BIO_find_type, BIO_next, BIO_method_type β€” BIO chain traversal, no cap πŸ¦‹


🌸 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 out here searching for a BIO of a given type in a chain, starting at BIO b, slay πŸ’–

  • if type is a specific type (like BIO_TYPE_MEM) then it goes looking for a BIO of exactly that type, periodt
  • if type is a general type (like BIO_TYPE_SOURCE_SINK) then it hunts for the next matching BIO of that general type πŸ‘‘

BIO_find_type() returns the next matching BIO, or NULL if none is found 😭 and heads up β€” if type is BIO_TYPE_NONE it will not find a match, it's just gonna be like that.

the following general types are defined: BIO_TYPE_DESCRIPTOR, BIO_TYPE_FILTER, and BIO_TYPE_SOURCE_SINK ✨

for a list of the specific types, go peek at the <openssl/bio.h> header file, iykyk 🧚


BIO_next() returns the next BIO in a chain πŸ’« you can use it to traverse all the BIOs in a chain, or team it up with BIO_find_type() to find all the BIOs of a certain type. dynamic duo energy fr fr 🫢


BIO_method_type() returns the type of a BIO, that's it, that's the whole job πŸ’β€β™€οΈ


πŸŽ€ RETURN VALUES πŸŽ€

  • BIO_find_type() β€” returns a matching BIO, or NULL for no match πŸ™ˆ
  • BIO_next() β€” returns the next BIO in a chain 🌈
  • BIO_method_type() β€” returns the type of the BIO b ⭐

πŸ”₯ EXAMPLES πŸ”₯

traverse a chain looking for digest BIOs:

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>.


and that's the whole page bestie, you ate this πŸ’… this lil manual moment came to you courtesy of 4.0.3 and 2026-09-29 β€” mwah, go traverse some chains πŸ¦‹βœ¨
πŸ“¦ where this page comes from