]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Ignore RecordPadding option in config file for QUIC objects
authorNeil Horman <nhorman@openssl.org>
Sat, 25 Oct 2025 11:21:42 +0000 (07:21 -0400)
committerNeil Horman <nhorman@openssl.org>
Tue, 25 Nov 2025 10:32:46 +0000 (05:32 -0500)
QUIC connections always pad data at the packet level during packet
encryption, and so have no ability to do padding at the record level.

We want to be able to inform the user of this condition when
applications call SSL_set_block_padding_ex directly by returning an
error, we have no idea of what kind of SSL objects are created when the
config file is written.

As such, silently ignore this config file option when QUIC objects are created.

Fixes #28953

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29193)

doc/man3/SSL_CONF_cmd.pod
ssl/ssl_conf.c

index cb994ba7dee14f8163b95bde73debe0850d53802..3b84f16074e5795457f7a1d9173d1abe8f69f68c 100644 (file)
@@ -409,6 +409,11 @@ Padding attempts to pad TLSv1.3 records so that they are a multiple of the set
 length on send. A value of 0 or 1 turns off padding as relevant. Otherwise, the
 values must be >1 or <=16384.
 
+Note that, for QUIC objects, padding is always performed at the
+packet level, and so cannot be done at the record level.  Given that, when the
+config file is created, there is no knowledge of what kind of SSL objects are
+being created, this option is silently ignored for QUIC objects.
+
 =item B<SignatureAlgorithms>
 
 This sets the supported signature algorithms for TLSv1.2 and TLSv1.3.
index 3d835ab33c92f1ad8b4145538b5dd06c6c1a2c04..dd12946040d0cd5260f66cd83b8b191dacaeed72 100644 (file)
@@ -694,12 +694,30 @@ static int cmd_RecordPadding(SSL_CONF_CTX *cctx, const char *value)
      * All we care about are non-negative values,
      * the setters check the range
      */
-    if (cctx->ctx)
-        rv = SSL_CTX_set_block_padding_ex(cctx->ctx, (size_t)block_padding,
+    if (cctx->ctx) {
+        /*
+         * QUIC always pads TLS data at the packet level, and as such, attempting
+         * to set block padding at the record level fails in calls to SSL_CTX_set_block_padding_ex.
+         * However, when configuring record padding via config file, we have no idea if we are
+         * going to create TCP or QUIC based SSL's, so silently ignore this configuration option
+         * for QUIC.
+         */
+        if (SSL_CTX_is_quic(cctx->ctx))
+            rv = 1;
+        else
+            rv = SSL_CTX_set_block_padding_ex(cctx->ctx, (size_t)block_padding,
+                                              (size_t)hs_padding);
+    }
+    if (cctx->ssl) {
+        /*
+         * As above, ignore this config option for QUIC
+         */
+        if (SSL_is_quic(cctx->ssl))
+            rv = 1;
+        else
+            rv = SSL_set_block_padding_ex(cctx->ssl, (size_t)block_padding,
                                           (size_t)hs_padding);
-    if (cctx->ssl)
-        rv = SSL_set_block_padding_ex(cctx->ssl, (size_t)block_padding,
-                                      (size_t)hs_padding);
+    }
 out:
     OPENSSL_free(copy);
     return rv;