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(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(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(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(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(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(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(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(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 crypto_cipher_encrypt_one(ctx->kaes, 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(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(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(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(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(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()
1061 static int safexcel_hmac_init_pad(struct ahash_request *areq, in safexcel_hmac_init_pad() argument
1077 ahash_request_set_callback(areq, CRYPTO_TFM_REQ_MAY_BACKLOG, in safexcel_hmac_init_pad()
1080 ahash_request_set_crypt(areq, &sg, ipad, keylen); in safexcel_hmac_init_pad()
1083 ret = crypto_ahash_digest(areq); in safexcel_hmac_init_pad()
1095 keylen = crypto_ahash_digestsize(crypto_ahash_reqtfm(areq)); in safexcel_hmac_init_pad()
1109 static int safexcel_hmac_init_iv(struct ahash_request *areq, in safexcel_hmac_init_iv() argument
1117 ahash_request_set_callback(areq, CRYPTO_TFM_REQ_MAY_BACKLOG, in safexcel_hmac_init_iv()
1120 ahash_request_set_crypt(areq, &sg, pad, blocksize); in safexcel_hmac_init_iv()
1123 ret = crypto_ahash_init(areq); in safexcel_hmac_init_iv()
1127 req = ahash_request_ctx(areq); in safexcel_hmac_init_iv()
1131 ret = crypto_ahash_update(areq); in safexcel_hmac_init_iv()
1139 return crypto_ahash_export(areq, state); in safexcel_hmac_init_iv()
1146 struct ahash_request *areq; in __safexcel_hmac_setkey() local
1156 areq = ahash_request_alloc(tfm, GFP_KERNEL); in __safexcel_hmac_setkey()
1157 if (!areq) { in __safexcel_hmac_setkey()
1173 ret = safexcel_hmac_init_pad(areq, blocksize, key, keylen, ipad, opad); in __safexcel_hmac_setkey()
1177 ret = safexcel_hmac_init_iv(areq, blocksize, ipad, istate); in __safexcel_hmac_setkey()
1181 ret = safexcel_hmac_init_iv(areq, blocksize, opad, ostate); in __safexcel_hmac_setkey()
1186 ahash_request_free(areq); in __safexcel_hmac_setkey()
1264 static int safexcel_sha256_init(struct ahash_request *areq) in safexcel_sha256_init() argument
1266 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sha256_init()
1267 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_sha256_init()
1280 static int safexcel_sha256_digest(struct ahash_request *areq) in safexcel_sha256_digest() argument
1282 int ret = safexcel_sha256_init(areq); in safexcel_sha256_digest()
1287 return safexcel_ahash_finup(areq); in safexcel_sha256_digest()
1321 static int safexcel_sha224_init(struct ahash_request *areq) in safexcel_sha224_init() argument
1323 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sha224_init()
1324 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_sha224_init()
1337 static int safexcel_sha224_digest(struct ahash_request *areq) in safexcel_sha224_digest() argument
1339 int ret = safexcel_sha224_init(areq); in safexcel_sha224_digest()
1344 return safexcel_ahash_finup(areq); in safexcel_sha224_digest()
1385 static int safexcel_hmac_sha224_init(struct ahash_request *areq) in safexcel_hmac_sha224_init() argument
1387 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sha224_init()
1388 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_sha224_init()
1408 static int safexcel_hmac_sha224_digest(struct ahash_request *areq) in safexcel_hmac_sha224_digest() argument
1410 int ret = safexcel_hmac_sha224_init(areq); in safexcel_hmac_sha224_digest()
1415 return safexcel_ahash_finup(areq); in safexcel_hmac_sha224_digest()
1457 static int safexcel_hmac_sha256_init(struct ahash_request *areq) in safexcel_hmac_sha256_init() argument
1459 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sha256_init()
1460 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_sha256_init()
1480 static int safexcel_hmac_sha256_digest(struct ahash_request *areq) in safexcel_hmac_sha256_digest() argument
1482 int ret = safexcel_hmac_sha256_init(areq); in safexcel_hmac_sha256_digest()
1487 return safexcel_ahash_finup(areq); in safexcel_hmac_sha256_digest()
1522 static int safexcel_sha512_init(struct ahash_request *areq) in safexcel_sha512_init() argument
1524 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sha512_init()
1525 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_sha512_init()
1538 static int safexcel_sha512_digest(struct ahash_request *areq) in safexcel_sha512_digest() argument
1540 int ret = safexcel_sha512_init(areq); in safexcel_sha512_digest()
1545 return safexcel_ahash_finup(areq); in safexcel_sha512_digest()
1579 static int safexcel_sha384_init(struct ahash_request *areq) in safexcel_sha384_init() argument
1581 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sha384_init()
1582 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_sha384_init()
1595 static int safexcel_sha384_digest(struct ahash_request *areq) in safexcel_sha384_digest() argument
1597 int ret = safexcel_sha384_init(areq); in safexcel_sha384_digest()
1602 return safexcel_ahash_finup(areq); in safexcel_sha384_digest()
1643 static int safexcel_hmac_sha512_init(struct ahash_request *areq) in safexcel_hmac_sha512_init() argument
1645 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sha512_init()
1646 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_sha512_init()
1666 static int safexcel_hmac_sha512_digest(struct ahash_request *areq) in safexcel_hmac_sha512_digest() argument
1668 int ret = safexcel_hmac_sha512_init(areq); in safexcel_hmac_sha512_digest()
1673 return safexcel_ahash_finup(areq); in safexcel_hmac_sha512_digest()
1715 static int safexcel_hmac_sha384_init(struct ahash_request *areq) in safexcel_hmac_sha384_init() argument
1717 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sha384_init()
1718 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_sha384_init()
1738 static int safexcel_hmac_sha384_digest(struct ahash_request *areq) in safexcel_hmac_sha384_digest() argument
1740 int ret = safexcel_hmac_sha384_init(areq); in safexcel_hmac_sha384_digest()
1745 return safexcel_ahash_finup(areq); in safexcel_hmac_sha384_digest()
1780 static int safexcel_md5_init(struct ahash_request *areq) in safexcel_md5_init() argument
1782 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_md5_init()
1783 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_md5_init()
1796 static int safexcel_md5_digest(struct ahash_request *areq) in safexcel_md5_digest() argument
1798 int ret = safexcel_md5_init(areq); in safexcel_md5_digest()
1803 return safexcel_ahash_finup(areq); in safexcel_md5_digest()
1837 static int safexcel_hmac_md5_init(struct ahash_request *areq) in safexcel_hmac_md5_init() argument
1839 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_md5_init()
1840 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_md5_init()
1868 static int safexcel_hmac_md5_digest(struct ahash_request *areq) in safexcel_hmac_md5_digest() argument
1870 int ret = safexcel_hmac_md5_init(areq); in safexcel_hmac_md5_digest()
1875 return safexcel_ahash_finup(areq); in safexcel_hmac_md5_digest()
1920 static int safexcel_crc32_init(struct ahash_request *areq) in safexcel_crc32_init() argument
1922 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_crc32_init()
1923 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_crc32_init()
1954 static int safexcel_crc32_digest(struct ahash_request *areq) in safexcel_crc32_digest() argument
1956 return safexcel_crc32_init(areq) ?: safexcel_ahash_finup(areq); in safexcel_crc32_digest()
1992 static int safexcel_cbcmac_init(struct ahash_request *areq) in safexcel_cbcmac_init() argument
1994 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_cbcmac_init()
1995 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_cbcmac_init()
2045 static int safexcel_cbcmac_digest(struct ahash_request *areq) in safexcel_cbcmac_digest() argument
2047 return safexcel_cbcmac_init(areq) ?: safexcel_ahash_finup(areq); in safexcel_cbcmac_digest()
2273 static int safexcel_sm3_init(struct ahash_request *areq) in safexcel_sm3_init() argument
2275 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sm3_init()
2276 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_sm3_init()
2289 static int safexcel_sm3_digest(struct ahash_request *areq) in safexcel_sm3_digest() argument
2291 int ret = safexcel_sm3_init(areq); in safexcel_sm3_digest()
2296 return safexcel_ahash_finup(areq); in safexcel_sm3_digest()
2337 static int safexcel_hmac_sm3_init(struct ahash_request *areq) in safexcel_hmac_sm3_init() argument
2339 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sm3_init()
2340 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_sm3_init()
2360 static int safexcel_hmac_sm3_digest(struct ahash_request *areq) in safexcel_hmac_sm3_digest() argument
2362 int ret = safexcel_hmac_sm3_init(areq); in safexcel_hmac_sm3_digest()
2367 return safexcel_ahash_finup(areq); in safexcel_hmac_sm3_digest()
2402 static int safexcel_sha3_224_init(struct ahash_request *areq) in safexcel_sha3_224_init() argument
2404 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_sha3_224_init()
2406 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_sha3_224_init()
2595 static int safexcel_sha3_256_init(struct ahash_request *areq) in safexcel_sha3_256_init() argument
2597 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_sha3_256_init()
2599 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_sha3_256_init()
2653 static int safexcel_sha3_384_init(struct ahash_request *areq) in safexcel_sha3_384_init() argument
2655 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_sha3_384_init()
2657 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_sha3_384_init()
2711 static int safexcel_sha3_512_init(struct ahash_request *areq) in safexcel_sha3_512_init() argument
2713 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_sha3_512_init()
2715 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_sha3_512_init()
2861 static int safexcel_hmac_sha3_224_init(struct ahash_request *areq) in safexcel_hmac_sha3_224_init() argument
2863 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_hmac_sha3_224_init()
2865 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_sha3_224_init()
2932 static int safexcel_hmac_sha3_256_init(struct ahash_request *areq) in safexcel_hmac_sha3_256_init() argument
2934 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_hmac_sha3_256_init()
2936 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_sha3_256_init()
3003 static int safexcel_hmac_sha3_384_init(struct ahash_request *areq) in safexcel_hmac_sha3_384_init() argument
3005 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_hmac_sha3_384_init()
3007 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_sha3_384_init()
3074 static int safexcel_hmac_sha3_512_init(struct ahash_request *areq) in safexcel_hmac_sha3_512_init() argument
3076 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); in safexcel_hmac_sha3_512_init()
3078 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_sha3_512_init()