Fix for TLS v1.3 test PSK callback to support cipher list. Add support for GetCipherSuiteFromName to accept a name ending with colon.

This commit is contained in:
David Garske
2020-05-18 11:53:31 -07:00
parent 3b63e55a68
commit d4fdd1e590
2 changed files with 10 additions and 2 deletions

View File

@@ -2080,7 +2080,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
#ifndef NO_PSK #ifndef NO_PSK
if (usePsk) { if (usePsk) {
done += 1; /* don't perform exernal tests if PSK is enabled */ done += 1; /* don't perform external tests if PSK is enabled */
} }
#endif #endif

View File

@@ -18723,7 +18723,15 @@ int GetCipherSuiteFromName(const char* name, byte* cipherSuite0,
{ {
int ret = BAD_FUNC_ARG; int ret = BAD_FUNC_ARG;
int i; int i;
unsigned long len = (unsigned long)XSTRLEN(name); unsigned long len;
const char* nameDelim;
/* Support trailing : */
nameDelim = XSTRSTR(name, ":");
if (nameDelim)
len = (unsigned long)(nameDelim - name);
else
len = (unsigned long)XSTRLEN(name);
for (i = 0; i < GetCipherNamesSize(); i++) { for (i = 0; i < GetCipherNamesSize(); i++) {
if (XSTRNCMP(name, cipher_names[i].name, len) == 0) { if (XSTRNCMP(name, cipher_names[i].name, len) == 0) {