aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-01-13 13:12:43 -0500
committerJack Lloyd <[email protected]>2018-01-13 13:12:43 -0500
commitbede26dcff12cbb528a014bed3c2da983f04f8e4 (patch)
tree1d60477d5a955266d94cd87c1aa555e66852a5d4 /src/tests
parent6b29180686c9897a87b689261ea3a86f55d809c9 (diff)
Fix return value of PK_Encryptor::maximum_input_size
Fixes GH #1410
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test_pubkey.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tests/test_pubkey.cpp b/src/tests/test_pubkey.cpp
index b3038ca0c..666650969 100644
--- a/src/tests/test_pubkey.cpp
+++ b/src/tests/test_pubkey.cpp
@@ -307,6 +307,21 @@ PK_Encryption_Decryption_Test::run_one_test(const std::string& pad_hdr, const Va
kat_rng.reset(test_rng(get_req_bin(vars, "Nonce")));
}
+ if(padding == "Raw")
+ {
+ /*
+ Hack for RSA with no padding since sometimes one more bit will fit in but maximum_input_size
+ rounds down to nearest byte
+ */
+ result.test_lte("Input within accepted bounds",
+ plaintext.size(), encryptor->maximum_input_size() + 1);
+ }
+ else
+ {
+ result.test_lte("Input within accepted bounds",
+ plaintext.size(), encryptor->maximum_input_size());
+ }
+
const std::vector<uint8_t> generated_ciphertext =
encryptor->encrypt(plaintext, kat_rng ? *kat_rng : Test::rng());