1SSL_CTX_SET_RECORD_PADDING_CALLBACK(3OSopSseLsn_lSC)STLX_SET_RECORD_PADDING_CALLBACK(3ossl)
2
3
4

NAME

6       SSL_CTX_set_record_padding_callback, SSL_set_record_padding_callback,
7       SSL_CTX_set_record_padding_callback_arg,
8       SSL_set_record_padding_callback_arg,
9       SSL_CTX_get_record_padding_callback_arg,
10       SSL_get_record_padding_callback_arg, SSL_CTX_set_block_padding,
11       SSL_set_block_padding - install callback to specify TLS 1.3 record
12       padding
13

SYNOPSIS

15        #include <openssl/ssl.h>
16
17        void SSL_CTX_set_record_padding_callback(SSL_CTX *ctx, size_t (*cb)(SSL *s, int type, size_t len, void *arg));
18        int SSL_set_record_padding_callback(SSL *ssl, size_t (*cb)(SSL *s, int type, size_t len, void *arg));
19
20        void SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg);
21        void *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx);
22
23        void SSL_set_record_padding_callback_arg(SSL *ssl, void *arg);
24        void *SSL_get_record_padding_callback_arg(const SSL *ssl);
25
26        int SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size);
27        int SSL_set_block_padding(SSL *ssl, size_t block_size);
28

DESCRIPTION

30       SSL_CTX_set_record_padding_callback() or
31       SSL_set_record_padding_callback() can be used to assign a callback
32       function cb to specify the padding for TLS 1.3 records. The value set
33       in ctx is copied to a new SSL by SSL_new().  Kernel TLS is not possible
34       if the record padding callback is set, and the callback function cannot
35       be set if Kernel TLS is already configured for the current SSL object.
36
37       SSL_CTX_set_record_padding_callback_arg() and
38       SSL_set_record_padding_callback_arg() assign a value arg that is passed
39       to the callback when it is invoked. The value set in ctx is copied to a
40       new SSL by SSL_new().
41
42       SSL_CTX_get_record_padding_callback_arg() and
43       SSL_get_record_padding_callback_arg() retrieve the arg value that is
44       passed to the callback.
45
46       SSL_CTX_set_block_padding() and SSL_set_block_padding() pads the record
47       to a multiple of the block_size. A block_size of 0 or 1 disables block
48       padding. The limit of block_size is SSL3_RT_MAX_PLAIN_LENGTH.
49
50       The callback is invoked for every record before encryption.  The type
51       parameter is the TLS record type that is being processed; may be one of
52       SSL3_RT_APPLICATION_DATA, SSL3_RT_HANDSHAKE, or SSL3_RT_ALERT.  The len
53       parameter is the current plaintext length of the record before
54       encryption.  The arg parameter is the value set via
55       SSL_CTX_set_record_padding_callback_arg() or
56       SSL_set_record_padding_callback_arg().
57

RETURN VALUES

59       The SSL_CTX_get_record_padding_callback_arg() and
60       SSL_get_record_padding_callback_arg() functions return the arg value
61       assigned in the corresponding set functions.
62
63       The SSL_CTX_set_block_padding() and SSL_set_block_padding() functions
64       return 1 on success or 0 if block_size is too large.
65
66       The cb returns the number of padding bytes to add to the record. A
67       return of 0 indicates no padding will be added. A return value that
68       causes the record to exceed the maximum record size
69       (SSL3_RT_MAX_PLAIN_LENGTH) will pad out to the maximum record size.
70
71       The SSL_CTX_get_record_padding_callback_arg() function returns 1 on
72       success or 0 if the callback function is not set because Kernel TLS is
73       configured for the SSL object.
74

NOTES

76       The default behavior is to add no padding to the record.
77
78       A user-supplied padding callback function will override the behavior
79       set by SSL_set_block_padding() or SSL_CTX_set_block_padding(). Setting
80       the user-supplied callback to NULL will restore the configured block
81       padding behavior.
82
83       These functions only apply to TLS 1.3 records being written.
84
85       Padding bytes are not added in constant-time.
86

SEE ALSO

88       ssl(7), SSL_new(3)
89

HISTORY

91       The record padding API was added for TLS 1.3 support in OpenSSL 1.1.1.
92
93       The return type of SSL_CTX_set_record_padding_callback() function was
94       changed to int in OpenSSL 3.0.
95
97       Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
98
99       Licensed under the Apache License 2.0 (the "License").  You may not use
100       this file except in compliance with the License.  You can obtain a copy
101       in the file LICENSE in the source distribution or at
102       <https://www.openssl.org/source/license.html>.
103
104
105
1063.0.5                             202S2S-L1_1C-T0X1_SET_RECORD_PADDING_CALLBACK(3ossl)
Impressum