{
bio_reader_t *reader;
uint32_t spi, seq;
- chunk_t data, iv, icv, aad, ciphertext, plaintext;
+ chunk_t data, iv, icv, aad, ciphertext, plaintext = chunk_empty;
aead_t *aead;
DESTROY_IF(this->payload);
reader->remaining(reader) % aead->get_block_size(aead))
{
DBG1(DBG_ESP, "ESP decryption failed: invalid length");
+ reader->destroy(reader);
return PARSE_ERROR;
}
ciphertext = reader->peek(reader);
if (!aead->decrypt(aead, ciphertext, aad, iv, &plaintext))
{
DBG1(DBG_ESP, "ESP decryption or ICV verification failed");
+ chunk_free(&plaintext);
return FAILED;
}
esp_context->set_authenticated_seqno(esp_context, seq);