Browse Source

MT#55283 slightly improved crypto lookup

Avoids doing repeated strlen()

Change-Id: I9bb45d206627184ac62a928e85f221a5316c1494
pull/1776/head
Richard Fuchs 2 years ago
parent
commit
a0eca116d0
1 changed files with 3 additions and 11 deletions
  1. +3
    -11
      daemon/crypto.c

+ 3
- 11
daemon/crypto.c View File

@ -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