diff options
author | Daniel Neus <[email protected]> | 2016-07-27 14:47:06 +0200 |
---|---|---|
committer | Daniel Neus <[email protected]> | 2016-07-27 14:47:06 +0200 |
commit | 464bc8baf029d737ae594eebb064757aec51a76e (patch) | |
tree | dae719efa7ebfe584b52d9f7edd70f05d5bd2b96 /src/tests | |
parent | 55b74aac729b628f64dded8f12f9e890ed72704e (diff) |
Initialize HMAC_DRBG with token entropy
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test_pkcs11_high_level.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/tests/test_pkcs11_high_level.cpp b/src/tests/test_pkcs11_high_level.cpp index d7a3a9ca8..82610adc6 100644 --- a/src/tests/test_pkcs11_high_level.cpp +++ b/src/tests/test_pkcs11_high_level.cpp @@ -1342,21 +1342,24 @@ Test::Result test_pkcs11_hmac_drbg() Test::Result result("PKCS11 HMAC_DRBG using PKCS11_RNG"); TestSession test_session(true); - // FIXME + // FIXME: this is only a temporary fix + // It should be possible to instantiate HMAC_DRBG with PKCS11_RNG and + // HMAC_DRBG should reseed itself from PKCS11_RNG HMAC_DRBG drbg(MessageAuthenticationCode::create("HMAC(SHA-512)").release()); - //result.test_success("HMAC_DRBG(HMAC(SHA512)) instantiated with PKCS11_RNG"); + // result.test_success("HMAC_DRBG(HMAC(SHA512)) instantiated with PKCS11_RNG"); result.test_eq("HMAC_DRBG is not seeded yet.", drbg.is_seeded(), false); + PKCS11_RNG p11_rng(test_session.session()); + secure_vector<byte> rnd = p11_rng.random_vec(64); + + drbg.initialize_with(rnd.data(), rnd.size()); + result.test_eq("HMAC_DRBG is seeded now", drbg.is_seeded(), true); + std::string personalization_string = "Botan PKCS#11 Tests"; std::vector<byte> personalization_data(personalization_string.begin(), personalization_string.end()); - - // FIX ME - drbg.initialize_with( personalization_data.data(), personalization_data.size() ); drbg.add_entropy(personalization_data.data(), personalization_data.size()); - result.test_eq("HMAC_DRBG is seeded now", drbg.is_seeded(), true); - auto rnd_vec = drbg.random_vec(256); result.test_ne("HMAC_DRBG generated a random vector", rnd_vec, std::vector<byte>(256)); |