BIO_FIND_TYPE(3ossl)

πŸ“¦
version 15.1 Β· 3 versions
, in freebsd 15.1

πŸ’… BIO_FIND_TYPE(3ossl) β€” the OpenSSL glow-up edition πŸ¦‹

okay so bestie, you know how a BIO chain is basically a little friend group of BIOs all linked together? this page is literally the manual for walking down that group chat and finding the right person. it's BIO_find_type, BIO_next, and BIO_method_type β€” BIO chain traversal, periodt. ✨


🌸 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);

like, copy it exactly, don't be cute with it πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

πŸ’– BIO_find_type() β€” the "where's my bestie" function

so BIO_find_type() goes hunting for a BIO of a given type inside a chain, starting at BIO b. and here's the tea on how the search behaves:

  • if type is a specific type (like BIO_TYPE_MEM), it searches for a BIO of that exact type πŸ”
  • if type is a general type (like BIO_TYPE_SOURCE_SINK), it searches for the next matching BIO of that general type
  • it returns the next matching BIO, or NULL if there's literally none to be found 😭
  • and if type is BIO_TYPE_NONE, it will not find a match β€” no cap, that's a dead end πŸ’€

the general types that are defined are, and I quote:

  • BIO_TYPE_DESCRIPTOR
  • BIO_TYPE_FILTER
  • BIO_TYPE_SOURCE_SINK

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

πŸ¦‹ BIO_next() β€” the one that keeps it moving

BIO_next() returns the next BIO in a chain. you can use it to stroll through all the BIOs in a chain, or you can team it up with BIO_find_type() to find literally every BIO of a certain type. iconic duo behavior, honestly πŸ‘‘

⭐ BIO_method_type() β€” the vibe check

BIO_method_type() returns the type of a BIO. that's it, that's the function. short and slay πŸ’…


✨ 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 πŸ”₯

here's you traversing a chain looking for digest BIOs β€” main character energy fr fr:

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);

the way this loop just keeps finding them and moving on β€” obsessed 🧚


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


so yeah, that's the whole page πŸ’– this was OpenSSL 3.5.6, dated 2026-04-07, and the man page is BIO_FIND_TYPE(3ossl) β€” go forth and traverse those chains, bestie, you've got this πŸŽ€πŸŒˆβ­

πŸ“¦ where this page comes from