aboutsummaryrefslogtreecommitdiffstats
path: root/src/libtls/tls_crypto.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2014-05-16 11:57:54 +0200
committerMartin Willi <martin@revosec.ch>2014-05-16 15:42:07 +0200
commit064fe9c963b7aa0ea904ab15443198d965175461 (patch)
treebaafea8cdeb46701d996a07fa2bbb2c54fdf3458 /src/libtls/tls_crypto.c
parent9ee8b3b41f9dd24e49f4fd80c5891f134b38d161 (diff)
downloadstrongswan-064fe9c963b7aa0ea904ab15443198d965175461.tar.bz2
strongswan-064fe9c963b7aa0ea904ab15443198d965175461.tar.xz
enum: Return boolean result for enum_from_name() lookup
Handling the result for enum_from_name() is difficult, as checking for negative return values requires a cast if the enum type is unsigned. The new signature clearly differentiates lookup result from lookup value. Further, this actually allows to convert real -1 enum values, which could not be distinguished from "not-found" and the -1 return value. This also fixes several clang warnings where enums are unsigned.
Diffstat (limited to 'src/libtls/tls_crypto.c')
-rw-r--r--src/libtls/tls_crypto.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libtls/tls_crypto.c b/src/libtls/tls_crypto.c
index 4f67b20d6..2cffeb820 100644
--- a/src/libtls/tls_crypto.c
+++ b/src/libtls/tls_crypto.c
@@ -959,8 +959,8 @@ static void filter_specific_config_suites(private_tls_crypto_t *this,
enumerator = enumerator_create_token(config, ",", " ");
while (enumerator->enumerate(enumerator, &token))
{
- suite = enum_from_name(tls_cipher_suite_names, token);
- if (suite == suites[i].suite)
+ if (enum_from_name(tls_cipher_suite_names, token, &suite) &&
+ suite == suites[i].suite)
{
suites[remaining++] = suites[i];
break;