Debian Codegraph @

upstream/debian-unstable/man3/SSL_set_async_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 "SSL_SET_ASYNC_CALLBACK 3SSL"
58 .TH SSL_SET_ASYNC_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 SSL_CTX_set_async_callback,
65 SSL_CTX_set_async_callback_arg,
66 SSL_set_async_callback,
67 SSL_set_async_callback_arg,
68 SSL_get_async_status,
69 SSL_async_callback_fn
70 \&\- manage asynchronous operations
71 .SH SYNOPSIS
72 .IX Header "SYNOPSIS"
73 .Vb 1
74 \& #include <openssl/ssl.h>
75 \&
76 \& typedef int (*SSL_async_callback_fn)(SSL *s, void *arg);
77 \& int SSL_CTX_set_async_callback(SSL_CTX *ctx, SSL_async_callback_fn callback);
78 \& int SSL_CTX_set_async_callback_arg(SSL_CTX *ctx, void *arg);
79 \& int SSL_set_async_callback(SSL *s, SSL_async_callback_fn callback);
80 \& int SSL_set_async_callback_arg(SSL *s, void *arg);
81 \& int SSL_get_async_status(SSL *s, int *status);
82 .Ve
83 .SH DESCRIPTION
84 .IX Header "DESCRIPTION"
85 \&\fBSSL_CTX_set_async_callback()\fR sets an asynchronous callback function. All \fBSSL\fR
86 objects generated based on this \fBSSL_CTX\fR will get this callback. If an engine
87 supports the callback mechanism, it will be automatically called if
88 \&\fBSSL_MODE_ASYNC\fR has been set and an asynchronous capable engine completes a
89 cryptography operation to notify the application to resume the paused work flow.
90 .PP
91 \&\fBSSL_CTX_set_async_callback_arg()\fR sets the callback argument.
92 .PP
93 \&\fBSSL_set_async_callback()\fR allows an application to set a callback in an
94 asynchronous \fBSSL\fR object, so that when an engine completes a cryptography
95 operation, the callback will be called to notify the application to resume the
96 paused work flow.
97 .PP
98 \&\fBSSL_set_async_callback_arg()\fR sets an argument for the \fBSSL\fR object when the
99 above callback is called.
100 .PP
101 \&\fBSSL_get_async_status()\fR returns the engine status. This function facilitates the
102 communication from the engine to the application. During an SSL session,
103 cryptographic operations are dispatched to an engine. The engine status is very
104 useful for an application to know if the operation has been successfully
105 dispatched. If the engine does not support this additional callback method,
106 \&\fBASYNC_STATUS_UNSUPPORTED\fR will be returned. See \fBASYNC_WAIT_CTX_set_status()\fR
107 for a description of all of the status values.
108 .PP
109 An example of the above functions would be the following:
110 .IP 1. 4
111 Application sets the async callback and callback data on an SSL connection
112 by calling \fBSSL_set_async_callback()\fR.
113 .IP 2. 4
114 Application sets \fBSSL_MODE_ASYNC\fR and makes an asynchronous SSL call
115 .IP 3. 4
116 OpenSSL submits the asynchronous request to the engine. If a retry occurs at
117 this point then the status within the \fBASYNC_WAIT_CTX\fR would be set and the
118 async callback function would be called (goto Step 7).
119 .IP 4. 4
120 The OpenSSL engine pauses the current job and returns, so that the
121 application can continue processing other connections.
122 .IP 5. 4
123 At a future point in time (probably via a polling mechanism or via an
124 interrupt) the engine will become aware that the asynchronous request has
125 finished processing.
126 .IP 6. 4
127 The engine will call the application's callback passing the callback data as
128 a parameter.
129 .IP 7. 4
130 The callback function should then run. Note: it is a requirement that the
131 callback function is small and nonblocking as it will be run in the context of
132 a polling mechanism or an interrupt.
133 .IP 8. 4
134 It is the application's responsibility via the callback function to schedule
135 recalling the OpenSSL asynchronous function and to continue processing.
136 .IP 9. 4
137 The callback function has the option to check the status returned via
138 \&\fBSSL_get_async_status()\fR to determine whether a retry happened instead of the
139 request being submitted, allowing different processing if required.
140 .SH "RETURN VALUES"
141 .IX Header "RETURN VALUES"
142 \&\fBSSL_CTX_set_async_callback()\fR, \fBSSL_set_async_callback()\fR,
143 \&\fBSSL_CTX_set_async_callback_arg()\fR, \fBSSL_CTX_set_async_callback_arg()\fR and
144 \&\fBSSL_get_async_status()\fR return 1 on success or 0 on error.
145 .SH "SEE ALSO"
146 .IX Header "SEE ALSO"
147 \&\fBssl\fR\|(7)
148 .SH HISTORY
149 .IX Header "HISTORY"
150 \&\fBSSL_CTX_set_async_callback()\fR, \fBSSL_CTX_set_async_callback_arg()\fR,
151 \&\fBSSL_set_async_callback()\fR, \fBSSL_set_async_callback_arg()\fR and
152 \&\fBSSL_get_async_status()\fR were first added to OpenSSL 3.0.
153 .SH COPYRIGHT
154 .IX Header "COPYRIGHT"
155 Copyright 2019\-2020 The OpenSSL Project Authors. All Rights Reserved.
156 .PP
157 Licensed under the Apache License 2.0 (the "License"). You may not use
158 this file except in compliance with the License. You can obtain a copy
159 in the file LICENSE in the source distribution or at
160 <https://www.openssl.org/source/license.html>.