Lines Matching refs:areq
993 struct aead_request *areq, bool encrypt) in ipsec_esp_unmap() argument
995 struct crypto_aead *aead = crypto_aead_reqtfm(areq); in ipsec_esp_unmap()
999 unsigned int cryptlen = areq->cryptlen - (encrypt ? 0 : authsize); in ipsec_esp_unmap()
1008 talitos_sg_unmap(dev, edesc, areq->src, areq->dst, in ipsec_esp_unmap()
1009 cryptlen + authsize, areq->assoclen); in ipsec_esp_unmap()
1018 sg_pcopy_to_buffer(areq->dst, dst_nents, ctx->iv, ivsize, in ipsec_esp_unmap()
1019 areq->assoclen + cryptlen - ivsize); in ipsec_esp_unmap()
1030 struct aead_request *areq = context; in ipsec_esp_encrypt_done() local
1031 struct crypto_aead *authenc = crypto_aead_reqtfm(areq); in ipsec_esp_encrypt_done()
1037 ipsec_esp_unmap(dev, edesc, areq, true); in ipsec_esp_encrypt_done()
1043 aead_request_complete(areq, err); in ipsec_esp_encrypt_done()
1195 static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, in ipsec_esp() argument
1201 struct crypto_aead *aead = crypto_aead_reqtfm(areq); in ipsec_esp()
1206 unsigned int cryptlen = areq->cryptlen - (encrypt ? 0 : authsize); in ipsec_esp()
1224 sg_copy_to_buffer(areq->src, sg_count, edesc->buf, in ipsec_esp()
1225 areq->assoclen + cryptlen); in ipsec_esp()
1227 sg_count = dma_map_sg(dev, areq->src, sg_count, in ipsec_esp()
1228 (areq->src == areq->dst) ? in ipsec_esp()
1232 ret = talitos_sg_map(dev, areq->src, areq->assoclen, edesc, in ipsec_esp()
1256 ret = talitos_sg_map_ext(dev, areq->src, cryptlen, edesc, &desc->ptr[4], in ipsec_esp()
1257 sg_count, areq->assoclen, tbl_off, elen, in ipsec_esp()
1266 if (areq->src != areq->dst) { in ipsec_esp()
1269 dma_map_sg(dev, areq->dst, sg_count, DMA_FROM_DEVICE); in ipsec_esp()
1276 ret = talitos_sg_map_ext(dev, areq->dst, cryptlen, edesc, &desc->ptr[5], in ipsec_esp()
1277 sg_count, areq->assoclen, tbl_off, elen, in ipsec_esp()
1296 talitos_sg_map(dev, areq->dst, authsize, edesc, &desc->ptr[6], in ipsec_esp()
1297 sg_count, areq->assoclen + cryptlen, tbl_off); in ipsec_esp()
1310 ret = talitos_submit(dev, ctx->ch, desc, callback, areq); in ipsec_esp()
1312 ipsec_esp_unmap(dev, edesc, areq, encrypt); in ipsec_esp()
1419 static struct talitos_edesc *aead_edesc_alloc(struct aead_request *areq, u8 *iv, in aead_edesc_alloc() argument
1422 struct crypto_aead *authenc = crypto_aead_reqtfm(areq); in aead_edesc_alloc()
1426 unsigned int cryptlen = areq->cryptlen - (encrypt ? 0 : authsize); in aead_edesc_alloc()
1428 return talitos_edesc_alloc(ctx->dev, areq->src, areq->dst, in aead_edesc_alloc()
1429 iv, areq->assoclen, cryptlen, in aead_edesc_alloc()
1431 areq->base.flags, encrypt); in aead_edesc_alloc()
1538 struct ablkcipher_request *areq) in common_nonsnoop_unmap() argument
1542 talitos_sg_unmap(dev, edesc, areq->src, areq->dst, areq->nbytes, 0); in common_nonsnoop_unmap()
1554 struct ablkcipher_request *areq = context; in ablkcipher_done() local
1555 struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq); in ablkcipher_done()
1562 common_nonsnoop_unmap(dev, edesc, areq); in ablkcipher_done()
1563 memcpy(areq->info, ctx->iv, ivsize); in ablkcipher_done()
1567 areq->base.complete(&areq->base, err); in ablkcipher_done()
1571 struct ablkcipher_request *areq, in common_nonsnoop() argument
1576 struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq); in common_nonsnoop()
1580 unsigned int cryptlen = areq->nbytes; in common_nonsnoop()
1597 sg_copy_to_buffer(areq->src, sg_count, edesc->buf, in common_nonsnoop()
1600 sg_count = dma_map_sg(dev, areq->src, sg_count, in common_nonsnoop()
1601 (areq->src == areq->dst) ? in common_nonsnoop()
1606 sg_count = talitos_sg_map(dev, areq->src, cryptlen, edesc, in common_nonsnoop()
1612 if (areq->src != areq->dst) { in common_nonsnoop()
1615 dma_map_sg(dev, areq->dst, sg_count, DMA_FROM_DEVICE); in common_nonsnoop()
1618 ret = talitos_sg_map(dev, areq->dst, cryptlen, edesc, &desc->ptr[4], in common_nonsnoop()
1633 ret = talitos_submit(dev, ctx->ch, desc, callback, areq); in common_nonsnoop()
1635 common_nonsnoop_unmap(dev, edesc, areq); in common_nonsnoop()
1642 areq, bool encrypt) in ablkcipher_edesc_alloc()
1644 struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq); in ablkcipher_edesc_alloc()
1648 return talitos_edesc_alloc(ctx->dev, areq->src, areq->dst, in ablkcipher_edesc_alloc()
1649 areq->info, 0, areq->nbytes, 0, ivsize, 0, in ablkcipher_edesc_alloc()
1650 areq->base.flags, encrypt); in ablkcipher_edesc_alloc()
1653 static int ablkcipher_encrypt(struct ablkcipher_request *areq) in ablkcipher_encrypt() argument
1655 struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq); in ablkcipher_encrypt()
1661 if (!areq->nbytes) in ablkcipher_encrypt()
1664 if (areq->nbytes % blocksize) in ablkcipher_encrypt()
1668 edesc = ablkcipher_edesc_alloc(areq, true); in ablkcipher_encrypt()
1675 return common_nonsnoop(edesc, areq, ablkcipher_done); in ablkcipher_encrypt()
1678 static int ablkcipher_decrypt(struct ablkcipher_request *areq) in ablkcipher_decrypt() argument
1680 struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq); in ablkcipher_decrypt()
1686 if (!areq->nbytes) in ablkcipher_decrypt()
1689 if (areq->nbytes % blocksize) in ablkcipher_decrypt()
1693 edesc = ablkcipher_edesc_alloc(areq, false); in ablkcipher_decrypt()
1699 return common_nonsnoop(edesc, areq, ablkcipher_done); in ablkcipher_decrypt()
1704 struct ahash_request *areq) in common_nonsnoop_hash_unmap() argument
1706 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in common_nonsnoop_hash_unmap()
1746 struct ahash_request *areq = context; in ahash_done() local
1749 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_done()
1756 common_nonsnoop_hash_unmap(dev, edesc, areq); in ahash_done()
1760 areq->base.complete(&areq->base, err); in ahash_done()
1785 struct ahash_request *areq, unsigned int length, in common_nonsnoop_hash() argument
1790 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in common_nonsnoop_hash()
1792 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in common_nonsnoop_hash()
1848 areq->result, DMA_FROM_DEVICE); in common_nonsnoop_hash()
1902 ret = talitos_submit(dev, ctx->ch, desc, callback, areq); in common_nonsnoop_hash()
1904 common_nonsnoop_hash_unmap(dev, edesc, areq); in common_nonsnoop_hash()
1910 static struct talitos_edesc *ahash_edesc_alloc(struct ahash_request *areq, in ahash_edesc_alloc() argument
1913 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_edesc_alloc()
1915 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_edesc_alloc()
1923 nbytes, 0, 0, 0, areq->base.flags, false); in ahash_edesc_alloc()
1926 static int ahash_init(struct ahash_request *areq) in ahash_init() argument
1928 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_init()
1931 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_init()
1956 static int ahash_init_sha224_swinit(struct ahash_request *areq) in ahash_init_sha224_swinit() argument
1958 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_init_sha224_swinit()
1973 ahash_init(areq); in ahash_init_sha224_swinit()
1979 static int ahash_process_req(struct ahash_request *areq, unsigned int nbytes) in ahash_process_req() argument
1981 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_process_req()
1983 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_process_req()
1998 nents = sg_nents_for_len(areq->src, nbytes); in ahash_process_req()
2003 sg_copy_to_buffer(areq->src, nents, in ahash_process_req()
2030 sg_chain(req_ctx->bufsl, 2, areq->src); in ahash_process_req()
2039 nents = sg_nents_for_len(areq->src, offset); in ahash_process_req()
2044 sg_copy_to_buffer(areq->src, nents, in ahash_process_req()
2047 req_ctx->psrc = scatterwalk_ffwd(req_ctx->bufsl, areq->src, in ahash_process_req()
2050 req_ctx->psrc = areq->src; in ahash_process_req()
2053 nents = sg_nents_for_len(areq->src, nbytes); in ahash_process_req()
2058 sg_pcopy_to_buffer(areq->src, nents, in ahash_process_req()
2066 edesc = ahash_edesc_alloc(areq, nbytes_to_hash); in ahash_process_req()
2088 return common_nonsnoop_hash(edesc, areq, nbytes_to_hash, ahash_done); in ahash_process_req()
2091 static int ahash_update(struct ahash_request *areq) in ahash_update() argument
2093 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_update()
2097 return ahash_process_req(areq, areq->nbytes); in ahash_update()
2100 static int ahash_final(struct ahash_request *areq) in ahash_final() argument
2102 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_final()
2106 return ahash_process_req(areq, 0); in ahash_final()
2109 static int ahash_finup(struct ahash_request *areq) in ahash_finup() argument
2111 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_finup()
2115 return ahash_process_req(areq, areq->nbytes); in ahash_finup()
2118 static int ahash_digest(struct ahash_request *areq) in ahash_digest() argument
2120 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_digest()
2121 struct crypto_ahash *ahash = crypto_ahash_reqtfm(areq); in ahash_digest()
2123 ahash->init(areq); in ahash_digest()
2126 return ahash_process_req(areq, areq->nbytes); in ahash_digest()
2129 static int ahash_export(struct ahash_request *areq, void *out) in ahash_export() argument
2131 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_export()
2133 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_export()
2154 static int ahash_import(struct ahash_request *areq, const void *in) in ahash_import() argument
2156 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_import()
2157 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_import()