Commit e938e465 authored by Kim Phillips's avatar Kim Phillips Committed by Herbert Xu

crypto: talitos - Whitespace/codingstyle/overrun lines cleanup

no functional changes.
Signed-off-by: default avatarKim Phillips <kim.phillips@freescale.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 4de9d0b5
...@@ -341,7 +341,8 @@ static void flush_channel(struct device *dev, int ch, int error, int reset_ch) ...@@ -341,7 +341,8 @@ static void flush_channel(struct device *dev, int ch, int error, int reset_ch)
status = error; status = error;
dma_unmap_single(dev, request->dma_desc, dma_unmap_single(dev, request->dma_desc,
sizeof(struct talitos_desc), DMA_BIDIRECTIONAL); sizeof(struct talitos_desc),
DMA_BIDIRECTIONAL);
/* copy entries so we can call callback outside lock */ /* copy entries so we can call callback outside lock */
saved_req.desc = request->desc; saved_req.desc = request->desc;
...@@ -415,7 +416,8 @@ static struct talitos_desc *current_desc(struct device *dev, int ch) ...@@ -415,7 +416,8 @@ static struct talitos_desc *current_desc(struct device *dev, int ch)
/* /*
* user diagnostics; report root cause of error based on execution unit status * user diagnostics; report root cause of error based on execution unit status
*/ */
static void report_eu_error(struct device *dev, int ch, struct talitos_desc *desc) static void report_eu_error(struct device *dev, int ch,
struct talitos_desc *desc)
{ {
struct talitos_private *priv = dev_get_drvdata(dev); struct talitos_private *priv = dev_get_drvdata(dev);
int i; int i;
...@@ -863,8 +865,8 @@ static void ipsec_esp_encrypt_done(struct device *dev, ...@@ -863,8 +865,8 @@ static void ipsec_esp_encrypt_done(struct device *dev,
} }
static void ipsec_esp_decrypt_swauth_done(struct device *dev, static void ipsec_esp_decrypt_swauth_done(struct device *dev,
struct talitos_desc *desc, void *context, struct talitos_desc *desc,
int err) void *context, int err)
{ {
struct aead_request *req = context; struct aead_request *req = context;
struct talitos_edesc *edesc = struct talitos_edesc *edesc =
...@@ -895,8 +897,8 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev, ...@@ -895,8 +897,8 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev,
} }
static void ipsec_esp_decrypt_hwauth_done(struct device *dev, static void ipsec_esp_decrypt_hwauth_done(struct device *dev,
struct talitos_desc *desc, void *context, struct talitos_desc *desc,
int err) void *context, int err)
{ {
struct aead_request *req = context; struct aead_request *req = context;
struct talitos_edesc *edesc = struct talitos_edesc *edesc =
...@@ -905,10 +907,9 @@ static void ipsec_esp_decrypt_hwauth_done(struct device *dev, ...@@ -905,10 +907,9 @@ static void ipsec_esp_decrypt_hwauth_done(struct device *dev,
ipsec_esp_unmap(dev, edesc, req); ipsec_esp_unmap(dev, edesc, req);
/* check ICV auth status */ /* check ICV auth status */
if (!err) if (!err && ((desc->hdr_lo & DESC_HDR_LO_ICCR1_MASK) !=
if ((desc->hdr_lo & DESC_HDR_LO_ICCR1_MASK) != DESC_HDR_LO_ICCR1_PASS))
DESC_HDR_LO_ICCR1_PASS) err = -EBADMSG;
err = -EBADMSG;
kfree(edesc); kfree(edesc);
...@@ -996,10 +997,9 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, ...@@ -996,10 +997,9 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq,
desc->ptr[4].len = cpu_to_be16(cryptlen); desc->ptr[4].len = cpu_to_be16(cryptlen);
desc->ptr[4].j_extent = authsize; desc->ptr[4].j_extent = authsize;
sg_count = talitos_map_sg(dev, areq->src, sg_count = talitos_map_sg(dev, areq->src, edesc->src_nents ? : 1,
edesc->src_nents ? : 1, (areq->src == areq->dst) ? DMA_BIDIRECTIONAL
(areq->src == areq->dst) ? DMA_BIDIRECTIONAL : : DMA_TO_DEVICE,
DMA_TO_DEVICE,
edesc->src_is_chained); edesc->src_is_chained);
if (sg_count == 1) { if (sg_count == 1) {
...@@ -1008,19 +1008,21 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, ...@@ -1008,19 +1008,21 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq,
sg_link_tbl_len = cryptlen; sg_link_tbl_len = cryptlen;
if ((edesc->desc.hdr & DESC_HDR_MODE1_MDEU_CICV) && if ((edesc->desc.hdr & DESC_HDR_MODE1_MDEU_CICV) &&
(edesc->desc.hdr & DESC_HDR_MODE0_ENCRYPT) == 0) { (edesc->desc.hdr & DESC_HDR_MODE0_ENCRYPT) == 0)
sg_link_tbl_len = cryptlen + authsize; sg_link_tbl_len = cryptlen + authsize;
}
sg_count = sg_to_link_tbl(areq->src, sg_count, sg_link_tbl_len, sg_count = sg_to_link_tbl(areq->src, sg_count, sg_link_tbl_len,
&edesc->link_tbl[0]); &edesc->link_tbl[0]);
if (sg_count > 1) { if (sg_count > 1) {
desc->ptr[4].j_extent |= DESC_PTR_LNKTBL_JUMP; desc->ptr[4].j_extent |= DESC_PTR_LNKTBL_JUMP;
desc->ptr[4].ptr = cpu_to_be32(edesc->dma_link_tbl); desc->ptr[4].ptr = cpu_to_be32(edesc->dma_link_tbl);
dma_sync_single_for_device(ctx->dev, edesc->dma_link_tbl, dma_sync_single_for_device(dev, edesc->dma_link_tbl,
edesc->dma_len, DMA_BIDIRECTIONAL); edesc->dma_len,
DMA_BIDIRECTIONAL);
} else { } else {
/* Only one segment now, so no link tbl needed */ /* Only one segment now, so no link tbl needed */
desc->ptr[4].ptr = cpu_to_be32(sg_dma_address(areq->src)); desc->ptr[4].ptr = cpu_to_be32(sg_dma_address(areq->
src));
} }
} }
...@@ -1028,12 +1030,11 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, ...@@ -1028,12 +1030,11 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq,
desc->ptr[5].len = cpu_to_be16(cryptlen); desc->ptr[5].len = cpu_to_be16(cryptlen);
desc->ptr[5].j_extent = authsize; desc->ptr[5].j_extent = authsize;
if (areq->src != areq->dst) { if (areq->src != areq->dst)
sg_count = talitos_map_sg(dev, areq->dst, sg_count = talitos_map_sg(dev, areq->dst,
edesc->dst_nents ? : 1, edesc->dst_nents ? : 1,
DMA_FROM_DEVICE, DMA_FROM_DEVICE,
edesc->dst_is_chained); edesc->dst_is_chained);
}
if (sg_count == 1) { if (sg_count == 1) {
desc->ptr[5].ptr = cpu_to_be32(sg_dma_address(areq->dst)); desc->ptr[5].ptr = cpu_to_be32(sg_dma_address(areq->dst));
...@@ -1078,7 +1079,6 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, ...@@ -1078,7 +1079,6 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq,
return ret; return ret;
} }
/* /*
* derive number of elements in scatterlist * derive number of elements in scatterlist
*/ */
...@@ -1191,8 +1191,6 @@ static int aead_encrypt(struct aead_request *req) ...@@ -1191,8 +1191,6 @@ static int aead_encrypt(struct aead_request *req)
return ipsec_esp(edesc, req, NULL, 0, ipsec_esp_encrypt_done); return ipsec_esp(edesc, req, NULL, 0, ipsec_esp_encrypt_done);
} }
static int aead_decrypt(struct aead_request *req) static int aead_decrypt(struct aead_request *req)
{ {
struct crypto_aead *authenc = crypto_aead_reqtfm(req); struct crypto_aead *authenc = crypto_aead_reqtfm(req);
...@@ -1211,38 +1209,38 @@ static int aead_decrypt(struct aead_request *req) ...@@ -1211,38 +1209,38 @@ static int aead_decrypt(struct aead_request *req)
return PTR_ERR(edesc); return PTR_ERR(edesc);
if ((priv->features & TALITOS_FTR_HW_AUTH_CHECK) && if ((priv->features & TALITOS_FTR_HW_AUTH_CHECK) &&
(((!edesc->src_nents && !edesc->dst_nents) || ((!edesc->src_nents && !edesc->dst_nents) ||
priv->features & TALITOS_FTR_SRC_LINK_TBL_LEN_INCLUDES_EXTENT))) { priv->features & TALITOS_FTR_SRC_LINK_TBL_LEN_INCLUDES_EXTENT)) {
/* decrypt and check the ICV */ /* decrypt and check the ICV */
edesc->desc.hdr = ctx->desc_hdr_template | DESC_HDR_DIR_INBOUND | edesc->desc.hdr = ctx->desc_hdr_template |
DESC_HDR_DIR_INBOUND |
DESC_HDR_MODE1_MDEU_CICV; DESC_HDR_MODE1_MDEU_CICV;
/* reset integrity check result bits */ /* reset integrity check result bits */
edesc->desc.hdr_lo = 0; edesc->desc.hdr_lo = 0;
return ipsec_esp(edesc, req, NULL, 0, ipsec_esp_decrypt_hwauth_done); return ipsec_esp(edesc, req, NULL, 0,
ipsec_esp_decrypt_hwauth_done);
} else { }
/* Have to check the ICV with software */
edesc->desc.hdr = ctx->desc_hdr_template | DESC_HDR_DIR_INBOUND; /* Have to check the ICV with software */
edesc->desc.hdr = ctx->desc_hdr_template | DESC_HDR_DIR_INBOUND;
/* stash incoming ICV for later cmp with ICV generated by the h/w */ /* stash incoming ICV for later cmp with ICV generated by the h/w */
if (edesc->dma_len) if (edesc->dma_len)
icvdata = &edesc->link_tbl[edesc->src_nents + icvdata = &edesc->link_tbl[edesc->src_nents +
edesc->dst_nents + 2]; edesc->dst_nents + 2];
else else
icvdata = &edesc->link_tbl[0]; icvdata = &edesc->link_tbl[0];
sg = sg_last(req->src, edesc->src_nents ? : 1); sg = sg_last(req->src, edesc->src_nents ? : 1);
memcpy(icvdata, (char *)sg_virt(sg) + sg->length - ctx->authsize, memcpy(icvdata, (char *)sg_virt(sg) + sg->length - ctx->authsize,
ctx->authsize); ctx->authsize);
return ipsec_esp(edesc, req, NULL, 0, ipsec_esp_decrypt_swauth_done); return ipsec_esp(edesc, req, NULL, 0, ipsec_esp_decrypt_swauth_done);
}
} }
static int aead_givencrypt(struct aead_givcrypt_request *req) static int aead_givencrypt(struct aead_givcrypt_request *req)
...@@ -1368,11 +1366,13 @@ static int common_nonsnoop(struct talitos_edesc *edesc, ...@@ -1368,11 +1366,13 @@ static int common_nonsnoop(struct talitos_edesc *edesc,
if (sg_count > 1) { if (sg_count > 1) {
desc->ptr[3].j_extent |= DESC_PTR_LNKTBL_JUMP; desc->ptr[3].j_extent |= DESC_PTR_LNKTBL_JUMP;
desc->ptr[3].ptr = cpu_to_be32(edesc->dma_link_tbl); desc->ptr[3].ptr = cpu_to_be32(edesc->dma_link_tbl);
dma_sync_single_for_device(ctx->dev, edesc->dma_link_tbl, dma_sync_single_for_device(dev, edesc->dma_link_tbl,
edesc->dma_len, DMA_BIDIRECTIONAL); edesc->dma_len,
DMA_BIDIRECTIONAL);
} else { } else {
/* Only one segment now, so no link tbl needed */ /* Only one segment now, so no link tbl needed */
desc->ptr[3].ptr = cpu_to_be32(sg_dma_address(areq->src)); desc->ptr[3].ptr = cpu_to_be32(sg_dma_address(areq->
src));
} }
} }
...@@ -1419,7 +1419,8 @@ static int common_nonsnoop(struct talitos_edesc *edesc, ...@@ -1419,7 +1419,8 @@ static int common_nonsnoop(struct talitos_edesc *edesc,
return ret; return ret;
} }
static struct talitos_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request *areq) static struct talitos_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request *
areq)
{ {
struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq); struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq);
struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher); struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher);
......
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