Added openssl patch.
[cryptodev-linux.git] / cryptodev_int.h
blob19cd6a3363c8493f1030aceba6aa2bd082dc5a52
1 /* cipher stuff */
3 #ifndef CRYPTODEV_INT_H
4 # define CRYPTODEV_INT_H
6 #include <linux/init.h>
7 #include <linux/sched.h>
8 #include <linux/fs.h>
9 #include <linux/file.h>
10 #include <linux/fdtable.h>
11 #include <linux/miscdevice.h>
12 #include <linux/module.h>
13 #include <linux/moduleparam.h>
15 #define PFX "cryptodev: "
16 #define dprintk(level,severity,format,a...) \
17 do { \
18 if (level <= cryptodev_verbosity) \
19 printk(severity PFX "%s[%u]: " format, \
20 current->comm, current->pid, \
21 ##a); \
22 } while (0)
24 extern int cryptodev_verbosity;
26 struct cipher_data
28 int init; /* 0 uninitialized */
29 int blocksize;
30 int ivsize;
31 struct {
32 struct crypto_ablkcipher* s;
33 struct cryptodev_result *result;
34 struct ablkcipher_request *request;
35 uint8_t iv[EALG_MAX_BLOCK_LEN];
36 } async;
39 int cryptodev_cipher_init(struct cipher_data* out, const char* alg_name, __user uint8_t * key, size_t keylen);
40 void cryptodev_cipher_deinit(struct cipher_data* cdata);
41 ssize_t cryptodev_cipher_decrypt( struct cipher_data* cdata, struct scatterlist *sg1, struct scatterlist *sg2, size_t len);
42 ssize_t cryptodev_cipher_encrypt( struct cipher_data* cdata, struct scatterlist *sg1, struct scatterlist *sg2, size_t len);
43 void cryptodev_cipher_set_iv(struct cipher_data* cdata, void* iv, size_t iv_size);
45 /* hash stuff */
46 struct hash_data
48 int init; /* 0 uninitialized */
49 int digestsize;
50 struct {
51 struct crypto_ahash *s;
52 struct cryptodev_result *result;
53 struct ahash_request *request;
54 } async;
57 int cryptodev_hash_final( struct hash_data* hdata, void* output);
58 ssize_t cryptodev_hash_update( struct hash_data* hdata, struct scatterlist *sg, size_t len);
59 int cryptodev_hash_reset( struct hash_data* hdata);
60 void cryptodev_hash_deinit(struct hash_data* hdata);
61 int cryptodev_hash_init( struct hash_data* hdata, const char* alg_name, int hmac_mode, __user void* mackey, size_t mackeylen);
63 #endif /* CRYPTODEV_INT_H */