SRTP fixes:

* in wolfssl/ssl.h, add missing arg names to wolfSSL_CTX_set_tlsext_use_srtp(), wolfSSL_set_tlsext_use_srtp(), and wolfSSL_export_dtls_srtp_keying_material();
* in wolfcrypt/src/kdf.c, call wc_AesFree if and only if wc_AesInit() succeeded;
* in src/ssl.c:DtlsSrtpSelProfiles(), fix bugprone-inc-dec-in-conditions;
* in tests/suites.c:execute_test_case(), fix several -Wdeclaration-after-statement and -Wmissing-field-initializers;
* in wolfcrypt/test/test.c, fix a shiftTooManyBitsSigned warning in srtpkdf_test(), and fix a typo (kaSz/ksSz).
This commit is contained in:
Daniel Pouzzner
2023-12-15 14:06:36 -06:00
parent 8f2a48c676
commit ef14176b7f
5 changed files with 40 additions and 22 deletions

View File

@@ -2240,15 +2240,19 @@ static int DtlsSrtpSelProfiles(word16* id, const char* profile_str)
do {
current = next;
next = XSTRSTR(current, ":");
current_length = (!next) ? (word32)XSTRLEN(current)
: (word32)(next - current);
if (next) {
current_length = (word32)(next - current);
++next; /* ++ needed to skip ':' */
} else {
current_length = (word32)XSTRLEN(current);
}
if (current_length < length)
length = current_length;
profile = DtlsSrtpFindProfile(current, current_length, 0);
if (profile != NULL) {
*id |= (1 << profile->id); /* selected bit based on ID */
}
} while (next != NULL && next++); /* ++ needed to skip ':' */
} while (next != NULL);
return WOLFSSL_SUCCESS;
}