MT#55283 slightly improved crypto lookup

Avoids doing repeated strlen()

Change-Id: I9bb45d206627184ac62a928e85f221a5316c1494
pull/1776/head
Richard Fuchs 2 years ago
parent 4e59215fe5
commit a0eca116d0

@ -337,22 +337,14 @@ const unsigned int num_crypto_suites = G_N_ELEMENTS(__crypto_suites);
const struct crypto_suite * crypto_find_suite(const str *s) {
int i, l;
int i;
const struct crypto_suite *cs;
for (i = 0; i < num_crypto_suites; i++) {
cs = &crypto_suites[i];
if (!cs->name)
continue;
l = strlen(cs->name);
if (l != s->len)
continue;
if (strncasecmp(cs->name, s->s, s->len))
continue;
return cs;
if (str_casecmp_str(&cs->name_str, s) == 0)
return cs;
}
return NULL;

Loading…
Cancel
Save