aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/crypto/pkcs7.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/crypto/pkcs7.c')
-rw-r--r--src/libstrongswan/crypto/pkcs7.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstrongswan/crypto/pkcs7.c b/src/libstrongswan/crypto/pkcs7.c
index 33ed7c92d..be4076f32 100644
--- a/src/libstrongswan/crypto/pkcs7.c
+++ b/src/libstrongswan/crypto/pkcs7.c
@@ -831,7 +831,14 @@ METHOD(pkcs7_t, build_envelopedData, bool,
/* symmetric encryption of data object */
crypter->set_key(crypter, symmetricKey);
- crypter->encrypt(crypter, in, iv, &out);
+ if (!crypter->encrypt(crypter, in, iv, &out))
+ {
+ crypter->destroy(crypter);
+ chunk_clear(&in);
+ chunk_clear(&symmetricKey);
+ chunk_free(&iv);
+ return FALSE;
+ }
crypter->destroy(crypter);
chunk_clear(&in);
DBG3(DBG_LIB, " encrypted data: %B", &out);