Debian Codegraph @

upstream/debian-unstable/man3/OSSL_CALLBACK.3ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "OSSL_CALLBACK 3SSL"
58 .TH OSSL_CALLBACK 3SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 OSSL_CALLBACK, OSSL_PASSPHRASE_CALLBACK \- OpenSSL Core type to define callbacks
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 .Vb 6
68 \& #include <openssl/core.h>
69 \& typedef int (OSSL_CALLBACK)(const OSSL_PARAM params[], void *arg);
70 \& typedef int (OSSL_PASSPHRASE_CALLBACK)(char *pass, size_t pass_size,
71 \& size_t *pass_len,
72 \& const OSSL_PARAM params[],
73 \& void *arg);
74 .Ve
75 .SH DESCRIPTION
76 .IX Header "DESCRIPTION"
77 For certain events or activities, provider functionality may need help from
78 the application or the calling OpenSSL libraries themselves. For example,
79 user input or direct (possibly optional) user output could be implemented
80 this way.
81 .PP
82 Callback functions themselves are always provided by or through the calling
83 OpenSSL libraries, along with a generic pointer to data \fIarg\fR. As far as
84 the function receiving the pointer to the function pointer and \fIarg\fR is
85 concerned, the data that \fIarg\fR points at is opaque, and the pointer should
86 simply be passed back to the callback function when it's called.
87 .IP \fBOSSL_CALLBACK\fR 4
88 .IX Item "OSSL_CALLBACK"
89 This is a generic callback function. When calling this callback function,
90 the caller is expected to build an \fBOSSL_PARAM\fR\|(3) array of data it wants or
91 is expected to pass back, and pass that as \fIparams\fR, as well as the opaque
92 data pointer it received, as \fIarg\fR.
93 .IP \fBOSSL_PASSPHRASE_CALLBACK\fR 4
94 .IX Item "OSSL_PASSPHRASE_CALLBACK"
95 This is a specialised callback function, used specifically to prompt the
96 user for a passphrase. When calling this callback function, a buffer to
97 store the pass phrase needs to be given with \fIpass\fR, and its size with
98 \&\fIpass_size\fR. The length of the prompted pass phrase will be given back in
99 \&\fI*pass_len\fR.
100 .Sp
101 Additional parameters can be passed with the \fBOSSL_PARAM\fR\|(3) array \fIparams\fR,
102 .SH "RETURN VALUES"
103 .IX Header "RETURN VALUES"
104 Functions of type \fBOSSL_CALLBACK\fR and \fBOSSL_PASSPHRASE_CALLBACK\fR
105 must return 1 on success and 0 on failure.
106 .SH "SEE ALSO"
107 .IX Header "SEE ALSO"
108 \&\fBopenssl\-core.h\fR\|(7)
109 .SH HISTORY
110 .IX Header "HISTORY"
111 The types described here were added in OpenSSL 3.0.
112 .SH COPYRIGHT
113 .IX Header "COPYRIGHT"
114 Copyright 2022\-2025 The OpenSSL Project Authors. All Rights Reserved.
115 .PP
116 Licensed under the Apache License 2.0 (the "License"). You may not use
117 this file except in compliance with the License. You can obtain a copy
118 in the file LICENSE in the source distribution or at
119 <https://www.openssl.org/source/license.html>.