Lines Matching refs:areq
988 struct aead_request *areq, bool encrypt) in ipsec_esp_unmap() argument
990 struct crypto_aead *aead = crypto_aead_reqtfm(areq); in ipsec_esp_unmap()
994 unsigned int cryptlen = areq->cryptlen - (encrypt ? 0 : authsize); in ipsec_esp_unmap()
1003 talitos_sg_unmap(dev, edesc, areq->src, areq->dst, in ipsec_esp_unmap()
1004 cryptlen + authsize, areq->assoclen); in ipsec_esp_unmap()
1013 sg_pcopy_to_buffer(areq->dst, dst_nents, ctx->iv, ivsize, in ipsec_esp_unmap()
1014 areq->assoclen + cryptlen - ivsize); in ipsec_esp_unmap()
1025 struct aead_request *areq = context; in ipsec_esp_encrypt_done() local
1026 struct crypto_aead *authenc = crypto_aead_reqtfm(areq); in ipsec_esp_encrypt_done()
1032 ipsec_esp_unmap(dev, edesc, areq, true); in ipsec_esp_encrypt_done()
1038 aead_request_complete(areq, err); in ipsec_esp_encrypt_done()
1192 static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, in ipsec_esp() argument
1198 struct crypto_aead *aead = crypto_aead_reqtfm(areq); in ipsec_esp()
1203 unsigned int cryptlen = areq->cryptlen - (encrypt ? 0 : authsize); in ipsec_esp()
1221 sg_copy_to_buffer(areq->src, sg_count, edesc->buf, in ipsec_esp()
1222 areq->assoclen + cryptlen); in ipsec_esp()
1224 sg_count = dma_map_sg(dev, areq->src, sg_count, in ipsec_esp()
1225 (areq->src == areq->dst) ? in ipsec_esp()
1229 ret = talitos_sg_map(dev, areq->src, areq->assoclen, edesc, in ipsec_esp()
1253 ret = talitos_sg_map_ext(dev, areq->src, cryptlen, edesc, &desc->ptr[4], in ipsec_esp()
1254 sg_count, areq->assoclen, tbl_off, elen, in ipsec_esp()
1263 if (areq->src != areq->dst) { in ipsec_esp()
1266 dma_map_sg(dev, areq->dst, sg_count, DMA_FROM_DEVICE); in ipsec_esp()
1273 ret = talitos_sg_map_ext(dev, areq->dst, cryptlen, edesc, &desc->ptr[5], in ipsec_esp()
1274 sg_count, areq->assoclen, tbl_off, elen, in ipsec_esp()
1293 talitos_sg_map(dev, areq->dst, authsize, edesc, &desc->ptr[6], in ipsec_esp()
1294 sg_count, areq->assoclen + cryptlen, tbl_off); in ipsec_esp()
1307 ret = talitos_submit(dev, ctx->ch, desc, callback, areq); in ipsec_esp()
1309 ipsec_esp_unmap(dev, edesc, areq, encrypt); in ipsec_esp()
1416 static struct talitos_edesc *aead_edesc_alloc(struct aead_request *areq, u8 *iv, in aead_edesc_alloc() argument
1419 struct crypto_aead *authenc = crypto_aead_reqtfm(areq); in aead_edesc_alloc()
1423 unsigned int cryptlen = areq->cryptlen - (encrypt ? 0 : authsize); in aead_edesc_alloc()
1425 return talitos_edesc_alloc(ctx->dev, areq->src, areq->dst, in aead_edesc_alloc()
1426 iv, areq->assoclen, cryptlen, in aead_edesc_alloc()
1428 areq->base.flags, encrypt); in aead_edesc_alloc()
1533 struct skcipher_request *areq) in common_nonsnoop_unmap() argument
1537 talitos_sg_unmap(dev, edesc, areq->src, areq->dst, areq->cryptlen, 0); in common_nonsnoop_unmap()
1549 struct skcipher_request *areq = context; in skcipher_done() local
1550 struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(areq); in skcipher_done()
1557 common_nonsnoop_unmap(dev, edesc, areq); in skcipher_done()
1558 memcpy(areq->iv, ctx->iv, ivsize); in skcipher_done()
1562 areq->base.complete(&areq->base, err); in skcipher_done()
1566 struct skcipher_request *areq, in common_nonsnoop() argument
1571 struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(areq); in common_nonsnoop()
1575 unsigned int cryptlen = areq->cryptlen; in common_nonsnoop()
1594 sg_copy_to_buffer(areq->src, sg_count, edesc->buf, in common_nonsnoop()
1597 sg_count = dma_map_sg(dev, areq->src, sg_count, in common_nonsnoop()
1598 (areq->src == areq->dst) ? in common_nonsnoop()
1603 sg_count = talitos_sg_map_ext(dev, areq->src, cryptlen, edesc, &desc->ptr[3], in common_nonsnoop()
1609 if (areq->src != areq->dst) { in common_nonsnoop()
1612 dma_map_sg(dev, areq->dst, sg_count, DMA_FROM_DEVICE); in common_nonsnoop()
1615 ret = talitos_sg_map(dev, areq->dst, cryptlen, edesc, &desc->ptr[4], in common_nonsnoop()
1630 ret = talitos_submit(dev, ctx->ch, desc, callback, areq); in common_nonsnoop()
1632 common_nonsnoop_unmap(dev, edesc, areq); in common_nonsnoop()
1639 areq, bool encrypt) in skcipher_edesc_alloc()
1641 struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(areq); in skcipher_edesc_alloc()
1645 return talitos_edesc_alloc(ctx->dev, areq->src, areq->dst, in skcipher_edesc_alloc()
1646 areq->iv, 0, areq->cryptlen, 0, ivsize, 0, in skcipher_edesc_alloc()
1647 areq->base.flags, encrypt); in skcipher_edesc_alloc()
1650 static int skcipher_encrypt(struct skcipher_request *areq) in skcipher_encrypt() argument
1652 struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(areq); in skcipher_encrypt()
1658 if (!areq->cryptlen) in skcipher_encrypt()
1661 if (areq->cryptlen % blocksize) in skcipher_encrypt()
1665 edesc = skcipher_edesc_alloc(areq, true); in skcipher_encrypt()
1672 return common_nonsnoop(edesc, areq, skcipher_done); in skcipher_encrypt()
1675 static int skcipher_decrypt(struct skcipher_request *areq) in skcipher_decrypt() argument
1677 struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(areq); in skcipher_decrypt()
1683 if (!areq->cryptlen) in skcipher_decrypt()
1686 if (areq->cryptlen % blocksize) in skcipher_decrypt()
1690 edesc = skcipher_edesc_alloc(areq, false); in skcipher_decrypt()
1696 return common_nonsnoop(edesc, areq, skcipher_done); in skcipher_decrypt()
1701 struct ahash_request *areq) in common_nonsnoop_hash_unmap() argument
1703 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in common_nonsnoop_hash_unmap()
1704 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in common_nonsnoop_hash_unmap()
1716 memcpy(areq->result, req_ctx->hw_context, in common_nonsnoop_hash_unmap()
1747 struct ahash_request *areq = context; in ahash_done() local
1750 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_done()
1757 common_nonsnoop_hash_unmap(dev, edesc, areq); in ahash_done()
1761 areq->base.complete(&areq->base, err); in ahash_done()
1786 struct ahash_request *areq, unsigned int length, in common_nonsnoop_hash() argument
1791 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in common_nonsnoop_hash()
1793 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in common_nonsnoop_hash()
1903 ret = talitos_submit(dev, ctx->ch, desc, callback, areq); in common_nonsnoop_hash()
1905 common_nonsnoop_hash_unmap(dev, edesc, areq); in common_nonsnoop_hash()
1911 static struct talitos_edesc *ahash_edesc_alloc(struct ahash_request *areq, in ahash_edesc_alloc() argument
1914 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_edesc_alloc()
1916 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_edesc_alloc()
1924 nbytes, 0, 0, 0, areq->base.flags, false); in ahash_edesc_alloc()
1927 static int ahash_init(struct ahash_request *areq) in ahash_init() argument
1929 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_init()
1932 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_init()
1957 static int ahash_init_sha224_swinit(struct ahash_request *areq) in ahash_init_sha224_swinit() argument
1959 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_init_sha224_swinit()
1974 ahash_init(areq); in ahash_init_sha224_swinit()
1980 static int ahash_process_req(struct ahash_request *areq, unsigned int nbytes) in ahash_process_req() argument
1982 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_process_req()
1984 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_process_req()
1999 nents = sg_nents_for_len(areq->src, nbytes); in ahash_process_req()
2004 sg_copy_to_buffer(areq->src, nents, in ahash_process_req()
2031 sg_chain(req_ctx->bufsl, 2, areq->src); in ahash_process_req()
2040 nents = sg_nents_for_len(areq->src, offset); in ahash_process_req()
2045 sg_copy_to_buffer(areq->src, nents, in ahash_process_req()
2048 req_ctx->psrc = scatterwalk_ffwd(req_ctx->bufsl, areq->src, in ahash_process_req()
2051 req_ctx->psrc = areq->src; in ahash_process_req()
2054 nents = sg_nents_for_len(areq->src, nbytes); in ahash_process_req()
2059 sg_pcopy_to_buffer(areq->src, nents, in ahash_process_req()
2067 edesc = ahash_edesc_alloc(areq, nbytes_to_hash); in ahash_process_req()
2089 return common_nonsnoop_hash(edesc, areq, nbytes_to_hash, ahash_done); in ahash_process_req()
2092 static int ahash_update(struct ahash_request *areq) in ahash_update() argument
2094 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_update()
2098 return ahash_process_req(areq, areq->nbytes); in ahash_update()
2101 static int ahash_final(struct ahash_request *areq) in ahash_final() argument
2103 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_final()
2107 return ahash_process_req(areq, 0); in ahash_final()
2110 static int ahash_finup(struct ahash_request *areq) in ahash_finup() argument
2112 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_finup()
2116 return ahash_process_req(areq, areq->nbytes); in ahash_finup()
2119 static int ahash_digest(struct ahash_request *areq) in ahash_digest() argument
2121 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_digest()
2122 struct crypto_ahash *ahash = crypto_ahash_reqtfm(areq); in ahash_digest()
2124 ahash->init(areq); in ahash_digest()
2127 return ahash_process_req(areq, areq->nbytes); in ahash_digest()
2130 static int ahash_export(struct ahash_request *areq, void *out) in ahash_export() argument
2132 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_export()
2134 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_export()
2155 static int ahash_import(struct ahash_request *areq, const void *in) in ahash_import() argument
2157 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_import()
2158 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_import()