diff options
author | Jack Lloyd <[email protected]> | 2016-09-04 10:04:02 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-10-07 19:27:56 -0400 |
commit | 25b6fb53eec30620d084411fb1dbc8913142fc6d (patch) | |
tree | 6ffa291a3f4a74cac23bce304a42f4c26e33bcda /src/cli | |
parent | 62cd6e3651711f759f870460599596ff5be904a5 (diff) |
Remove Algo_Registry usage from public key code.
Instead the key types exposes operations like `create_encryption_op`
which will return the relevant operation if the algorithm supports it.
Changes pubkey.h interface, now RNG is passed at init time.
Blinder previous created its own RNG, now it takes it from app.
Diffstat (limited to 'src/cli')
-rw-r--r-- | src/cli/pubkey.cpp | 4 | ||||
-rw-r--r-- | src/cli/speed.cpp | 16 | ||||
-rw-r--r-- | src/cli/x509.cpp | 2 |
3 files changed, 11 insertions, 11 deletions
diff --git a/src/cli/pubkey.cpp b/src/cli/pubkey.cpp index 456ebbc8b..7e075202c 100644 --- a/src/cli/pubkey.cpp +++ b/src/cli/pubkey.cpp @@ -179,7 +179,7 @@ class PK_Sign final : public Command const std::string sig_padding = get_arg_or("emsa", algo_default_emsa(key->algo_name())) + "(" + get_arg("hash") + ")"; - Botan::PK_Signer signer(*key, sig_padding); + Botan::PK_Signer signer(*key, rng(), sig_padding); this->read_file(get_arg("file"), [&signer](const uint8_t b[], size_t l) { signer.update(b, l); }); @@ -204,7 +204,7 @@ class PK_Verify final : public Command const std::string sig_padding = get_arg_or("emsa", algo_default_emsa(key->algo_name())) + "(" + get_arg("hash") + ")"; - Botan::PK_Verifier verifier(*key, sig_padding); + Botan::PK_Verifier verifier(*key, rng(), sig_padding); this->read_file(get_arg("file"), [&verifier](const uint8_t b[], size_t l) { verifier.update(b, l); }); diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp index bd087e8e4..8666ff4ab 100644 --- a/src/cli/speed.cpp +++ b/src/cli/speed.cpp @@ -786,8 +786,8 @@ class Speed final : public Command { std::vector<uint8_t> plaintext, ciphertext; - Botan::PK_Encryptor_EME enc(key, padding, provider); - Botan::PK_Decryptor_EME dec(key, padding, provider); + Botan::PK_Encryptor_EME enc(key, rng(), padding, provider); + Botan::PK_Decryptor_EME dec(key, rng(), padding, provider); Timer enc_timer(nm, provider, padding + " encrypt"); Timer dec_timer(nm, provider, padding + " decrypt"); @@ -823,8 +823,8 @@ class Speed final : public Command const std::string& kdf, std::chrono::milliseconds msec) { - Botan::PK_Key_Agreement ka1(key1, kdf, provider); - Botan::PK_Key_Agreement ka2(key2, kdf, provider); + Botan::PK_Key_Agreement ka1(key1, rng(), kdf, provider); + Botan::PK_Key_Agreement ka2(key2, rng(), kdf, provider); const std::vector<uint8_t> ka1_pub = key1.public_value(); const std::vector<uint8_t> ka2_pub = key2.public_value(); @@ -851,8 +851,8 @@ class Speed final : public Command const std::string& kdf, std::chrono::milliseconds msec) { - Botan::PK_KEM_Decryptor dec(key, kdf, provider); - Botan::PK_KEM_Encryptor enc(key, kdf, provider); + Botan::PK_KEM_Decryptor dec(key, rng(), kdf, provider); + Botan::PK_KEM_Encryptor enc(key, rng(), kdf, provider); Timer kem_enc_timer(nm, provider, "KEM encrypt"); Timer kem_dec_timer(nm, provider, "KEM decrypt"); @@ -888,8 +888,8 @@ class Speed final : public Command { std::vector<uint8_t> message, signature, bad_signature; - Botan::PK_Signer sig(key, padding, Botan::IEEE_1363, provider); - Botan::PK_Verifier ver(key, padding, Botan::IEEE_1363, provider); + Botan::PK_Signer sig(key, rng(), padding, Botan::IEEE_1363, provider); + Botan::PK_Verifier ver(key, rng(), padding, Botan::IEEE_1363, provider); Timer sig_timer(nm, provider, padding + " sign"); Timer ver_timer(nm, provider, padding + " verify"); diff --git a/src/cli/x509.cpp b/src/cli/x509.cpp index e65398439..25261a2d1 100644 --- a/src/cli/x509.cpp +++ b/src/cli/x509.cpp @@ -47,7 +47,7 @@ class Sign_Cert final : public Command if(!key) throw CLI_Error("Failed to load key from " + get_arg("ca_key")); - Botan::X509_CA ca(ca_cert, *key, get_arg("hash")); + Botan::X509_CA ca(ca_cert, *key, get_arg("hash"), rng()); Botan::PKCS10_Request req(get_arg("pkcs10_req")); |