diff options
author | Jack Lloyd <[email protected]> | 2017-09-16 14:00:17 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-16 14:04:47 -0400 |
commit | 6123db0a94f38f218bfdf61409b52ca23c28545b (patch) | |
tree | d7d62a1b429f7d783bdef8969853e279754c52a0 /src/tests/test_pubkey.cpp | |
parent | e3f2528713840b128ab7645ef826f331ad7cbb29 (diff) |
Support PSSR_Raw
Allows PSS-signing a raw hash while also still specifying the salt
length.
GH #1211
Diffstat (limited to 'src/tests/test_pubkey.cpp')
-rw-r--r-- | src/tests/test_pubkey.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/tests/test_pubkey.cpp b/src/tests/test_pubkey.cpp index 4bb4ea9b1..bbaa444f0 100644 --- a/src/tests/test_pubkey.cpp +++ b/src/tests/test_pubkey.cpp @@ -83,17 +83,25 @@ void check_invalid_ciphertexts(Test::Result& result, " invalid ciphertexts, rejected " + std::to_string(ciphertext_rejected)); } +std::string PK_Test::choose_padding(const VarMap& vars, + const std::string& pad_hdr) + { + if(pad_hdr != "") + return pad_hdr; + return get_opt_str(vars, "Padding", this->default_padding(vars)); + } + std::vector<std::string> PK_Test::possible_providers(const std::string& /*params*/) { return Test::provider_filter({ "base", "bearssl", "openssl", "tpm" }); } Test::Result -PK_Signature_Generation_Test::run_one_test(const std::string&, const VarMap& vars) +PK_Signature_Generation_Test::run_one_test(const std::string& pad_hdr, const VarMap& vars) { const std::vector<uint8_t> message = get_req_bin(vars, "Msg"); const std::vector<uint8_t> signature = get_req_bin(vars, "Signature"); - const std::string padding = get_opt_str(vars, "Padding", default_padding(vars)); + const std::string padding = choose_padding(vars, pad_hdr); Test::Result result(algo_name() + "/" + padding + " signature generation"); @@ -177,11 +185,12 @@ PK_Signature_Generation_Test::run_one_test(const std::string&, const VarMap& var } Test::Result -PK_Signature_Verification_Test::run_one_test(const std::string&, const VarMap& vars) +PK_Signature_Verification_Test::run_one_test(const std::string& pad_hdr, const VarMap& vars) { const std::vector<uint8_t> message = get_req_bin(vars, "Msg"); const std::vector<uint8_t> signature = get_req_bin(vars, "Signature"); - const std::string padding = get_opt_str(vars, "Padding", default_padding(vars)); + const std::string padding = choose_padding(vars, pad_hdr); + std::unique_ptr<Botan::Public_Key> pubkey = load_public_key(vars); Test::Result result(algo_name() + "/" + padding + " signature verification"); @@ -206,9 +215,9 @@ PK_Signature_Verification_Test::run_one_test(const std::string&, const VarMap& v } Test::Result -PK_Signature_NonVerification_Test::run_one_test(const std::string&, const VarMap& vars) +PK_Signature_NonVerification_Test::run_one_test(const std::string& pad_hdr, const VarMap& vars) { - const std::string padding = get_opt_str(vars, "Padding", default_padding(vars)); + const std::string padding = choose_padding(vars, pad_hdr); const std::vector<uint8_t> message = get_req_bin(vars, "Msg"); std::unique_ptr<Botan::Public_Key> pubkey = load_public_key(vars); @@ -235,12 +244,11 @@ PK_Signature_NonVerification_Test::run_one_test(const std::string&, const VarMap } Test::Result -PK_Encryption_Decryption_Test::run_one_test(const std::string&, const VarMap& vars) +PK_Encryption_Decryption_Test::run_one_test(const std::string& pad_hdr, const VarMap& vars) { const std::vector<uint8_t> plaintext = get_req_bin(vars, "Msg"); const std::vector<uint8_t> ciphertext = get_req_bin(vars, "Ciphertext"); - - const std::string padding = get_opt_str(vars, "Padding", default_padding(vars)); + const std::string padding = choose_padding(vars, pad_hdr); Test::Result result(algo_name() + (padding.empty() ? padding : "/" + padding) + " decryption"); |