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()
1190 static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, in ipsec_esp() argument
1196 struct crypto_aead *aead = crypto_aead_reqtfm(areq); in ipsec_esp()
1201 unsigned int cryptlen = areq->cryptlen - (encrypt ? 0 : authsize); in ipsec_esp()
1219 sg_copy_to_buffer(areq->src, sg_count, edesc->buf, in ipsec_esp()
1220 areq->assoclen + cryptlen); in ipsec_esp()
1222 sg_count = dma_map_sg(dev, areq->src, sg_count, in ipsec_esp()
1223 (areq->src == areq->dst) ? in ipsec_esp()
1227 ret = talitos_sg_map(dev, areq->src, areq->assoclen, edesc, in ipsec_esp()
1251 ret = talitos_sg_map_ext(dev, areq->src, cryptlen, edesc, &desc->ptr[4], in ipsec_esp()
1252 sg_count, areq->assoclen, tbl_off, elen, in ipsec_esp()
1261 if (areq->src != areq->dst) { in ipsec_esp()
1264 dma_map_sg(dev, areq->dst, sg_count, DMA_FROM_DEVICE); in ipsec_esp()
1271 ret = talitos_sg_map_ext(dev, areq->dst, cryptlen, edesc, &desc->ptr[5], in ipsec_esp()
1272 sg_count, areq->assoclen, tbl_off, elen, in ipsec_esp()
1291 talitos_sg_map(dev, areq->dst, authsize, edesc, &desc->ptr[6], in ipsec_esp()
1292 sg_count, areq->assoclen + cryptlen, tbl_off); in ipsec_esp()
1305 ret = talitos_submit(dev, ctx->ch, desc, callback, areq); in ipsec_esp()
1307 ipsec_esp_unmap(dev, edesc, areq, encrypt); in ipsec_esp()
1414 static struct talitos_edesc *aead_edesc_alloc(struct aead_request *areq, u8 *iv, in aead_edesc_alloc() argument
1417 struct crypto_aead *authenc = crypto_aead_reqtfm(areq); in aead_edesc_alloc()
1421 unsigned int cryptlen = areq->cryptlen - (encrypt ? 0 : authsize); in aead_edesc_alloc()
1423 return talitos_edesc_alloc(ctx->dev, areq->src, areq->dst, in aead_edesc_alloc()
1424 iv, areq->assoclen, cryptlen, in aead_edesc_alloc()
1426 areq->base.flags, encrypt); in aead_edesc_alloc()
1531 struct skcipher_request *areq) in common_nonsnoop_unmap() argument
1535 talitos_sg_unmap(dev, edesc, areq->src, areq->dst, areq->cryptlen, 0); in common_nonsnoop_unmap()
1547 struct skcipher_request *areq = context; in skcipher_done() local
1548 struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(areq); in skcipher_done()
1555 common_nonsnoop_unmap(dev, edesc, areq); in skcipher_done()
1556 memcpy(areq->iv, ctx->iv, ivsize); in skcipher_done()
1560 areq->base.complete(&areq->base, err); in skcipher_done()
1564 struct skcipher_request *areq, in common_nonsnoop() argument
1569 struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(areq); in common_nonsnoop()
1573 unsigned int cryptlen = areq->cryptlen; in common_nonsnoop()
1590 sg_copy_to_buffer(areq->src, sg_count, edesc->buf, in common_nonsnoop()
1593 sg_count = dma_map_sg(dev, areq->src, sg_count, in common_nonsnoop()
1594 (areq->src == areq->dst) ? in common_nonsnoop()
1599 sg_count = talitos_sg_map(dev, areq->src, cryptlen, edesc, in common_nonsnoop()
1605 if (areq->src != areq->dst) { in common_nonsnoop()
1608 dma_map_sg(dev, areq->dst, sg_count, DMA_FROM_DEVICE); in common_nonsnoop()
1611 ret = talitos_sg_map(dev, areq->dst, cryptlen, edesc, &desc->ptr[4], in common_nonsnoop()
1626 ret = talitos_submit(dev, ctx->ch, desc, callback, areq); in common_nonsnoop()
1628 common_nonsnoop_unmap(dev, edesc, areq); in common_nonsnoop()
1635 areq, bool encrypt) in skcipher_edesc_alloc()
1637 struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(areq); in skcipher_edesc_alloc()
1641 return talitos_edesc_alloc(ctx->dev, areq->src, areq->dst, in skcipher_edesc_alloc()
1642 areq->iv, 0, areq->cryptlen, 0, ivsize, 0, in skcipher_edesc_alloc()
1643 areq->base.flags, encrypt); in skcipher_edesc_alloc()
1646 static int skcipher_encrypt(struct skcipher_request *areq) in skcipher_encrypt() argument
1648 struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(areq); in skcipher_encrypt()
1654 if (!areq->cryptlen) in skcipher_encrypt()
1657 if (areq->cryptlen % blocksize) in skcipher_encrypt()
1661 edesc = skcipher_edesc_alloc(areq, true); in skcipher_encrypt()
1668 return common_nonsnoop(edesc, areq, skcipher_done); in skcipher_encrypt()
1671 static int skcipher_decrypt(struct skcipher_request *areq) in skcipher_decrypt() argument
1673 struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(areq); in skcipher_decrypt()
1679 if (!areq->cryptlen) in skcipher_decrypt()
1682 if (areq->cryptlen % blocksize) in skcipher_decrypt()
1686 edesc = skcipher_edesc_alloc(areq, false); in skcipher_decrypt()
1692 return common_nonsnoop(edesc, areq, skcipher_done); in skcipher_decrypt()
1697 struct ahash_request *areq) in common_nonsnoop_hash_unmap() argument
1699 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in common_nonsnoop_hash_unmap()
1700 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in common_nonsnoop_hash_unmap()
1712 memcpy(areq->result, req_ctx->hw_context, in common_nonsnoop_hash_unmap()
1743 struct ahash_request *areq = context; in ahash_done() local
1746 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_done()
1753 common_nonsnoop_hash_unmap(dev, edesc, areq); in ahash_done()
1757 areq->base.complete(&areq->base, err); in ahash_done()
1782 struct ahash_request *areq, unsigned int length, in common_nonsnoop_hash() argument
1787 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in common_nonsnoop_hash()
1789 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in common_nonsnoop_hash()
1899 ret = talitos_submit(dev, ctx->ch, desc, callback, areq); in common_nonsnoop_hash()
1901 common_nonsnoop_hash_unmap(dev, edesc, areq); in common_nonsnoop_hash()
1907 static struct talitos_edesc *ahash_edesc_alloc(struct ahash_request *areq, in ahash_edesc_alloc() argument
1910 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_edesc_alloc()
1912 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_edesc_alloc()
1920 nbytes, 0, 0, 0, areq->base.flags, false); in ahash_edesc_alloc()
1923 static int ahash_init(struct ahash_request *areq) in ahash_init() argument
1925 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_init()
1928 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_init()
1953 static int ahash_init_sha224_swinit(struct ahash_request *areq) in ahash_init_sha224_swinit() argument
1955 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_init_sha224_swinit()
1970 ahash_init(areq); in ahash_init_sha224_swinit()
1976 static int ahash_process_req(struct ahash_request *areq, unsigned int nbytes) in ahash_process_req() argument
1978 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_process_req()
1980 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_process_req()
1995 nents = sg_nents_for_len(areq->src, nbytes); in ahash_process_req()
2000 sg_copy_to_buffer(areq->src, nents, in ahash_process_req()
2027 sg_chain(req_ctx->bufsl, 2, areq->src); in ahash_process_req()
2036 nents = sg_nents_for_len(areq->src, offset); in ahash_process_req()
2041 sg_copy_to_buffer(areq->src, nents, in ahash_process_req()
2044 req_ctx->psrc = scatterwalk_ffwd(req_ctx->bufsl, areq->src, in ahash_process_req()
2047 req_ctx->psrc = areq->src; in ahash_process_req()
2050 nents = sg_nents_for_len(areq->src, nbytes); in ahash_process_req()
2055 sg_pcopy_to_buffer(areq->src, nents, in ahash_process_req()
2063 edesc = ahash_edesc_alloc(areq, nbytes_to_hash); in ahash_process_req()
2085 return common_nonsnoop_hash(edesc, areq, nbytes_to_hash, ahash_done); in ahash_process_req()
2088 static int ahash_update(struct ahash_request *areq) in ahash_update() argument
2090 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_update()
2094 return ahash_process_req(areq, areq->nbytes); in ahash_update()
2097 static int ahash_final(struct ahash_request *areq) in ahash_final() argument
2099 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_final()
2103 return ahash_process_req(areq, 0); in ahash_final()
2106 static int ahash_finup(struct ahash_request *areq) in ahash_finup() argument
2108 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_finup()
2112 return ahash_process_req(areq, areq->nbytes); in ahash_finup()
2115 static int ahash_digest(struct ahash_request *areq) in ahash_digest() argument
2117 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_digest()
2118 struct crypto_ahash *ahash = crypto_ahash_reqtfm(areq); in ahash_digest()
2120 ahash->init(areq); in ahash_digest()
2123 return ahash_process_req(areq, areq->nbytes); in ahash_digest()
2126 static int ahash_export(struct ahash_request *areq, void *out) in ahash_export() argument
2128 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_export()
2130 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_export()
2151 static int ahash_import(struct ahash_request *areq, const void *in) in ahash_import() argument
2153 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); in ahash_import()
2154 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in ahash_import()