botan: Fix memory leak on failed ICV verification if not using in-place decryption
Fixes: af26cc4d85 ("botan: Add Botan plugin to libstrongswan")
This commit is contained in:
@@ -164,6 +164,7 @@ METHOD(aead_t, decrypt, bool,
|
||||
chunk_t *plain)
|
||||
{
|
||||
u_char *out;
|
||||
bool valid;
|
||||
|
||||
if (encrypted.len < this->icv_size)
|
||||
{
|
||||
@@ -177,8 +178,13 @@ METHOD(aead_t, decrypt, bool,
|
||||
*plain = chunk_alloc(encrypted.len);
|
||||
out = plain->ptr;
|
||||
}
|
||||
return do_crypt(this, encrypted, assoc, iv, out,
|
||||
BOTAN_CIPHER_INIT_FLAG_DECRYPT);
|
||||
valid = do_crypt(this, encrypted, assoc, iv, out,
|
||||
BOTAN_CIPHER_INIT_FLAG_DECRYPT);
|
||||
if (!valid && plain)
|
||||
{
|
||||
chunk_free(plain);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
METHOD(aead_t, get_block_size, size_t,
|
||||
|
||||
Reference in New Issue
Block a user