aboutsummaryrefslogtreecommitdiffstats
path: root/src/pk_keys.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-05-24 18:47:11 +0000
committerlloyd <[email protected]>2008-05-24 18:47:11 +0000
commitc4bad5476b30811ad51b1edd3bd873864d423c07 (patch)
tree94679d6cee3a38da1d64b8f5f671986566ac8a18 /src/pk_keys.cpp
parentebc67ae27481549a152858f24fff4a7a82ad4e51 (diff)
Avoid using the global RNG in check_key, instead pass a reference.
Update the examples
Diffstat (limited to 'src/pk_keys.cpp')
-rw-r--r--src/pk_keys.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/pk_keys.cpp b/src/pk_keys.cpp
index 719c5509d..8ada71133 100644
--- a/src/pk_keys.cpp
+++ b/src/pk_keys.cpp
@@ -6,6 +6,7 @@
#include <botan/pk_keys.h>
#include <botan/config.h>
#include <botan/oids.h>
+#include <botan/libstate.h>
namespace Botan {
@@ -43,7 +44,8 @@ OID Public_Key::get_oid() const
*************************************************/
void Public_Key::load_check() const
{
- if(!check_key(key_check_level("public")))
+ if(!check_key(global_state().prng_reference(),
+ key_check_level("public")))
throw Invalid_Argument(algo_name() + ": Invalid public key");
}
@@ -52,7 +54,8 @@ void Public_Key::load_check() const
*************************************************/
void Private_Key::load_check() const
{
- if(!check_key(key_check_level("private")))
+ if(!check_key(global_state().prng_reference(),
+ key_check_level("private")))
throw Invalid_Argument(algo_name() + ": Invalid private key");
}
@@ -61,7 +64,8 @@ void Private_Key::load_check() const
*************************************************/
void Private_Key::gen_check() const
{
- if(!check_key(key_check_level("private_gen")))
+ if(!check_key(global_state().prng_reference(),
+ key_check_level("private_gen")))
throw Self_Test_Failure(algo_name() + " private key generation failed");
}