diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2014-03-04 00:28:39 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-03-10 08:17:11 -0400 |
commit | 4f7f1d7cff8f2c170ce0319eb4c01a82c328d34f (patch) | |
tree | d894dab0c42e11d7159d56b3949e96fdba91fadb | |
parent | 822be00fe67105a90e536df52d1e4d688f34b5b2 (diff) |
crypto: allow blkcipher walks over AEAD data
This adds the function blkcipher_aead_walk_virt_block, which allows the caller
to use the blkcipher walk API to handle the input and output scatterlists.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/blkcipher.c | 14 | ||||
-rw-r--r-- | include/crypto/algapi.h | 4 |
2 files changed, 18 insertions, 0 deletions
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index 46fdab5e9cc7..0122bec38564 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c | |||
@@ -357,6 +357,20 @@ int blkcipher_walk_virt_block(struct blkcipher_desc *desc, | |||
357 | } | 357 | } |
358 | EXPORT_SYMBOL_GPL(blkcipher_walk_virt_block); | 358 | EXPORT_SYMBOL_GPL(blkcipher_walk_virt_block); |
359 | 359 | ||
360 | int blkcipher_aead_walk_virt_block(struct blkcipher_desc *desc, | ||
361 | struct blkcipher_walk *walk, | ||
362 | struct crypto_aead *tfm, | ||
363 | unsigned int blocksize) | ||
364 | { | ||
365 | walk->flags &= ~BLKCIPHER_WALK_PHYS; | ||
366 | walk->walk_blocksize = blocksize; | ||
367 | walk->cipher_blocksize = crypto_aead_blocksize(tfm); | ||
368 | walk->ivsize = crypto_aead_ivsize(tfm); | ||
369 | walk->alignmask = crypto_aead_alignmask(tfm); | ||
370 | return blkcipher_walk_first(desc, walk); | ||
371 | } | ||
372 | EXPORT_SYMBOL_GPL(blkcipher_aead_walk_virt_block); | ||
373 | |||
360 | static int setkey_unaligned(struct crypto_tfm *tfm, const u8 *key, | 374 | static int setkey_unaligned(struct crypto_tfm *tfm, const u8 *key, |
361 | unsigned int keylen) | 375 | unsigned int keylen) |
362 | { | 376 | { |
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index d9d14a0f0653..016c2f110f63 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h | |||
@@ -195,6 +195,10 @@ int blkcipher_walk_phys(struct blkcipher_desc *desc, | |||
195 | int blkcipher_walk_virt_block(struct blkcipher_desc *desc, | 195 | int blkcipher_walk_virt_block(struct blkcipher_desc *desc, |
196 | struct blkcipher_walk *walk, | 196 | struct blkcipher_walk *walk, |
197 | unsigned int blocksize); | 197 | unsigned int blocksize); |
198 | int blkcipher_aead_walk_virt_block(struct blkcipher_desc *desc, | ||
199 | struct blkcipher_walk *walk, | ||
200 | struct crypto_aead *tfm, | ||
201 | unsigned int blocksize); | ||
198 | 202 | ||
199 | int ablkcipher_walk_done(struct ablkcipher_request *req, | 203 | int ablkcipher_walk_done(struct ablkcipher_request *req, |
200 | struct ablkcipher_walk *walk, int err); | 204 | struct ablkcipher_walk *walk, int err); |