diff options
author | Jack Lloyd <[email protected]> | 2016-08-02 08:06:36 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-08-02 08:06:36 -0400 |
commit | ed5880991b5fc5be9951ab3dbe472734a990595e (patch) | |
tree | 3afe5ddabbda7001d8d93eff09108852cdcff04f /src/tests/test_pkcs11_high_level.cpp | |
parent | bca8bef636823abfb4b81fea82df943d4f4499a5 (diff) | |
parent | 71ac66b1e4e7ef88eed808c837df0bc049f946b1 (diff) |
Merge GH #559 PKCS #11 fixes
Diffstat (limited to 'src/tests/test_pkcs11_high_level.cpp')
-rw-r--r-- | src/tests/test_pkcs11_high_level.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/tests/test_pkcs11_high_level.cpp b/src/tests/test_pkcs11_high_level.cpp index 677041533..82610adc6 100644 --- a/src/tests/test_pkcs11_high_level.cpp +++ b/src/tests/test_pkcs11_high_level.cpp @@ -1342,17 +1342,24 @@ Test::Result test_pkcs11_hmac_drbg() Test::Result result("PKCS11 HMAC_DRBG using PKCS11_RNG"); TestSession test_session(true); - HMAC_DRBG drbg(MessageAuthenticationCode::create("HMAC(SHA-512)").release(), new PKCS11_RNG(test_session.session())); - result.test_success("HMAC_DRBG(HMAC(SHA512)) instantiated with PKCS11_RNG"); + // 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_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()); 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)); |