]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
rdrand: Provide get_features() regardless of RDRAND availability
authorMartin Willi <martin@revosec.ch>
Mon, 10 Feb 2014 10:21:09 +0000 (11:21 +0100)
committerMartin Willi <martin@revosec.ch>
Mon, 10 Feb 2014 10:22:16 +0000 (11:22 +0100)
As having no get_features() raises a deprecated warning, we return no features
instead.

src/libstrongswan/plugins/rdrand/rdrand_plugin.c

index bb540648d733eac0e7ceaf442edcd3403bc77734..b416c872f7ff57b81b7a5ab8098f83b48afc70d5 100644 (file)
@@ -102,7 +102,11 @@ METHOD(plugin_t, get_features, int,
                                PLUGIN_DEPENDS(CRYPTER, ENCR_AES_CBC, 16),
        };
        *features = f;
-       return countof(f);
+       if (have_rdrand())
+       {
+               return countof(f);
+       }
+       return 0;
 }
 
 METHOD(plugin_t, destroy, void,
@@ -122,16 +126,12 @@ plugin_t *rdrand_plugin_create()
                .public = {
                        .plugin = {
                                .get_name = _get_name,
+                               .get_features = _get_features,
                                .reload = (void*)return_false,
                                .destroy = _destroy,
                        },
                },
        );
 
-       if (have_rdrand())
-       {
-               this->public.plugin.get_features = _get_features;
-       }
-
        return &this->public.plugin;
 }