Implemented libstrongswan.plugins.random.strong_equals_true option
This commit is contained in:
@@ -905,6 +905,10 @@ File to read random bytes from, instead of @random_device@
|
|||||||
.BR libstrongswan.plugins.random.urandom " [@urandom_device@]"
|
.BR libstrongswan.plugins.random.urandom " [@urandom_device@]"
|
||||||
File to read pseudo random bytes from, instead of @urandom_device@
|
File to read pseudo random bytes from, instead of @urandom_device@
|
||||||
.TP
|
.TP
|
||||||
|
.BR libstrongswan.plugins.random.strong_equals_true " [no]"
|
||||||
|
If set to yes the RNG_STRONG class reads random bytes from the same source as
|
||||||
|
the RNG_TRUE class.
|
||||||
|
.TP
|
||||||
.BR libstrongswan.plugins.unbound.resolv_conf " [/etc/resolv.conf]"
|
.BR libstrongswan.plugins.unbound.resolv_conf " [/etc/resolv.conf]"
|
||||||
File to read DNS resolver configuration from
|
File to read DNS resolver configuration from
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ static int dev_random = -1;
|
|||||||
/** /dev/urandom file descriptor */
|
/** /dev/urandom file descriptor */
|
||||||
static int dev_urandom = -1;
|
static int dev_urandom = -1;
|
||||||
|
|
||||||
|
/** Is strong randomness equivalent to true randomness? */
|
||||||
|
static bool strong_equals_true = FALSE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See header.
|
* See header.
|
||||||
*/
|
*/
|
||||||
@@ -67,6 +70,14 @@ int random_plugin_get_dev_urandom()
|
|||||||
return dev_urandom;
|
return dev_urandom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See header.
|
||||||
|
*/
|
||||||
|
bool random_plugin_get_strong_equals_true()
|
||||||
|
{
|
||||||
|
return strong_equals_true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a random device file
|
* Open a random device file
|
||||||
*/
|
*/
|
||||||
@@ -131,6 +142,8 @@ plugin_t *random_plugin_create()
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
strong_equals_true = lib->settings->get_bool(lib->settings,
|
||||||
|
"libstrongswan.plugins.random.strong_equals_true", FALSE);
|
||||||
urandom_file = lib->settings->get_str(lib->settings,
|
urandom_file = lib->settings->get_str(lib->settings,
|
||||||
"libstrongswan.plugins.random.urandom", DEV_URANDOM);
|
"libstrongswan.plugins.random.urandom", DEV_URANDOM);
|
||||||
random_file = lib->settings->get_str(lib->settings,
|
random_file = lib->settings->get_str(lib->settings,
|
||||||
|
|||||||
@@ -49,4 +49,9 @@ int random_plugin_get_dev_random();
|
|||||||
*/
|
*/
|
||||||
int random_plugin_get_dev_urandom();
|
int random_plugin_get_dev_urandom();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Must strong randomness be equivalent to true randomness?
|
||||||
|
*/
|
||||||
|
bool random_plugin_get_strong_equals_true();
|
||||||
|
|
||||||
#endif /** RANDOM_PLUGIN_H_ @}*/
|
#endif /** RANDOM_PLUGIN_H_ @}*/
|
||||||
|
|||||||
@@ -99,6 +99,10 @@ random_rng_t *random_rng_create(rng_quality_t quality)
|
|||||||
this->fd = random_plugin_get_dev_random();
|
this->fd = random_plugin_get_dev_random();
|
||||||
break;
|
break;
|
||||||
case RNG_STRONG:
|
case RNG_STRONG:
|
||||||
|
this->fd = random_plugin_get_strong_equals_true() ?
|
||||||
|
random_plugin_get_dev_random() :
|
||||||
|
random_plugin_get_dev_urandom();
|
||||||
|
break;
|
||||||
case RNG_WEAK:
|
case RNG_WEAK:
|
||||||
default:
|
default:
|
||||||
this->fd = random_plugin_get_dev_urandom();
|
this->fd = random_plugin_get_dev_urandom();
|
||||||
|
|||||||
Reference in New Issue
Block a user