Add a return value to crypter_t.decrypt()
This commit is contained in:
@@ -70,20 +70,20 @@ static bool set_iv(private_gcrypt_crypter_t *this, chunk_t iv)
|
||||
return gcry_cipher_setiv(this->h, iv.ptr, iv.len) == 0;
|
||||
}
|
||||
|
||||
METHOD(crypter_t, decrypt, void,
|
||||
METHOD(crypter_t, decrypt, bool,
|
||||
private_gcrypt_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *dst)
|
||||
{
|
||||
set_iv(this, iv);
|
||||
|
||||
if (!set_iv(this, iv))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (dst)
|
||||
{
|
||||
*dst = chunk_alloc(data.len);
|
||||
gcry_cipher_decrypt(this->h, dst->ptr, dst->len, data.ptr, data.len);
|
||||
}
|
||||
else
|
||||
{
|
||||
gcry_cipher_decrypt(this->h, data.ptr, data.len, NULL, 0);
|
||||
return gcry_cipher_decrypt(this->h, dst->ptr, dst->len,
|
||||
data.ptr, data.len) == 0;
|
||||
}
|
||||
return gcry_cipher_decrypt(this->h, data.ptr, data.len, NULL, 0) == 0;
|
||||
}
|
||||
|
||||
METHOD(crypter_t, encrypt, bool,
|
||||
|
||||
Reference in New Issue
Block a user