ikev2: Use correct type to check for selected signature scheme

The previous code was obviously incorrect and caused strange side effects
depending on the compiler and its optimization flags (infinite looping seen
with GCC 4.8.4, segfault when destroying the private key in build() seen
with clang 4.0.0 on FreeBSD).

Fixes #2579.
This commit is contained in:
Tobias Brunner
2018-03-21 10:12:59 +01:00
parent 70d99d67d6
commit a48f3d8939
@@ -164,7 +164,7 @@ static array_t *select_signature_schemes(keymat_v2_t *keymat,
signature_scheme_t schemes[] = {
SIGN_RSA_EMSA_PKCS1_SHA2_384,
SIGN_RSA_EMSA_PKCS1_SHA2_256,
}, contained;
};
bool found;
int i, j;
@@ -174,8 +174,8 @@ static array_t *select_signature_schemes(keymat_v2_t *keymat,
found = FALSE;
for (j = 0; j < array_count(selected); j++)
{
array_get(selected, j, &contained);
if (scheme == contained)
array_get(selected, j, &config);
if (scheme == config->scheme)
{
found = TRUE;
break;