Add a return value to aead_t.encrypt()

This commit is contained in:
Martin Willi
2012-07-16 14:53:32 +02:00
parent 0f236aacb5
commit e2ed7bfd22
8 changed files with 45 additions and 17 deletions
@@ -367,7 +367,11 @@ METHOD(encryption_payload_t, encrypt, bool,
DBG3(DBG_ENC, "padding %B", &padding);
DBG3(DBG_ENC, "assoc %B", &assoc);
this->aead->encrypt(this->aead, crypt, assoc, iv, NULL);
if (!this->aead->encrypt(this->aead, crypt, assoc, iv, NULL))
{
free(assoc.ptr);
return FALSE;
}
DBG3(DBG_ENC, "encrypted %B", &crypt);
DBG3(DBG_ENC, "ICV %B", &icv);
@@ -410,7 +414,11 @@ METHOD(encryption_payload_t, encrypt_v1, bool,
DBG3(DBG_ENC, "plain %B", &plain);
DBG3(DBG_ENC, "padding %B", &padding);
this->aead->encrypt(this->aead, this->encrypted, chunk_empty, iv, NULL);
if (!this->aead->encrypt(this->aead, this->encrypted, chunk_empty, iv, NULL))
{
chunk_free(&iv);
return FALSE;
}
chunk_free(&iv);
DBG3(DBG_ENC, "encrypted %B", &this->encrypted);
+2 -1
View File
@@ -163,11 +163,12 @@ typedef struct {
} private_aead_t;
METHOD(aead_t, encrypt, void,
METHOD(aead_t, encrypt, bool,
private_aead_t *this, chunk_t plain, chunk_t assoc, chunk_t iv,
chunk_t *encrypted)
{
this->crypter->encrypt(this->crypter, plain, iv, encrypted);
return TRUE;
}
METHOD(aead_t, decrypt, bool,