Tautological Name Fix

Depending on the build option WOLFSSL_ECC_CURVE_STATIC, the name in the
ecc_set may be a pointer (default) or an array. With the above set with
the CFLAG -Wtautological-pointer-compare you'll get a build error.
Changed the comparison in the for loop with this problem to check the
name's pointer only if appropriate.
This commit is contained in:
John Safranek
2020-10-23 15:23:16 -07:00
parent e24ac4211d
commit bfccf35eaf

View File

@@ -5550,7 +5550,13 @@ int wc_OBJ_sn2nid(const char *sn)
if (XSTRNCMP(sn, "secp384r1", 10) == 0) if (XSTRNCMP(sn, "secp384r1", 10) == 0)
sn = "SECP384R1"; sn = "SECP384R1";
/* find based on name and return NID */ /* find based on name and return NID */
for (i = 0; ecc_sets[i].size != 0 && ecc_sets[i].name != NULL; i++) { for (i = 0;
#ifndef WOLFSSL_ECC_CURVE_STATIC
ecc_sets[i].size != 0 && ecc_sets[i].name != NULL;
#else
ecc_sets[i].size != 0;
#endif
i++) {
if (XSTRNCMP(sn, ecc_sets[i].name, ECC_MAXNAME) == 0) { if (XSTRNCMP(sn, ecc_sets[i].name, ECC_MAXNAME) == 0) {
eccEnum = ecc_sets[i].id; eccEnum = ecc_sets[i].id;
/* Convert enum value in ecc_curve_id to OpenSSL NID */ /* Convert enum value in ecc_curve_id to OpenSSL NID */