1SSL_CTX_SET_RECORD_PADDING_CALLBACK(3O)penSSSSLL_CTX_SET_RECORD_PADDING_CALLBACK(3)
2
3
4
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
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 void 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
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().
34
35 SSL_CTX_set_record_padding_callback_arg() and
36 SSL_set_record_padding_callback_arg() assign a value arg that is passed
37 to the callback when it is invoked. The value set in ctx is copied to a
38 new SSL by SSL_new().
39
40 SSL_CTX_get_record_padding_callback_arg() and
41 SSL_get_record_padding_callback_arg() retrieve the arg value that is
42 passed to the callback.
43
44 SSL_CTX_set_block_padding() and SSL_set_block_padding() pads the record
45 to a multiple of the block_size. A block_size of 0 or 1 disables block
46 padding. The limit of block_size is SSL3_RT_MAX_PLAIN_LENGTH.
47
48 The callback is invoked for every record before encryption. The type
49 parameter is the TLS record type that is being processed; may be one of
50 SSL3_RT_APPLICATION_DATA, SSL3_RT_HANDSHAKE, or SSL3_RT_ALERT. The len
51 parameter is the current plaintext length of the record before
52 encryption. The arg parameter is the value set via
53 SSL_CTX_set_record_padding_callback_arg() or
54 SSL_set_record_padding_callback_arg().
55
57 The SSL_CTX_get_record_padding_callback_arg() and
58 SSL_get_record_padding_callback_arg() functions return the arg value
59 assigned in the corresponding set functions.
60
61 The SSL_CTX_set_block_padding() and SSL_set_block_padding() functions
62 return 1 on success or 0 if block_size is too large.
63
64 The cb returns the number of padding bytes to add to the record. A
65 return of 0 indicates no padding will be added. A return value that
66 causes the record to exceed the maximum record size
67 (SSL3_RT_MAX_PLAIN_LENGTH) will pad out to the maximum record size.
68
70 The default behavior is to add no padding to the record.
71
72 A user-supplied padding callback function will override the behavior
73 set by SSL_set_block_padding() or SSL_CTX_set_block_padding(). Setting
74 the user-supplied callback to NULL will restore the configured block
75 padding behavior.
76
77 These functions only apply to TLS 1.3 records being written.
78
79 Padding bytes are not added in constant-time.
80
82 ssl(7), SSL_new(3)
83
85 The record padding API was added for TLS 1.3 support in OpenSSL 1.1.1.
86
88 Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
89
90 Licensed under the OpenSSL license (the "License"). You may not use
91 this file except in compliance with the License. You can obtain a copy
92 in the file LICENSE in the source distribution or at
93 <https://www.openssl.org/source/license.html>.
94
95
96
971.1.1d 2019-10S-S0L3_CTX_SET_RECORD_PADDING_CALLBACK(3)