summaryrefslogtreecommitdiff
path: root/src/libstrongswan/plugins/rdrand/rdrand_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/plugins/rdrand/rdrand_plugin.c')
-rw-r--r--src/libstrongswan/plugins/rdrand/rdrand_plugin.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstrongswan/plugins/rdrand/rdrand_plugin.c b/src/libstrongswan/plugins/rdrand/rdrand_plugin.c
index 4bdfc258e..b416c872f 100644
--- a/src/libstrongswan/plugins/rdrand/rdrand_plugin.c
+++ b/src/libstrongswan/plugins/rdrand/rdrand_plugin.c
@@ -77,11 +77,11 @@ static bool have_rdrand()
cpuid(1, &a, &b, &c, &d);
if (c & CPUID_RDRAND)
{
- DBG1(DBG_LIB, "detected RDRAND support on %s CPU", vendor);
+ DBG2(DBG_LIB, "detected RDRAND support on %s CPU", vendor);
return TRUE;
}
}
- DBG1(DBG_LIB, "no RDRAND support on %s CPU, disabled", vendor);
+ DBG2(DBG_LIB, "no RDRAND support on %s CPU, disabled", vendor);
return FALSE;
}
@@ -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;
}