Skip to content

Avoid BIO_meth_get_* methods as they are deprecated in OpenSSL 3.5 #2584

Description

@visweshn92

OpenSSL 3.5 is the next LTS, and OpenSSL 3.0 will be out of support from Sept 2026. In OpenSSL 3.5, the BIO_meth_get_* functions are deprecated. More importantly, the BIO_METHOD structure is now fully opaque, and OpenSSL internal implementations (e.g., read vs read_ex) are subject to change.

BioMethodUniquePtr OpenSSLUtils::newSocketBioMethod() {
BIO_METHOD* newmeth = nullptr;
if (!(newmeth = BIO_meth_new(BIO_TYPE_SOCKET, "socket_bio_method"))) {
return nullptr;
}
auto meth = const_cast<BIO_METHOD*>(BIO_s_socket());
BIO_meth_set_create(newmeth, BIO_meth_get_create(meth));
BIO_meth_set_destroy(newmeth, BIO_meth_get_destroy(meth));
BIO_meth_set_ctrl(newmeth, BIO_meth_get_ctrl(meth));
BIO_meth_set_callback_ctrl(newmeth, BIO_meth_get_callback_ctrl(meth));
BIO_meth_set_read(newmeth, BIO_meth_get_read(meth));
BIO_meth_set_write(newmeth, BIO_meth_get_write(meth));
BIO_meth_set_gets(newmeth, BIO_meth_get_gets(meth));
BIO_meth_set_puts(newmeth, BIO_meth_get_puts(meth));
return BioMethodUniquePtr(newmeth);

The inheritance pattern (copying a method table) should be replaced with the Filter BIO pattern (composition), which is the standard mechanism in OpenSSL 3.x for extending BIO behavior.

Until a proper fix is made, anyone who wants to build folly with OpenSSL 3.5 can use OPENSSL_API_COMPAT macro to suppress the compiler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions