]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: ssl: skip unavailable NIDs in curves2nid lookup
authorWilliam Lallemand <wlallemand@irq6.net>
Tue, 6 Oct 2026 12:22:22 +0000 (14:22 +0200)
committerWilliam Lallemand <wlallemand@irq6.net>
Tue, 6 Oct 2026 13:39:56 +0000 (15:39 +0200)
Curve table entries with NIDs undefined by the SSL library remain at -1
after initialization. Skip these entries during name lookup so an
unavailable mapping does not hide a later valid mapping for the same
name. This allows the table to contain both OpenSSL and AWS-LC NID
spellings without conditional compilation.

src/ssl_utils.c

index 58c3e82fbc271708e9d6b1487da1dae8a38d686a..a5d5fde46e0ad364bcaf79602cfe616133488f79 100644 (file)
@@ -1124,9 +1124,10 @@ int curves2nid(const char *curve)
        struct curve *curves = curves_list;
 
        while (curves->curve_id) {
-               if ((curves->ansi && strcmp(curve, curves->ansi) == 0) ||
-                   (curves->iana && strcmp(curve, curves->iana) == 0) ||
-                   (curves->nist && strcmp(curve, curves->nist) == 0))
+               if (curves->nid != -1 &&
+                   ((curves->ansi && strcmp(curve, curves->ansi) == 0) ||
+                    (curves->iana && strcmp(curve, curves->iana) == 0) ||
+                    (curves->nist && strcmp(curve, curves->nist) == 0)))
                        return curves->nid;
                curves++;
        }