From 111dbe139333a0fa697d7621414f1785b078468b Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Mon, 12 Jul 2010 16:00:16 +0200 Subject: Added signature generation and verification. --- cryptodev_cipher.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'cryptodev_cipher.c') diff --git a/cryptodev_cipher.c b/cryptodev_cipher.c index 0dd2f10..3ec5cd5 100644 --- a/cryptodev_cipher.c +++ b/cryptodev_cipher.c @@ -120,11 +120,13 @@ error: void cryptodev_cipher_deinit(struct cipher_data* cdata) { - crypto_free_ablkcipher(cdata->async.s); - kfree(cdata->async.result); - ablkcipher_request_free(cdata->async.request); + if (cdata->init) { + crypto_free_ablkcipher(cdata->async.s); + kfree(cdata->async.result); + ablkcipher_request_free(cdata->async.request); - cdata->init = 0; + cdata->init = 0; + } } void cryptodev_cipher_set_iv(struct cipher_data* cdata, void __user* iv, size_t iv_size) @@ -265,8 +267,10 @@ error: void cryptodev_hash_deinit(struct hash_data* hdata) { - crypto_free_ahash(hdata->async.s); - hdata->init = 0; + if (hdata->init) { + crypto_free_ahash(hdata->async.s); + hdata->init = 0; + } } int cryptodev_hash_reset( struct hash_data* hdata) -- cgit