OSSL_CALLBACK(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’… OSSL_CALLBACK β€” OpenSSL core types that define callbacks

Hey bestie, welcome to OSSL_CALLBACK(3ossl) from the OpenSSL fam β€” this is the page that explains how callbacks get defined at the core level, so buckle up πŸŽ€


✨ NAME ✨

OSSL_CALLBACK, OSSL_PASSPHRASE_CALLBACK β€” the OpenSSL core types that define callbacks. That's literally it, that's the whole name section πŸ’–


🌸 SYNOPSIS 🌸

#include <openssl/core.h>
typedef int (OSSL_CALLBACK)(const OSSL_PARAM params[], void *arg);
typedef int (OSSL_PASSPHRASE_CALLBACK)(char *pass, size_t pass_size,
                                       size_t *pass_len,
                                       const OSSL_PARAM params[],
                                       void *arg);

Copy those exactly, bestie, character for character β€” no "fixing" the spacing, no renaming, no vibes-based edits πŸ™ˆ


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so here's the tea β˜•: sometimes provider functionality needs a little help from the application, or from the calling OpenSSL libraries themselves, for certain events or activities. Like, user input? Direct (possibly optional) user output? Those could totally be implemented this way. It's giving "let the grown-ups handle it" energy πŸ‘‘

Callback functions themselves are always provided by or through the calling OpenSSL libraries, along with a generic pointer to data called arg. And here's the important bit: as far as the function receiving that pointer-to-function-pointer and arg is concerned, whatever arg points at is opaque. So don't go poking around in it β€” just pass the pointer right back to the callback function when it gets called. Periodt πŸ’…

πŸ’œ OSSL_CALLBACK

This one's the generic callback function, the main character of the two 🌟 When this callback function gets called, the caller is expected to build an OSSL_PARAM(3) array of the data it wants or is expected to pass back, then pass that as params β€” plus the opaque data pointer it received, as arg. That's the whole ritual, no cap 🫢

πŸ“ OSSL_PASSPHRASE_CALLBACK

This one's the specialised callback function, used specifically to prompt the user for a passphrase πŸ” When it gets called, you've gotta hand it a buffer to store the passphrase in via pass, and that buffer's size via pass_size. The length of the prompted passphrase comes right back to you in *pass_len. Iconic.

Extra parameters can be passed along with the OSSL_PARAM(3) array params, β€” yes, the original ends that sentence with a comma, and I'm keeping it because I respect the source material πŸ’€


🧚 SEE ALSO 🧚

That's the whole list β€” go read it, iykyk ✨


⭐ HISTORY ⭐

The types described here were added in OpenSSL 3.0. So they're not new-new, but they're still slay πŸŽ€


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

Fr fr bestie, that license line is serious business β€” "You may not use this file except in compliance with the License" is not a vibe check you wanna fail 😭

And that's a wrap, babe πŸ’– This was OSSL_CALLBACK(3ossl) from OpenSSL version 3.5.0, dated 2026-09-25 β€” go forth and callback responsibly, mwah 🫢✨

πŸ“¦ where this page comes from