aboutsummaryrefslogtreecommitdiffstats
path: root/src/libtls/tls_protection.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2012-07-06 15:54:03 +0200
committerMartin Willi <martin@revosec.ch>2012-07-16 14:53:37 +0200
commite35abbe588636c5ca73d8aaa9082314289346bd9 (patch)
treeeece22634e08ca1ada844d640bb8d8c2d086e61a /src/libtls/tls_protection.c
parentc3858662d2d1d431bdb453f2b50e63d9c2c5bfad (diff)
downloadstrongswan-e35abbe588636c5ca73d8aaa9082314289346bd9.tar.bz2
strongswan-e35abbe588636c5ca73d8aaa9082314289346bd9.tar.xz
Add a return value to crypter_t.encrypt
Diffstat (limited to 'src/libtls/tls_protection.c')
-rw-r--r--src/libtls/tls_protection.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libtls/tls_protection.c b/src/libtls/tls_protection.c
index a92e902e5..abcc42064 100644
--- a/src/libtls/tls_protection.c
+++ b/src/libtls/tls_protection.c
@@ -256,7 +256,16 @@ METHOD(tls_protection_t, build, status_t,
*data = chunk_cat("mmcc", *data, mac, padding,
chunk_from_thing(padding_length));
/* encrypt inline */
- this->crypter_out->encrypt(this->crypter_out, *data, iv, NULL);
+ if (!this->crypter_out->encrypt(this->crypter_out, *data,
+ iv, NULL))
+ {
+ if (!this->iv_out.len)
+ {
+ free(iv.ptr);
+ }
+ free(data->ptr);
+ return FAILED;
+ }
if (this->iv_out.len)
{ /* next record IV is last ciphertext block of this record */