Add strongswan.conf runtime options for /dev/[u]random files
authorMartin Willi <martin@revosec.ch>
Mon, 10 Sep 2012 14:47:36 +0000 (16:47 +0200)
committerMartin Willi <martin@revosec.ch>
Mon, 10 Sep 2012 15:07:51 +0000 (17:07 +0200)
Fixes #221.

src/libstrongswan/plugins/random/random_plugin.c

index 418eeae..cef2004 100644 (file)
@@ -119,6 +119,7 @@ METHOD(plugin_t, destroy, void,
 plugin_t *random_plugin_create()
 {
        private_random_plugin_t *this;
+       char *urandom_file, *random_file;
 
        INIT(this,
                .public = {
@@ -130,8 +131,12 @@ plugin_t *random_plugin_create()
                },
        );
 
-       if (!open_dev(DEV_URANDOM, &dev_urandom) ||
-               !open_dev(DEV_RANDOM, &dev_random))
+       urandom_file = lib->settings->get_str(lib->settings,
+                                               "libstrongswan.plugins.random.urandom", DEV_URANDOM);
+       random_file = lib->settings->get_str(lib->settings,
+                                               "libstrongswan.plugins.random.random", DEV_RANDOM);
+       if (!open_dev(urandom_file, &dev_urandom) ||
+               !open_dev(random_file, &dev_random))
        {
                destroy(this);
                return NULL;