diff options
author | Daniel Wyatt <[email protected]> | 2019-05-27 19:55:13 -0400 |
---|---|---|
committer | Daniel Wyatt <[email protected]> | 2019-05-27 19:55:13 -0400 |
commit | f35047d702031d2972b60955c84023656af431b9 (patch) | |
tree | a2c86e2ac238ce0816f3b395718e2ef6c3ea4fef /src/lib/prov | |
parent | a82fdf2fcec9f44c7ea06b8d903e57041ae3e873 (diff) |
Fix PKCS#11 C_Encrypt output size.
Diffstat (limited to 'src/lib/prov')
-rw-r--r-- | src/lib/prov/pkcs11/p11.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/prov/pkcs11/p11.h b/src/lib/prov/pkcs11/p11.h index 9afedb8c6..4cf1f0071 100644 --- a/src/lib/prov/pkcs11/p11.h +++ b/src/lib/prov/pkcs11/p11.h @@ -1817,11 +1817,16 @@ class BOTAN_PUBLIC_API(2,0) LowLevel } encrypted_data.resize(encrypted_size); - return C_Encrypt(session, + if (!C_Encrypt(session, const_cast<Byte*>(plaintext_data.data()), static_cast<Ulong>(plaintext_data.size()), encrypted_data.data(), - &encrypted_size, return_value); + &encrypted_size, return_value)) + { + return false; + } + encrypted_data.resize(encrypted_size); + return true; } /** |