summaryrefslogtreecommitdiffstats
path: root/cryptodev_cipher.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-07-12 16:00:16 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-07-12 16:00:16 +0200
commit111dbe139333a0fa697d7621414f1785b078468b (patch)
tree94c1ea175a395300287b0969059efaabc9383170 /cryptodev_cipher.c
parent4f7b10f59b97b45d42577c4d6d33958d9565aef7 (diff)
downloadcryptodev-linux-111dbe139333a0fa697d7621414f1785b078468b.tar.gz
cryptodev-linux-111dbe139333a0fa697d7621414f1785b078468b.tar.xz
cryptodev-linux-111dbe139333a0fa697d7621414f1785b078468b.zip
Added signature generation and verification.
Diffstat (limited to 'cryptodev_cipher.c')
-rw-r--r--cryptodev_cipher.c16
1 files changed, 10 insertions, 6 deletions
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)