From: Andreas Steffen Date: Sat, 25 Dec 2010 15:11:50 +0000 (+0100) Subject: disable crypto algorithm if no key size is supported X-Git-Tag: 4.5.1~344 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d733a3babb840c8c2404d344dc3fa54b2e8284cb;p=thirdparty%2Fstrongswan.git disable crypto algorithm if no key size is supported --- diff --git a/src/libstrongswan/crypto/crypto_tester.c b/src/libstrongswan/crypto/crypto_tester.c index 9c852c054c..b4a29734a9 100644 --- a/src/libstrongswan/crypto/crypto_tester.c +++ b/src/libstrongswan/crypto/crypto_tester.c @@ -192,6 +192,7 @@ METHOD(crypto_tester_t, test_crypter, bool, DBG1(DBG_LIB, "%N[%s]: %u bit key size not supported", encryption_algorithm_names, alg, plugin_name, BITS_PER_BYTE * vector->key_size); + failed = TRUE; continue; } @@ -242,10 +243,19 @@ METHOD(crypto_tester_t, test_crypter, bool, enumerator->destroy(enumerator); if (!tested) { - DBG1(DBG_LIB, "%s %N[%s]: no test vectors found", - this->required ? "disabled" : "enabled ", - encryption_algorithm_names, alg, plugin_name); - return !this->required; + if (failed) + { + DBG1(DBG_LIB,"disable %N[%s]: no key size supported", + encryption_algorithm_names, alg, plugin_name); + return FALSE; + } + else + { + DBG1(DBG_LIB, "%s %N[%s]: no test vectors found", + this->required ? "disabled" : "enabled ", + encryption_algorithm_names, alg, plugin_name); + return !this->required; + } } if (!failed) { @@ -402,10 +412,19 @@ METHOD(crypto_tester_t, test_aead, bool, enumerator->destroy(enumerator); if (!tested) { - DBG1(DBG_LIB, "%s %N[%s]: no test vectors found", - this->required ? "disabled" : "enabled ", - encryption_algorithm_names, alg, plugin_name); - return !this->required; + if (failed) + { + DBG1(DBG_LIB,"disable %N[%s]: no key size supported", + encryption_algorithm_names, alg, plugin_name); + return FALSE; + } + else + { + DBG1(DBG_LIB, "%s %N[%s]: no test vectors found", + this->required ? "disabled" : "enabled ", + encryption_algorithm_names, alg, plugin_name); + return !this->required; + } } if (!failed) {