Commit d3961e8a44 for openssl.org

commit d3961e8a44c8ad873797bc5632f2ab55cad4b608
Author: Jakub Zelenka <jakub.zelenka@openssl.foundation>
Date:   Wed Aug 5 15:06:10 2026 +0200

    statem: add missing SSLfatal in padding extension construction

    tls_construct_ctos_padding() returned EXT_RETURN_FAIL on a
    non-positive digest size without calling SSLfatal(), propagating to
    CON_FUNC_ERROR in the ClientHello construction without the fatal
    state set. This should currently not happen as ssl_md() only returns
    digests with a positive size, so this is just future proofing of the
    error handling.

    Assisted-by: Claude:claude-fable-5

    Reviewed-by: Matt Caswell <matt@openssl.foundation>
    Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
    MergeDate: Tue Aug 11 08:45:51 2026
    (Merged from https://github.com/openssl/openssl/pull/32199)

diff --git a/ssl/statem/extensions_clnt.c b/ssl/statem/extensions_clnt.c
index f17fe2c495..2d19a7ae8b 100644
--- a/ssl/statem/extensions_clnt.c
+++ b/ssl/statem/extensions_clnt.c
@@ -1272,8 +1272,10 @@ EXT_RETURN tls_construct_ctos_padding(SSL_CONNECTION *s, WPACKET *pkt,
              */
             int md_size = EVP_MD_get_size(md);

-            if (md_size <= 0)
+            if (md_size <= 0) {
+                SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
                 return EXT_RETURN_FAIL;
+            }
             hlen += PSK_PRE_BINDER_OVERHEAD + s->session->ext.ticklen
                 + md_size;
         }