aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/crypto.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 67830e7c2c31..0ec2467891db 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -93,6 +93,7 @@ struct crypto_ablkcipher;
93struct crypto_async_request; 93struct crypto_async_request;
94struct crypto_blkcipher; 94struct crypto_blkcipher;
95struct crypto_hash; 95struct crypto_hash;
96struct crypto_queue;
96struct crypto_tfm; 97struct crypto_tfm;
97struct crypto_type; 98struct crypto_type;
98 99
@@ -143,6 +144,19 @@ struct hash_desc {
143 * Algorithms: modular crypto algorithm implementations, managed 144 * Algorithms: modular crypto algorithm implementations, managed
144 * via crypto_register_alg() and crypto_unregister_alg(). 145 * via crypto_register_alg() and crypto_unregister_alg().
145 */ 146 */
147struct ablkcipher_alg {
148 int (*setkey)(struct crypto_ablkcipher *tfm, const u8 *key,
149 unsigned int keylen);
150 int (*encrypt)(struct ablkcipher_request *req);
151 int (*decrypt)(struct ablkcipher_request *req);
152
153 struct crypto_queue *queue;
154
155 unsigned int min_keysize;
156 unsigned int max_keysize;
157 unsigned int ivsize;
158};
159
146struct blkcipher_alg { 160struct blkcipher_alg {
147 int (*setkey)(struct crypto_tfm *tfm, const u8 *key, 161 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
148 unsigned int keylen); 162 unsigned int keylen);
@@ -197,6 +211,7 @@ struct compress_alg {
197 unsigned int slen, u8 *dst, unsigned int *dlen); 211 unsigned int slen, u8 *dst, unsigned int *dlen);
198}; 212};
199 213
214#define cra_ablkcipher cra_u.ablkcipher
200#define cra_blkcipher cra_u.blkcipher 215#define cra_blkcipher cra_u.blkcipher
201#define cra_cipher cra_u.cipher 216#define cra_cipher cra_u.cipher
202#define cra_digest cra_u.digest 217#define cra_digest cra_u.digest
@@ -221,6 +236,7 @@ struct crypto_alg {
221 const struct crypto_type *cra_type; 236 const struct crypto_type *cra_type;
222 237
223 union { 238 union {
239 struct ablkcipher_alg ablkcipher;
224 struct blkcipher_alg blkcipher; 240 struct blkcipher_alg blkcipher;
225 struct cipher_alg cipher; 241 struct cipher_alg cipher;
226 struct digest_alg digest; 242 struct digest_alg digest;
@@ -572,6 +588,12 @@ static inline int crypto_ablkcipher_reqsize(struct crypto_ablkcipher *tfm)
572 return crypto_ablkcipher_crt(tfm)->reqsize; 588 return crypto_ablkcipher_crt(tfm)->reqsize;
573} 589}
574 590
591static inline struct ablkcipher_request *ablkcipher_request_cast(
592 struct crypto_async_request *req)
593{
594 return container_of(req, struct ablkcipher_request, base);
595}
596
575static inline struct ablkcipher_request *ablkcipher_request_alloc( 597static inline struct ablkcipher_request *ablkcipher_request_alloc(
576 struct crypto_ablkcipher *tfm, gfp_t gfp) 598 struct crypto_ablkcipher *tfm, gfp_t gfp)
577{ 599{