summaryrefslogtreecommitdiff
path: root/src/libstrongswan/plugins/random/random_plugin.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2014-03-11 20:48:48 +0100
committerYves-Alexis Perez <corsac@debian.org>2014-03-11 20:48:48 +0100
commit15fb7904f4431a6e7c305fd08732458f7f885e7e (patch)
treec93b60ee813af70509f00f34e29ebec311762427 /src/libstrongswan/plugins/random/random_plugin.c
parent5313d2d78ca150515f7f5eb39801c100690b6b29 (diff)
downloadvyos-strongswan-15fb7904f4431a6e7c305fd08732458f7f885e7e.tar.gz
vyos-strongswan-15fb7904f4431a6e7c305fd08732458f7f885e7e.zip
Imported Upstream version 5.1.2
Diffstat (limited to 'src/libstrongswan/plugins/random/random_plugin.c')
-rw-r--r--src/libstrongswan/plugins/random/random_plugin.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/libstrongswan/plugins/random/random_plugin.c b/src/libstrongswan/plugins/random/random_plugin.c
index 24c711a69..1f1079240 100644
--- a/src/libstrongswan/plugins/random/random_plugin.c
+++ b/src/libstrongswan/plugins/random/random_plugin.c
@@ -51,6 +51,9 @@ static int dev_random = -1;
/** /dev/urandom file descriptor */
static int dev_urandom = -1;
+/** Is strong randomness equivalent to true randomness? */
+static bool strong_equals_true = FALSE;
+
/**
* See header.
*/
@@ -68,6 +71,14 @@ int random_plugin_get_dev_urandom()
}
/**
+ * See header.
+ */
+bool random_plugin_get_strong_equals_true()
+{
+ return strong_equals_true;
+}
+
+/**
* Open a random device file
*/
static bool open_dev(char *file, int *fd)
@@ -131,10 +142,12 @@ plugin_t *random_plugin_create()
},
);
+ strong_equals_true = lib->settings->get_bool(lib->settings,
+ "%s.plugins.random.strong_equals_true", FALSE, lib->ns);
urandom_file = lib->settings->get_str(lib->settings,
- "libstrongswan.plugins.random.urandom", DEV_URANDOM);
+ "%s.plugins.random.urandom", DEV_URANDOM, lib->ns);
random_file = lib->settings->get_str(lib->settings,
- "libstrongswan.plugins.random.random", DEV_RANDOM);
+ "%s.plugins.random.random", DEV_RANDOM, lib->ns);
if (!open_dev(urandom_file, &dev_urandom) ||
!open_dev(random_file, &dev_random))
{