aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2021-04-04 11:21:26 -0400
committerJack Lloyd <[email protected]>2021-04-04 11:21:26 -0400
commitc5eafc0986235c694036abb56689a300fa28caed (patch)
treea5c0090863ad7936061ab44ba10fd31d38bffeb6
parentb299484a2886dc2f400f4459d53456d13d380eb5 (diff)
Add some extra logic to try to figure out PKCS11 RSA test failures
This occasionally fails in CI and it's not clear what is happening.
-rw-r--r--src/tests/test_pkcs11_high_level.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/tests/test_pkcs11_high_level.cpp b/src/tests/test_pkcs11_high_level.cpp
index 2e87af69d..1aa08ad58 100644
--- a/src/tests/test_pkcs11_high_level.cpp
+++ b/src/tests/test_pkcs11_high_level.cpp
@@ -806,13 +806,20 @@ Test::Result test_rsa_encrypt_decrypt()
auto encrypt_and_decrypt = [&keypair, &result](const std::vector<uint8_t>& plaintext, const std::string& padding)
{
- Botan::PK_Encryptor_EME encryptor(keypair.first, Test::rng(), padding);
- auto encrypted = encryptor.encrypt(plaintext, Test::rng());
+ try
+ {
+ Botan::PK_Encryptor_EME encryptor(keypair.first, Test::rng(), padding);
+ auto encrypted = encryptor.encrypt(plaintext, Test::rng());
- Botan::PK_Decryptor_EME decryptor(keypair.second, Test::rng(), padding);
- auto decrypted = decryptor.decrypt(encrypted);
+ Botan::PK_Decryptor_EME decryptor(keypair.second, Test::rng(), padding);
+ auto decrypted = decryptor.decrypt(encrypted);
- result.test_eq("RSA PKCS11 encrypt and decrypt: " + padding, decrypted, plaintext);
+ result.test_eq("RSA PKCS11 encrypt and decrypt: " + padding, decrypted, plaintext);
+ }
+ catch(Botan::PKCS11::PKCS11_ReturnError& e)
+ {
+ result.test_failure("PKCS11 RSA " + padding, e.what());
+ }
};
std::vector<uint8_t> plaintext(256);