removed status result from crypter interface to be consistent with other crypto interfaces

This commit is contained in:
Martin Willi
2008-04-22 07:14:24 +00:00
parent b638a1009f
commit 4d18175997
5 changed files with 77 additions and 171 deletions
+4 -1
View File
@@ -123,11 +123,14 @@ static err_t pem_decrypt(chunk_t *blob, encryption_algorithm_t alg, size_t key_s
/* decrypt blob */
crypter = lib->crypto->create_crypter(lib->crypto, alg, key_size);
crypter->set_key(crypter, key);
if (crypter->decrypt(crypter, *blob, *iv, &decrypted) != SUCCESS)
if (iv->len != crypter->get_block_size(crypter) ||
blob->len % iv->len)
{
crypter->destroy(crypter);
return "data size is not multiple of block size";
}
crypter->decrypt(crypter, *blob, *iv, &decrypted);
crypter->destroy(crypter);
memcpy(blob->ptr, decrypted.ptr, blob->len);
chunk_free(&decrypted);