Commit a0be7522 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  [CRYPTO] cryptd: Correct kzalloc error test
  [CRYPTO] eseqiv: Fix off-by-one encryption
  [CRYPTO] api: Fix scatterwalk_sg_chain
  [CRYPTO] authenc: Fix async crypto crash in crypto_authenc_genicv()
parents 3b2b74ca b1145ce3
...@@ -217,9 +217,10 @@ static void crypto_authenc_givencrypt_done(struct crypto_async_request *req, ...@@ -217,9 +217,10 @@ static void crypto_authenc_givencrypt_done(struct crypto_async_request *req,
int err) int err)
{ {
if (!err) { if (!err) {
struct aead_givcrypt_request *greq = req->data; struct aead_request *areq = req->data;
struct skcipher_givcrypt_request *greq = aead_request_ctx(areq);
err = crypto_authenc_genicv(&greq->areq, greq->giv, 0); err = crypto_authenc_genicv(areq, greq->giv, 0);
} }
aead_request_complete(req->data, err); aead_request_complete(req->data, err);
......
...@@ -190,8 +190,10 @@ static struct crypto_instance *cryptd_alloc_instance(struct crypto_alg *alg, ...@@ -190,8 +190,10 @@ static struct crypto_instance *cryptd_alloc_instance(struct crypto_alg *alg,
int err; int err;
inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL); inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL);
if (IS_ERR(inst)) if (!inst) {
inst = ERR_PTR(-ENOMEM);
goto out; goto out;
}
err = -ENAMETOOLONG; err = -ENAMETOOLONG;
if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME,
......
...@@ -136,7 +136,8 @@ static int eseqiv_givencrypt(struct skcipher_givcrypt_request *req) ...@@ -136,7 +136,8 @@ static int eseqiv_givencrypt(struct skcipher_givcrypt_request *req)
} }
ablkcipher_request_set_crypt(subreq, reqctx->src, dst, ablkcipher_request_set_crypt(subreq, reqctx->src, dst,
req->creq.nbytes, req->creq.info); req->creq.nbytes + ivsize,
req->creq.info);
memcpy(req->creq.info, ctx->salt, ivsize); memcpy(req->creq.info, ctx->salt, ivsize);
......
...@@ -57,10 +57,14 @@ static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num, ...@@ -57,10 +57,14 @@ static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num,
struct scatterlist *sg2) struct scatterlist *sg2)
{ {
sg_set_page(&sg1[num - 1], (void *)sg2, 0, 0); sg_set_page(&sg1[num - 1], (void *)sg2, 0, 0);
sg1[num - 1].page_link &= ~0x02;
} }
static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg) static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg)
{ {
if (sg_is_last(sg))
return NULL;
return (++sg)->length ? sg : (void *)sg_page(sg); return (++sg)->length ? sg : (void *)sg_page(sg);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment