summaryrefslogtreecommitdiffstats
path: root/cryptodev_cipher.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-06-15 14:30:06 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-06-17 20:49:04 +0200
commit780a3de303e5cf7534123aa8a9518ed74537659b (patch)
tree870c8cb0269db147811775514baa684fd5ccdbcf /cryptodev_cipher.c
parentb8444429562c8eda11c9c72f180092fa6841213f (diff)
downloadcryptodev-linux-780a3de303e5cf7534123aa8a9518ed74537659b.tar.gz
cryptodev-linux-780a3de303e5cf7534123aa8a9518ed74537659b.tar.xz
cryptodev-linux-780a3de303e5cf7534123aa8a9518ed74537659b.zip
Added generic sessions to allow encryption/decryption hash and HMAC.
Removed the ncr-cipher.c.
Diffstat (limited to 'cryptodev_cipher.c')
-rw-r--r--cryptodev_cipher.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/cryptodev_cipher.c b/cryptodev_cipher.c
index 7c1db6a..58fcba2 100644
--- a/cryptodev_cipher.c
+++ b/cryptodev_cipher.c
@@ -159,6 +159,30 @@ static inline int waitfor (struct cryptodev_result* cr, ssize_t ret)
return 0;
}
+
+int _cryptodev_cipher_encrypt(struct cipher_data* cdata, const void* plaintext,
+ size_t plaintext_size, void* ciphertext, size_t ciphertext_size)
+{
+struct scatterlist sg, sg2;
+
+ sg_init_one(&sg, plaintext, plaintext_size);
+ sg_init_one(&sg2, ciphertext, ciphertext_size);
+
+ return cryptodev_cipher_encrypt( cdata, &sg, &sg2, plaintext_size);
+}
+
+int _cryptodev_cipher_decrypt(struct cipher_data* cdata, const void* ciphertext,
+ size_t ciphertext_size, void* plaintext, size_t plaintext_size)
+{
+struct scatterlist sg, sg2;
+
+ sg_init_one(&sg, ciphertext, ciphertext_size);
+ sg_init_one(&sg2, plaintext, plaintext_size);
+
+ return cryptodev_cipher_encrypt( cdata, &sg, &sg2, ciphertext_size);
+}
+
+
ssize_t cryptodev_cipher_encrypt( struct cipher_data* cdata, struct scatterlist *sg1, struct scatterlist *sg2, size_t len)
{
int ret;
@@ -272,6 +296,14 @@ ssize_t cryptodev_hash_update( struct hash_data* hdata, struct scatterlist *sg,
return waitfor(hdata->async.result,ret);
}
+ssize_t _cryptodev_hash_update( struct hash_data* hdata, const void* data, size_t len)
+{
+struct scatterlist sg;
+
+ sg_init_one(&sg, data, len);
+
+ return cryptodev_hash_update( hdata, &sg, len);
+}
int cryptodev_hash_final( struct hash_data* hdata, void* output)
{