Lines Matching refs:areq

224 static int safexcel_ahash_enqueue(struct ahash_request *areq);
232 struct ahash_request *areq = ahash_request_cast(async); in safexcel_handle_req_result() local
233 struct crypto_ahash *ahash = crypto_ahash_reqtfm(areq); in safexcel_handle_req_result()
234 struct safexcel_ahash_req *sreq = ahash_request_ctx_dma(areq); in safexcel_handle_req_result()
252 dma_unmap_sg(priv->dev, areq->src, sreq->nents, DMA_TO_DEVICE); in safexcel_handle_req_result()
285 areq->nbytes = 0; in safexcel_handle_req_result()
286 safexcel_ahash_enqueue(areq); in safexcel_handle_req_result()
295 *(__le32 *)areq->result = ~sreq->state[0]; in safexcel_handle_req_result()
297 memcpy(areq->result, sreq->state, in safexcel_handle_req_result()
314 struct ahash_request *areq = ahash_request_cast(async); in safexcel_ahash_send_req() local
315 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_ahash_send_req()
316 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_ahash_send_req()
329 cache_len = queued - areq->nbytes; in safexcel_ahash_send_req()
343 sg_pcopy_to_buffer(areq->src, sg_nents(areq->src), in safexcel_ahash_send_req()
345 areq->nbytes - extra); in safexcel_ahash_send_req()
369 sg_pcopy_to_buffer(areq->src, in safexcel_ahash_send_req()
370 sg_nents(areq->src), in safexcel_ahash_send_req()
423 req->nents = dma_map_sg(priv->dev, areq->src, in safexcel_ahash_send_req()
424 sg_nents_for_len(areq->src, in safexcel_ahash_send_req()
425 areq->nbytes), in safexcel_ahash_send_req()
432 for_each_sg(areq->src, sg, req->nents, i) { in safexcel_ahash_send_req()
487 safexcel_rdr_req_set(priv, ring, rdesc, &areq->base); in safexcel_ahash_send_req()
500 dma_unmap_sg(priv->dev, areq->src, req->nents, DMA_TO_DEVICE); in safexcel_ahash_send_req()
523 struct ahash_request *areq = ahash_request_cast(async); in safexcel_handle_inv_result() local
524 struct crypto_ahash *ahash = crypto_ahash_reqtfm(areq); in safexcel_handle_inv_result()
571 struct ahash_request *areq = ahash_request_cast(async); in safexcel_handle_result() local
572 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_handle_result()
592 struct ahash_request *areq = ahash_request_cast(async); in safexcel_ahash_send_inv() local
593 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_ahash_send_inv()
610 struct ahash_request *areq = ahash_request_cast(async); in safexcel_ahash_send() local
611 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_ahash_send()
664 static int safexcel_ahash_cache(struct ahash_request *areq) in safexcel_ahash_cache() argument
666 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_ahash_cache()
678 if (cache_len + areq->nbytes <= HASH_CACHE_SIZE) { in safexcel_ahash_cache()
679 sg_pcopy_to_buffer(areq->src, sg_nents(areq->src), in safexcel_ahash_cache()
681 areq->nbytes, 0); in safexcel_ahash_cache()
689 static int safexcel_ahash_enqueue(struct ahash_request *areq) in safexcel_ahash_enqueue() argument
691 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_ahash_enqueue()
692 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_ahash_enqueue()
723 EIP197_GFP_FLAGS(areq->base), in safexcel_ahash_enqueue()
733 ret = crypto_enqueue_request(&priv->ring[ring].queue, &areq->base); in safexcel_ahash_enqueue()
742 static int safexcel_ahash_update(struct ahash_request *areq) in safexcel_ahash_update() argument
744 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_ahash_update()
748 if (!areq->nbytes) in safexcel_ahash_update()
752 ret = safexcel_ahash_cache(areq); in safexcel_ahash_update()
755 req->len += areq->nbytes; in safexcel_ahash_update()
762 return safexcel_ahash_enqueue(areq); in safexcel_ahash_update()
767 static int safexcel_ahash_final(struct ahash_request *areq) in safexcel_ahash_final() argument
769 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_ahash_final()
770 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_ahash_final()
774 if (unlikely(!req->len && !areq->nbytes)) { in safexcel_ahash_final()
781 memcpy(areq->result, md5_zero_message_hash, in safexcel_ahash_final()
784 memcpy(areq->result, sha1_zero_message_hash, in safexcel_ahash_final()
787 memcpy(areq->result, sha224_zero_message_hash, in safexcel_ahash_final()
790 memcpy(areq->result, sha256_zero_message_hash, in safexcel_ahash_final()
793 memcpy(areq->result, sha384_zero_message_hash, in safexcel_ahash_final()
796 memcpy(areq->result, sha512_zero_message_hash, in safexcel_ahash_final()
799 memcpy(areq->result, in safexcel_ahash_final()
806 req->len == sizeof(u32) && !areq->nbytes)) { in safexcel_ahash_final()
808 memcpy(areq->result, &ctx->base.ipad, sizeof(u32)); in safexcel_ahash_final()
811 !areq->nbytes)) { in safexcel_ahash_final()
813 memset(areq->result, 0, AES_BLOCK_SIZE); in safexcel_ahash_final()
816 !areq->nbytes)) { in safexcel_ahash_final()
821 u32 *result = (void *)areq->result; in safexcel_ahash_final()
826 areq->result[0] ^= 0x80; // 10- padding in safexcel_ahash_final()
827 aes_encrypt(ctx->aes, areq->result, areq->result); in safexcel_ahash_final()
831 !areq->nbytes)) { in safexcel_ahash_final()
868 return safexcel_ahash_enqueue(areq); in safexcel_ahash_final()
871 static int safexcel_ahash_finup(struct ahash_request *areq) in safexcel_ahash_finup() argument
873 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_ahash_finup()
877 safexcel_ahash_update(areq); in safexcel_ahash_finup()
878 return safexcel_ahash_final(areq); in safexcel_ahash_finup()
881 static int safexcel_ahash_export(struct ahash_request *areq, void *out) in safexcel_ahash_export() argument
883 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_ahash_export()
897 static int safexcel_ahash_import(struct ahash_request *areq, const void *in) in safexcel_ahash_import() argument
899 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_ahash_import()
903 ret = crypto_ahash_init(areq); in safexcel_ahash_import()
935 static int safexcel_sha1_init(struct ahash_request *areq) in safexcel_sha1_init() argument
937 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sha1_init()
938 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_sha1_init()
951 static int safexcel_sha1_digest(struct ahash_request *areq) in safexcel_sha1_digest() argument
953 int ret = safexcel_sha1_init(areq); in safexcel_sha1_digest()
958 return safexcel_ahash_finup(areq); in safexcel_sha1_digest()
1012 static int safexcel_hmac_sha1_init(struct ahash_request *areq) in safexcel_hmac_sha1_init() argument
1014 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sha1_init()
1015 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_hmac_sha1_init()
1035 static int safexcel_hmac_sha1_digest(struct ahash_request *areq) in safexcel_hmac_sha1_digest() argument
1037 int ret = safexcel_hmac_sha1_init(areq); in safexcel_hmac_sha1_digest()
1042 return safexcel_ahash_finup(areq); in safexcel_hmac_sha1_digest()
1045 static int safexcel_hmac_init_pad(struct ahash_request *areq, in safexcel_hmac_init_pad() argument
1061 ahash_request_set_callback(areq, CRYPTO_TFM_REQ_MAY_BACKLOG, in safexcel_hmac_init_pad()
1064 ahash_request_set_crypt(areq, &sg, ipad, keylen); in safexcel_hmac_init_pad()
1066 ret = crypto_ahash_digest(areq); in safexcel_hmac_init_pad()
1075 keylen = crypto_ahash_digestsize(crypto_ahash_reqtfm(areq)); in safexcel_hmac_init_pad()
1089 static int safexcel_hmac_init_iv(struct ahash_request *areq, in safexcel_hmac_init_iv() argument
1097 ahash_request_set_callback(areq, CRYPTO_TFM_REQ_MAY_BACKLOG, in safexcel_hmac_init_iv()
1100 ahash_request_set_crypt(areq, &sg, pad, blocksize); in safexcel_hmac_init_iv()
1102 ret = crypto_ahash_init(areq); in safexcel_hmac_init_iv()
1106 req = ahash_request_ctx_dma(areq); in safexcel_hmac_init_iv()
1110 ret = crypto_ahash_update(areq); in safexcel_hmac_init_iv()
1113 return ret ?: crypto_ahash_export(areq, state); in safexcel_hmac_init_iv()
1120 struct ahash_request *areq; in __safexcel_hmac_setkey() local
1130 areq = ahash_request_alloc(tfm, GFP_KERNEL); in __safexcel_hmac_setkey()
1131 if (!areq) { in __safexcel_hmac_setkey()
1147 ret = safexcel_hmac_init_pad(areq, blocksize, key, keylen, ipad, opad); in __safexcel_hmac_setkey()
1151 ret = safexcel_hmac_init_iv(areq, blocksize, ipad, istate); in __safexcel_hmac_setkey()
1155 ret = safexcel_hmac_init_iv(areq, blocksize, opad, ostate); in __safexcel_hmac_setkey()
1160 ahash_request_free(areq); in __safexcel_hmac_setkey()
1238 static int safexcel_sha256_init(struct ahash_request *areq) in safexcel_sha256_init() argument
1240 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sha256_init()
1241 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_sha256_init()
1254 static int safexcel_sha256_digest(struct ahash_request *areq) in safexcel_sha256_digest() argument
1256 int ret = safexcel_sha256_init(areq); in safexcel_sha256_digest()
1261 return safexcel_ahash_finup(areq); in safexcel_sha256_digest()
1295 static int safexcel_sha224_init(struct ahash_request *areq) in safexcel_sha224_init() argument
1297 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sha224_init()
1298 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_sha224_init()
1311 static int safexcel_sha224_digest(struct ahash_request *areq) in safexcel_sha224_digest() argument
1313 int ret = safexcel_sha224_init(areq); in safexcel_sha224_digest()
1318 return safexcel_ahash_finup(areq); in safexcel_sha224_digest()
1359 static int safexcel_hmac_sha224_init(struct ahash_request *areq) in safexcel_hmac_sha224_init() argument
1361 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sha224_init()
1362 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_hmac_sha224_init()
1382 static int safexcel_hmac_sha224_digest(struct ahash_request *areq) in safexcel_hmac_sha224_digest() argument
1384 int ret = safexcel_hmac_sha224_init(areq); in safexcel_hmac_sha224_digest()
1389 return safexcel_ahash_finup(areq); in safexcel_hmac_sha224_digest()
1431 static int safexcel_hmac_sha256_init(struct ahash_request *areq) in safexcel_hmac_sha256_init() argument
1433 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sha256_init()
1434 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_hmac_sha256_init()
1454 static int safexcel_hmac_sha256_digest(struct ahash_request *areq) in safexcel_hmac_sha256_digest() argument
1456 int ret = safexcel_hmac_sha256_init(areq); in safexcel_hmac_sha256_digest()
1461 return safexcel_ahash_finup(areq); in safexcel_hmac_sha256_digest()
1496 static int safexcel_sha512_init(struct ahash_request *areq) in safexcel_sha512_init() argument
1498 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sha512_init()
1499 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_sha512_init()
1512 static int safexcel_sha512_digest(struct ahash_request *areq) in safexcel_sha512_digest() argument
1514 int ret = safexcel_sha512_init(areq); in safexcel_sha512_digest()
1519 return safexcel_ahash_finup(areq); in safexcel_sha512_digest()
1553 static int safexcel_sha384_init(struct ahash_request *areq) in safexcel_sha384_init() argument
1555 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sha384_init()
1556 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_sha384_init()
1569 static int safexcel_sha384_digest(struct ahash_request *areq) in safexcel_sha384_digest() argument
1571 int ret = safexcel_sha384_init(areq); in safexcel_sha384_digest()
1576 return safexcel_ahash_finup(areq); in safexcel_sha384_digest()
1617 static int safexcel_hmac_sha512_init(struct ahash_request *areq) in safexcel_hmac_sha512_init() argument
1619 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sha512_init()
1620 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_hmac_sha512_init()
1640 static int safexcel_hmac_sha512_digest(struct ahash_request *areq) in safexcel_hmac_sha512_digest() argument
1642 int ret = safexcel_hmac_sha512_init(areq); in safexcel_hmac_sha512_digest()
1647 return safexcel_ahash_finup(areq); in safexcel_hmac_sha512_digest()
1689 static int safexcel_hmac_sha384_init(struct ahash_request *areq) in safexcel_hmac_sha384_init() argument
1691 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sha384_init()
1692 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_hmac_sha384_init()
1712 static int safexcel_hmac_sha384_digest(struct ahash_request *areq) in safexcel_hmac_sha384_digest() argument
1714 int ret = safexcel_hmac_sha384_init(areq); in safexcel_hmac_sha384_digest()
1719 return safexcel_ahash_finup(areq); in safexcel_hmac_sha384_digest()
1754 static int safexcel_md5_init(struct ahash_request *areq) in safexcel_md5_init() argument
1756 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_md5_init()
1757 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_md5_init()
1770 static int safexcel_md5_digest(struct ahash_request *areq) in safexcel_md5_digest() argument
1772 int ret = safexcel_md5_init(areq); in safexcel_md5_digest()
1777 return safexcel_ahash_finup(areq); in safexcel_md5_digest()
1811 static int safexcel_hmac_md5_init(struct ahash_request *areq) in safexcel_hmac_md5_init() argument
1813 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_md5_init()
1814 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_hmac_md5_init()
1842 static int safexcel_hmac_md5_digest(struct ahash_request *areq) in safexcel_hmac_md5_digest() argument
1844 int ret = safexcel_hmac_md5_init(areq); in safexcel_hmac_md5_digest()
1849 return safexcel_ahash_finup(areq); in safexcel_hmac_md5_digest()
1894 static int safexcel_crc32_init(struct ahash_request *areq) in safexcel_crc32_init() argument
1896 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_crc32_init()
1897 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_crc32_init()
1928 static int safexcel_crc32_digest(struct ahash_request *areq) in safexcel_crc32_digest() argument
1930 return safexcel_crc32_init(areq) ?: safexcel_ahash_finup(areq); in safexcel_crc32_digest()
1966 static int safexcel_cbcmac_init(struct ahash_request *areq) in safexcel_cbcmac_init() argument
1968 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_cbcmac_init()
1969 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_cbcmac_init()
2019 static int safexcel_cbcmac_digest(struct ahash_request *areq) in safexcel_cbcmac_digest() argument
2021 return safexcel_cbcmac_init(areq) ?: safexcel_ahash_finup(areq); in safexcel_cbcmac_digest()
2226 static int safexcel_sm3_init(struct ahash_request *areq) in safexcel_sm3_init() argument
2228 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sm3_init()
2229 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_sm3_init()
2242 static int safexcel_sm3_digest(struct ahash_request *areq) in safexcel_sm3_digest() argument
2244 int ret = safexcel_sm3_init(areq); in safexcel_sm3_digest()
2249 return safexcel_ahash_finup(areq); in safexcel_sm3_digest()
2290 static int safexcel_hmac_sm3_init(struct ahash_request *areq) in safexcel_hmac_sm3_init() argument
2292 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sm3_init()
2293 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_hmac_sm3_init()
2313 static int safexcel_hmac_sm3_digest(struct ahash_request *areq) in safexcel_hmac_sm3_digest() argument
2315 int ret = safexcel_hmac_sm3_init(areq); in safexcel_hmac_sm3_digest()
2320 return safexcel_ahash_finup(areq); in safexcel_hmac_sm3_digest()
2355 static int safexcel_sha3_224_init(struct ahash_request *areq) in safexcel_sha3_224_init() argument
2357 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_sha3_224_init()
2359 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_sha3_224_init()
2549 static int safexcel_sha3_256_init(struct ahash_request *areq) in safexcel_sha3_256_init() argument
2551 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_sha3_256_init()
2553 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_sha3_256_init()
2607 static int safexcel_sha3_384_init(struct ahash_request *areq) in safexcel_sha3_384_init() argument
2609 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_sha3_384_init()
2611 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_sha3_384_init()
2665 static int safexcel_sha3_512_init(struct ahash_request *areq) in safexcel_sha3_512_init() argument
2667 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_sha3_512_init()
2669 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_sha3_512_init()
2815 static int safexcel_hmac_sha3_224_init(struct ahash_request *areq) in safexcel_hmac_sha3_224_init() argument
2817 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_hmac_sha3_224_init()
2819 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_hmac_sha3_224_init()
2886 static int safexcel_hmac_sha3_256_init(struct ahash_request *areq) in safexcel_hmac_sha3_256_init() argument
2888 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_hmac_sha3_256_init()
2890 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_hmac_sha3_256_init()
2957 static int safexcel_hmac_sha3_384_init(struct ahash_request *areq) in safexcel_hmac_sha3_384_init() argument
2959 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_hmac_sha3_384_init()
2961 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_hmac_sha3_384_init()
3028 static int safexcel_hmac_sha3_512_init(struct ahash_request *areq) in safexcel_hmac_sha3_512_init() argument
3030 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_hmac_sha3_512_init()
3032 struct safexcel_ahash_req *req = ahash_request_ctx_dma(areq); in safexcel_hmac_sha3_512_init()