OSSL_CALLBACK(3ossl)
π
OSSL_CALLBACK β the OpenSSL core types that define callbacks (yes bestie, this is 3ossl, the OpenSSL manual) π
πΈ NAME πΈ
okay so <pink>OSSL_CALLBACK</pink> and <pink>OSSL_PASSPHRASE_CALLBACK</pink> β these are the OpenSSL Core type definitions for callbacks. That's the whole vibe. π
β¨ 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);
π¦ DESCRIPTION π¦
So here's the tea β β sometimes, for certain events or activities, provider functionality lowkey needs a little help from the application, or from the calling OpenSSL libraries themselves. Like, for example, user input or direct (possibly optional) user output could be implemented this way. It's giving collaboration. π«Ά
The callback functions themselves are always provided by or through the calling OpenSSL libraries, along with a generic pointer to data β that's arg. And here's the important part, bestie: as far as the function receiving the pointer to the function pointer and arg is concerned, the data that arg points at is opaque π β so just pass that pointer right back to the callback function when it gets called. No peeking. No cap.
π OSSL_CALLBACK
This one is the generic callback function, the main character of the two. β¨ When you call it, the caller is expected to build an OSSL_PARAM(3) array of the data it wants or is expected to pass back, and pass that as params β plus the opaque data pointer it received, as arg. That's it, that's the whole assignment. π
π OSSL_PASSPHRASE_CALLBACK
This one is the specialised callback function, used specifically to prompt the user for a passphrase π. When you call it, you gotta hand over a buffer to store the pass phrase with pass, and its size with pass_size. Then the length of the prompted pass phrase gets given back to you in *pass_len. Iconic. π
Additional parameters can be passed with the OSSL_PARAM(3) array params, π
π₯ RETURN VALUES π₯
Functions of type OSSL_CALLBACK and OSSL_PASSPHRASE_CALLBACK must return 1 on success and 0 on failure. That's the vibe check β 1 slays, 0 does not. β
π
π SEE ALSO π
go read it, iykyk πβ¨
β HISTORY β
The types described here were added in OpenSSL 3.0. A little throwback moment for the timeline π°οΈπ
π COPYRIGHT π
Copyright 2022-2025 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 read the license before you go wild with it π
okay bye bestie, this page was brought to you by version 3.5.6, dated 2026-04-07 β OSSL_CALLBACK(3ossl), that's a wrap, mwah πππ¦
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms