openssl-prebuild/linux_amd64/ssl/share/doc/openssl/html/man3/SSL_CTX_set_record_padding_callback.html
2020-03-02 16:50:34 +00:00

129 lines
5.4 KiB
HTML
Executable File

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SSL_CTX_set_record_padding_callback</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#return_values">RETURN VALUES</a></li>
<li><a href="#notes">NOTES</a></li>
<li><a href="#see_also">SEE ALSO</a></li>
<li><a href="#history">HISTORY</a></li>
<li><a href="#copyright">COPYRIGHT</a></li>
</ul>
<hr name="index" />
</div>
<!-- INDEX END -->
<p>
</p>
<hr />
<h1><a name="name">NAME</a></h1>
<p>SSL_CTX_set_record_padding_callback,
SSL_set_record_padding_callback,
SSL_CTX_set_record_padding_callback_arg,
SSL_set_record_padding_callback_arg,
SSL_CTX_get_record_padding_callback_arg,
SSL_get_record_padding_callback_arg,
SSL_CTX_set_block_padding,
SSL_set_block_padding - install callback to specify TLS 1.3 record padding</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
#include &lt;openssl/ssl.h&gt;</pre>
<pre>
void SSL_CTX_set_record_padding_callback(SSL_CTX *ctx, size_t (*cb)(SSL *s, int type, size_t len, void *arg));
void SSL_set_record_padding_callback(SSL *ssl, size_t (*cb)(SSL *s, int type, size_t len, void *arg));</pre>
<pre>
void SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg);
void *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx);</pre>
<pre>
void SSL_set_record_padding_callback_arg(SSL *ssl, void *arg);
void *SSL_get_record_padding_callback_arg(const SSL *ssl);</pre>
<pre>
int SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size);
int SSL_set_block_padding(SSL *ssl, size_t block_size);</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p><code>SSL_CTX_set_record_padding_callback()</code> or <code>SSL_set_record_padding_callback()</code>
can be used to assign a callback function <em>cb</em> to specify the padding
for TLS 1.3 records. The value set in <strong>ctx</strong> is copied to a new SSL by <code>SSL_new()</code>.</p>
<p><code>SSL_CTX_set_record_padding_callback_arg()</code> and <code>SSL_set_record_padding_callback_arg()</code>
assign a value <strong>arg</strong> that is passed to the callback when it is invoked. The value
set in <strong>ctx</strong> is copied to a new SSL by <code>SSL_new()</code>.</p>
<p><code>SSL_CTX_get_record_padding_callback_arg()</code> and <code>SSL_get_record_padding_callback_arg()</code>
retrieve the <strong>arg</strong> value that is passed to the callback.</p>
<p><code>SSL_CTX_set_block_padding()</code> and <code>SSL_set_block_padding()</code> pads the record to a multiple
of the <strong>block_size</strong>. A <strong>block_size</strong> of 0 or 1 disables block padding. The limit of
<strong>block_size</strong> is SSL3_RT_MAX_PLAIN_LENGTH.</p>
<p>The callback is invoked for every record before encryption.
The <strong>type</strong> parameter is the TLS record type that is being processed; may be
one of SSL3_RT_APPLICATION_DATA, SSL3_RT_HANDSHAKE, or SSL3_RT_ALERT.
The <strong>len</strong> parameter is the current plaintext length of the record before encryption.
The <strong>arg</strong> parameter is the value set via <code>SSL_CTX_set_record_padding_callback_arg()</code>
or <code>SSL_set_record_padding_callback_arg()</code>.</p>
<p>
</p>
<hr />
<h1><a name="return_values">RETURN VALUES</a></h1>
<p>The <code>SSL_CTX_get_record_padding_callback_arg()</code> and <code>SSL_get_record_padding_callback_arg()</code>
functions return the <strong>arg</strong> value assigned in the corresponding set functions.</p>
<p>The <code>SSL_CTX_set_block_padding()</code> and <code>SSL_set_block_padding()</code> functions return 1 on success
or 0 if <strong>block_size</strong> is too large.</p>
<p>The <strong>cb</strong> returns the number of padding bytes to add to the record. A return of 0
indicates no padding will be added. A return value that causes the record to
exceed the maximum record size (SSL3_RT_MAX_PLAIN_LENGTH) will pad out to the
maximum record size.</p>
<p>
</p>
<hr />
<h1><a name="notes">NOTES</a></h1>
<p>The default behavior is to add no padding to the record.</p>
<p>A user-supplied padding callback function will override the behavior set by
<code>SSL_set_block_padding()</code> or <code>SSL_CTX_set_block_padding()</code>. Setting the user-supplied
callback to NULL will restore the configured block padding behavior.</p>
<p>These functions only apply to TLS 1.3 records being written.</p>
<p>Padding bytes are not added in constant-time.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><em>ssl(7)</em>, <em>SSL_new(3)</em></p>
<p>
</p>
<hr />
<h1><a name="history">HISTORY</a></h1>
<p>The record padding API was added for TLS 1.3 support in OpenSSL 1.1.1.</p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.</p>
<p>Licensed under the Apache License 2.0 (the &quot;License&quot;). 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
<a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p>
</body>
</html>