aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/prov/pkcs11/p11.h15
-rw-r--r--src/tests/test_pkcs11_high_level.cpp3
2 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/prov/pkcs11/p11.h b/src/lib/prov/pkcs11/p11.h
index 043b1795a..9afedb8c6 100644
--- a/src/lib/prov/pkcs11/p11.h
+++ b/src/lib/prov/pkcs11/p11.h
@@ -1950,11 +1950,16 @@ class BOTAN_PUBLIC_API(2,0) LowLevel
}
decrypted_data.resize(decrypted_size);
- return C_Decrypt(session,
- const_cast<Byte*>(encrypted_data.data()),
- static_cast<Ulong>(encrypted_data.size()),
- decrypted_data.data(),
- &decrypted_size, return_value);
+ if(!C_Decrypt(session,
+ const_cast<Byte*>(encrypted_data.data()),
+ static_cast<Ulong>(encrypted_data.size()),
+ decrypted_data.data(),
+ &decrypted_size, return_value))
+ {
+ return false;
+ }
+ decrypted_data.resize(decrypted_size);
+ return true;
}
/**
diff --git a/src/tests/test_pkcs11_high_level.cpp b/src/tests/test_pkcs11_high_level.cpp
index c9c34a28b..077e0240f 100644
--- a/src/tests/test_pkcs11_high_level.cpp
+++ b/src/tests/test_pkcs11_high_level.cpp
@@ -831,9 +831,6 @@ Test::Result test_rsa_encrypt_decrypt()
Botan::PK_Decryptor_EME decryptor(keypair.second, Test::rng(), padding);
auto decrypted = decryptor.decrypt(encrypted);
- // some token / middlewares do not remove the padding bytes
- decrypted.resize(plaintext.size());
-
result.test_eq("RSA PKCS11 encrypt and decrypt: " + padding, decrypted, plaintext);
};