Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Browse files Browse the repository at this point in the history
Pull crypto fixes from Herbert Xu:
 "This fixes a GCM bug that breaks IPsec and a compile problem in
  ux500."

* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: ux500 - add missing comma
  crypto: gcm - fix assumption that assoc has one segment
  • Loading branch information
torvalds committed Apr 10, 2013
2 parents 49b442c + d47cbd5 commit d02a9a8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions crypto/gcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct crypto_rfc4543_ctx {

struct crypto_rfc4543_req_ctx {
u8 auth_tag[16];
u8 assocbuf[32];
struct scatterlist cipher[1];
struct scatterlist payload[2];
struct scatterlist assoc[2];
Expand Down Expand Up @@ -1133,9 +1134,19 @@ static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req,
scatterwalk_crypto_chain(payload, dst, vdst == req->iv + 8, 2);
assoclen += 8 + req->cryptlen - (enc ? 0 : authsize);

sg_init_table(assoc, 2);
sg_set_page(assoc, sg_page(req->assoc), req->assoc->length,
req->assoc->offset);
if (req->assoc->length == req->assoclen) {
sg_init_table(assoc, 2);
sg_set_page(assoc, sg_page(req->assoc), req->assoc->length,
req->assoc->offset);
} else {
BUG_ON(req->assoclen > sizeof(rctx->assocbuf));

scatterwalk_map_and_copy(rctx->assocbuf, req->assoc, 0,
req->assoclen, 0);

sg_init_table(assoc, 2);
sg_set_buf(assoc, rctx->assocbuf, req->assoclen);
}
scatterwalk_crypto_chain(assoc, payload, 0, 2);

aead_request_set_tfm(subreq, ctx->child);
Expand Down
2 changes: 1 addition & 1 deletion drivers/crypto/ux500/cryp/cryp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,7 @@ static struct platform_driver cryp_driver = {
.shutdown = ux500_cryp_shutdown,
.driver = {
.owner = THIS_MODULE,
.name = "cryp1"
.name = "cryp1",
.pm = &ux500_cryp_pm,
}
};
Expand Down

0 comments on commit d02a9a8

Please sign in to comment.