diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2015-05-27 14:37:36 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-05-28 11:23:18 +0800 |
commit | d0ad1b246dc3d77df9a931c4a7852ff72e84ce4d (patch) | |
tree | a95cb9521f70eb61e77ef0e86dae996d546b3544 /crypto/seqiv.c | |
parent | 9d03aee125d73908ddbe9c1b96338c9b69e1abc0 (diff) | |
download | linux-d0ad1b246dc3d77df9a931c4a7852ff72e84ce4d.tar.gz linux-d0ad1b246dc3d77df9a931c4a7852ff72e84ce4d.tar.bz2 linux-d0ad1b246dc3d77df9a931c4a7852ff72e84ce4d.zip |
crypto: seqiv - Copy AD along with plain/cipher text
As the AD does not necessarily exist in the destination buffer
it must be copied along with the plain/cipher text.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/seqiv.c')
-rw-r--r-- | crypto/seqiv.c | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/crypto/seqiv.c b/crypto/seqiv.c index 127970a69ecf..b55c6857a1a9 100644 --- a/crypto/seqiv.c +++ b/crypto/seqiv.c @@ -315,19 +315,12 @@ static int seqiv_aead_encrypt_compat(struct aead_request *req) data = req; if (req->src != req->dst) { - struct scatterlist srcbuf[2]; - struct scatterlist dstbuf[2]; struct blkcipher_desc desc = { .tfm = ctx->null, }; - err = crypto_blkcipher_encrypt( - &desc, - scatterwalk_ffwd(dstbuf, req->dst, - req->assoclen + ivsize), - scatterwalk_ffwd(srcbuf, req->src, - req->assoclen + ivsize), - req->cryptlen - ivsize); + err = crypto_blkcipher_encrypt(&desc, req->dst, req->src, + req->assoclen + req->cryptlen); if (err) return err; } @@ -373,19 +366,12 @@ static int seqiv_aead_encrypt(struct aead_request *req) info = req->iv; if (req->src != req->dst) { - struct scatterlist src[2]; - struct scatterlist dst[2]; struct blkcipher_desc desc = { .tfm = ctx->null, }; - err = crypto_blkcipher_encrypt( - &desc, - scatterwalk_ffwd(dst, req->dst, - req->assoclen + ivsize), - scatterwalk_ffwd(src, req->src, - req->assoclen + ivsize), - req->cryptlen - ivsize); + err = crypto_blkcipher_encrypt(&desc, req->dst, req->src, + req->assoclen + req->cryptlen); if (err) return err; } @@ -446,19 +432,12 @@ static int seqiv_aead_decrypt_compat(struct aead_request *req) } if (req->src != req->dst) { - struct scatterlist srcbuf[2]; - struct scatterlist dstbuf[2]; struct blkcipher_desc desc = { .tfm = ctx->null, }; - err = crypto_blkcipher_encrypt( - &desc, - scatterwalk_ffwd(dstbuf, req->dst, - req->assoclen + ivsize), - scatterwalk_ffwd(srcbuf, req->src, - req->assoclen + ivsize), - req->cryptlen - ivsize); + err = crypto_blkcipher_encrypt(&desc, req->dst, req->src, + req->assoclen + req->cryptlen); if (err) return err; } |