]> git.kaiwu.me - haproxy.git/commitdiff
BUILD: ssl: avoid mixed declarations in the AWS-LC curve fetch
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 5 Oct 2026 13:04:29 +0000 (13:04 +0000)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 5 Oct 2026 13:04:29 +0000 (13:04 +0000)
The AWS-LC API 30-34 curve fetch declares the group variable after
statements, which fails builds using -Werror=declaration-after-statement.

Move the declaration to the beginning of smp_fetch_ssl_fc_ec() and keep
the assignment in the AWS-LC branch. Mark the variable __maybe_unused
for builds using other SSL libraries.

This fix must be backported wherever commit e671cb696d ("MINOR: ssl:
support curve fetches with AWS-LC API 30") was backported.

src/ssl_sample.c

index 2a2180e624ceca75e895a83d4306294e523125da..baa6449ecf1261eb80d5fef61708b128e2efa5a7 100644 (file)
@@ -1736,6 +1736,7 @@ smp_fetch_ssl_fc_ec(const struct arg *args, struct sample *smp, const char *kw,
        struct connection *conn;
        SSL *ssl;
        int __maybe_unused nid;
+       uint16_t __maybe_unused group;
        char *curve_name;
 
        if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
@@ -1771,7 +1772,7 @@ smp_fetch_ssl_fc_ec(const struct arg *args, struct sample *smp, const char *kw,
                        curve_name[i] = toupper((unsigned char)curve_name[i]);
        }
 # elif defined(OPENSSL_IS_AWSLC) && AWSLC_API_VERSION < 35
-       uint16_t group = SSL_get_group_id(ssl);
+       group = SSL_get_group_id(ssl);
 
        /* Match the NIST curve short names returned by the NID-based API in
         * newer AWS-LC versions. Other groups, including PQ/hybrid groups,