The unified diff between revisions [8ae107f9..] and [2a00be7d..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'checks/pk.cpp'

#
#
# patch "checks/pk.cpp"
#  from [c541d866ce78834d3ac98bc6993dd79622288efe]
#    to [29d3ee1e629ecb164b57caf11f80703043ec1bbe]
#
============================================================
--- checks/pk.cpp	c541d866ce78834d3ac98bc6993dd79622288efe
+++ checks/pk.cpp	29d3ee1e629ecb164b57caf11f80703043ec1bbe
@@ -21,14 +21,14 @@
 #include <botan/numthry.h>

 #include <botan/x931_rng.h>
-#include <botan/rng.h>
+#include <botan/libstate.h>
 using namespace Botan;

 #include "common.h"

 static BigInt to_bigint(const std::string& h)
    {
-   return BigInt::decode((const byte*)h.data(),
+   return BigInt::decode(reinterpret_cast<const byte*>(h.data()),
                          h.length(), BigInt::Hexadecimal);
    }

@@ -37,6 +37,8 @@ class Fixed_Output_RNG : public RandomNu
 class Fixed_Output_RNG : public RandomNumberGenerator
    {
    public:
+      bool is_seeded() const { return true; }
+
       byte random()
          {
          if(position < output.size())
@@ -194,7 +196,7 @@ u32bit do_pk_validation_tests(const std:

    global_state().set_prng(new ANSI_X931_RNG);
    for(u32bit j = 0; j != 2; j++)
-      Global_RNG::seed(true, 384);
+      global_state().seed_prng(true, 384);

    do_pk_keygen_tests();
    do_x509_tests();
@@ -249,7 +251,7 @@ void validate_encryption(PK_Encryptor* e

    global_state().set_prng(new ANSI_X931_RNG);
    for(u32bit j = 0; j != 2; j++)
-      Global_RNG::seed(true, 384);
+      global_state().seed_prng(true, 384);

    validate_decryption(d, algo, out, message, failure);
    delete e;
@@ -290,7 +292,7 @@ void validate_signature(PK_Verifier* v,

    global_state().set_prng(new ANSI_X931_RNG);
    for(u32bit j = 0; j != 2; j++)
-      Global_RNG::seed(true, 384);
+      global_state().seed_prng(true, 384);

    delete v;
    delete s;
@@ -326,7 +328,9 @@ u32bit validate_rsa_enc_pkcs8(const std:
    strip_newlines(pass); /* it will have a newline thanks to the messy
                                 decoding method we use */

-   DataSource_Memory keysource((const byte*)str[0].c_str(), str[0].length());
+   DataSource_Memory keysource(reinterpret_cast<const byte*>(str[0].c_str()),
+                               str[0].length());
+
    Private_Key* privkey = PKCS8::load_key(keysource, pass);

    RSA_PrivateKey* rsapriv = dynamic_cast<RSA_PrivateKey*>(privkey);
@@ -441,7 +445,8 @@ u32bit validate_rsa_ver_x509(const std::
    if(str.size() != 5) /* is actually 3, parse() adds extra empty ones */
       throw Exception("Invalid input from pk_valid.dat");

-   DataSource_Memory keysource((const byte*)str[0].c_str(), str[0].length());
+   DataSource_Memory keysource(reinterpret_cast<const byte*>(str[0].c_str()),
+                               str[0].length());

    Public_Key* key = X509::load_key(keysource);

@@ -518,7 +523,9 @@ u32bit validate_dsa_sig(const std::strin
    strip_newlines(pass); /* it will have a newline thanks to the messy
                                 decoding method we use */

-   DataSource_Memory keysource((const byte*)str[0].c_str(), str[0].length());
+   DataSource_Memory keysource(reinterpret_cast<const byte*>(str[0].c_str()),
+                               str[0].length());
+
    Private_Key* privkey = PKCS8::load_key(keysource, pass);

    DSA_PrivateKey* dsapriv = dynamic_cast<DSA_PrivateKey*>(privkey);
@@ -545,7 +552,9 @@ u32bit validate_dsa_ver(const std::strin
    if(str.size() != 5) /* is actually 3, parse() adds extra empty ones */
       throw Exception("Invalid input from pk_valid.dat");

-   DataSource_Memory keysource((const byte*)str[0].c_str(), str[0].length());
+   DataSource_Memory keysource(reinterpret_cast<const byte*>(str[0].c_str()),
+                               str[0].length());
+
    Public_Key* key = X509::load_key(keysource);

    DSA_PublicKey* dsakey = dynamic_cast<DSA_PublicKey*>(key);