diff options
author | lloyd <[email protected]> | 2015-03-22 05:42:10 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2015-03-22 05:42:10 +0000 |
commit | 874851b398c95f320c9005f9da9558db9efb9194 (patch) | |
tree | 4cc8d6b25ec0af3e08b470c6b9995996afb0531e | |
parent | b01ce65e09e50ec624bdbf62bf2c1433f0d6f637 (diff) |
Fix rare test failure in pubkey.
The pubkey encrypt/decrypt test function tests various randomly corrupted
ciphertexts to ensure none of them decrypt. On rare occasions PKCS #1 v1.5 does
legitimately fail this test, but, well, PKCS v1.5 isn't a very good padding
scheme. When this test fails and the pad is PKCS, log the values but don't
actually fail the test since this is an expected behavior of PKCS padding.
-rw-r--r-- | src/tests/test_pubkey.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tests/test_pubkey.cpp b/src/tests/test_pubkey.cpp index a05760fd2..7d96d3a14 100644 --- a/src/tests/test_pubkey.cpp +++ b/src/tests/test_pubkey.cpp @@ -209,7 +209,10 @@ size_t validate_encryption(PK_Encryptor& e, PK_Decryptor& d, std::cout << algo << " failed - decrypted bad data\n"; std::cout << hex_encode(bad_ctext) << " -> " << hex_encode(bad_ptext) << "\n"; std::cout << hex_encode(ctext) << " -> " << hex_encode(decrypted) << "\n"; - ++fails; + + // Ignore PKCS #1 failures as they do occur occasionally (million message attack) + if(algo.find("/EME-PKCS1-v1_5") != std::string::npos) + ++fails; } catch(...) {} } |