aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/dh.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 /doc/examples/dh.cpp
parentebc67ae27481549a152858f24fff4a7a82ad4e51 (diff)
Avoid using the global RNG in check_key, instead pass a reference.
Update the examples
Diffstat (limited to 'doc/examples/dh.cpp')
-rw-r--r--doc/examples/dh.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/examples/dh.cpp b/doc/examples/dh.cpp
index 17dd29f56..c8e13dbb4 100644
--- a/doc/examples/dh.cpp
+++ b/doc/examples/dh.cpp
@@ -7,6 +7,7 @@
*/
#include <botan/botan.h>
#include <botan/dh.h>
+#include <botan/libstate.h>
using namespace Botan;
#include <iostream>
@@ -15,11 +16,13 @@ int main()
{
try {
// Alice creates a DH key and sends (the public part) to Bob
- DH_PrivateKey private_a(DL_Group("modp/ietf/1024"));
+ DH_PrivateKey private_a(DL_Group("modp/ietf/1024"),
+ global_state().prng_reference());
DH_PublicKey public_a = private_a; // Bob gets this
// Bob creates a key with a matching group
- DH_PrivateKey private_b(public_a.get_domain());
+ DH_PrivateKey private_b(public_a.get_domain(),
+ global_state().prng_reference());
// Bob sends the key back to Alice
DH_PublicKey public_b = private_b; // Alice gets this