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.
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++;
}