3 #ifndef CRYPTODEV_INT_H
4 # define CRYPTODEV_INT_H
6 #include <linux/init.h>
7 #include <linux/sched.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...) \
18 if (level <= cryptodev_verbosity) \
19 printk(severity PFX "%s[%u]: " format, \
20 current->comm, current->pid, \
24 extern int cryptodev_verbosity
;
28 int init
; /* 0 uninitialized */
32 struct crypto_ablkcipher
* s
;
33 struct cryptodev_result
*result
;
34 struct ablkcipher_request
*request
;
35 uint8_t iv
[EALG_MAX_BLOCK_LEN
];
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
);
48 int init
; /* 0 uninitialized */
51 struct crypto_ahash
*s
;
52 struct cryptodev_result
*result
;
53 struct ahash_request
*request
;
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 */