From e35abbe588636c5ca73d8aaa9082314289346bd9 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Fri, 6 Jul 2012 15:54:03 +0200 Subject: Add a return value to crypter_t.encrypt --- src/libtls/tls_protection.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/libtls/tls_protection.c') 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 */ -- cgit v1.2.3