unit-tests: test supported ECDSA schemes only
authorMartin Willi <martin@revosec.ch>
Wed, 19 Jun 2013 13:31:25 +0000 (15:31 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 21 Jun 2013 08:53:22 +0000 (10:53 +0200)
src/libstrongswan/tests/test_ecdsa.c

index 7ab8b63..2955bae 100644 (file)
@@ -15,6 +15,8 @@
 
 #include "test_suite.h"
 
+#include <plugins/plugin_feature.h>
+
 /**
  * Signature schemes to test
  */
@@ -43,6 +45,13 @@ static void test_good_sig(private_key_t *privkey, public_key_t *pubkey)
 
        for (i = 0; i < countof(schemes); i++)
        {
+               if (!lib->plugins->has_feature(lib->plugins,
+                                               PLUGIN_PROVIDE(PUBKEY_VERIFY, schemes[i].scheme)) ||
+                       !lib->plugins->has_feature(lib->plugins,
+                                               PLUGIN_PROVIDE(PRIVKEY_SIGN, schemes[i].scheme)))
+               {
+                       continue;
+               }
                if (schemes[i].key_size != 0 &&
                        schemes[i].scheme != privkey->get_keysize(privkey))
                {
@@ -104,6 +113,11 @@ static void test_bad_sigs(public_key_t *pubkey)
                {
                        continue;
                }
+               if (!lib->plugins->has_feature(lib->plugins,
+                                               PLUGIN_PROVIDE(PUBKEY_VERIFY, schemes[s].scheme)))
+               {
+                       continue;
+               }
                for (i = 0; i < countof(invalid_sigs); i++)
                {
                        fail_if(