Lines Matching refs:areq

174 static int safexcel_ahash_enqueue(struct ahash_request *areq);
182 struct ahash_request *areq = ahash_request_cast(async); in safexcel_handle_req_result() local
183 struct crypto_ahash *ahash = crypto_ahash_reqtfm(areq); in safexcel_handle_req_result()
184 struct safexcel_ahash_req *sreq = ahash_request_ctx(areq); in safexcel_handle_req_result()
202 dma_unmap_sg(priv->dev, areq->src, sreq->nents, DMA_TO_DEVICE); in safexcel_handle_req_result()
234 areq->nbytes = 0; in safexcel_handle_req_result()
235 safexcel_ahash_enqueue(areq); in safexcel_handle_req_result()
241 memcpy(areq->result, sreq->state, in safexcel_handle_req_result()
257 struct ahash_request *areq = ahash_request_cast(async); in safexcel_ahash_send_req() local
258 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_ahash_send_req()
259 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_ahash_send_req()
271 cache_len = queued - areq->nbytes; in safexcel_ahash_send_req()
285 sg_pcopy_to_buffer(areq->src, sg_nents(areq->src), in safexcel_ahash_send_req()
287 areq->nbytes - extra); in safexcel_ahash_send_req()
323 if (!areq->nbytes) in safexcel_ahash_send_req()
327 req->nents = dma_map_sg(priv->dev, areq->src, in safexcel_ahash_send_req()
328 sg_nents_for_len(areq->src, in safexcel_ahash_send_req()
329 areq->nbytes), in safexcel_ahash_send_req()
336 for_each_sg(areq->src, sg, req->nents, i) { in safexcel_ahash_send_req()
383 safexcel_rdr_req_set(priv, ring, rdesc, &areq->base); in safexcel_ahash_send_req()
395 dma_unmap_sg(priv->dev, areq->src, req->nents, DMA_TO_DEVICE); in safexcel_ahash_send_req()
416 struct ahash_request *areq = ahash_request_cast(async); in safexcel_handle_inv_result() local
417 struct crypto_ahash *ahash = crypto_ahash_reqtfm(areq); in safexcel_handle_inv_result()
464 struct ahash_request *areq = ahash_request_cast(async); in safexcel_handle_result() local
465 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_handle_result()
485 struct ahash_request *areq = ahash_request_cast(async); in safexcel_ahash_send_inv() local
486 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_ahash_send_inv()
503 struct ahash_request *areq = ahash_request_cast(async); in safexcel_ahash_send() local
504 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_ahash_send()
557 static int safexcel_ahash_cache(struct ahash_request *areq) in safexcel_ahash_cache() argument
559 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_ahash_cache()
571 if (cache_len + areq->nbytes <= HASH_CACHE_SIZE) { in safexcel_ahash_cache()
572 sg_pcopy_to_buffer(areq->src, sg_nents(areq->src), in safexcel_ahash_cache()
574 areq->nbytes, 0); in safexcel_ahash_cache()
582 static int safexcel_ahash_enqueue(struct ahash_request *areq) in safexcel_ahash_enqueue() argument
584 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_ahash_enqueue()
585 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_ahash_enqueue()
620 EIP197_GFP_FLAGS(areq->base), in safexcel_ahash_enqueue()
629 ret = crypto_enqueue_request(&priv->ring[ring].queue, &areq->base); in safexcel_ahash_enqueue()
638 static int safexcel_ahash_update(struct ahash_request *areq) in safexcel_ahash_update() argument
640 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_ahash_update()
644 if (!areq->nbytes) in safexcel_ahash_update()
648 ret = safexcel_ahash_cache(areq); in safexcel_ahash_update()
651 req->len += areq->nbytes; in safexcel_ahash_update()
658 return safexcel_ahash_enqueue(areq); in safexcel_ahash_update()
663 static int safexcel_ahash_final(struct ahash_request *areq) in safexcel_ahash_final() argument
665 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_ahash_final()
666 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_ahash_final()
670 if (unlikely(!req->len && !areq->nbytes)) { in safexcel_ahash_final()
677 memcpy(areq->result, md5_zero_message_hash, in safexcel_ahash_final()
680 memcpy(areq->result, sha1_zero_message_hash, in safexcel_ahash_final()
683 memcpy(areq->result, sha224_zero_message_hash, in safexcel_ahash_final()
686 memcpy(areq->result, sha256_zero_message_hash, in safexcel_ahash_final()
689 memcpy(areq->result, sha384_zero_message_hash, in safexcel_ahash_final()
692 memcpy(areq->result, sha512_zero_message_hash, in safexcel_ahash_final()
698 !areq->nbytes)) { in safexcel_ahash_final()
735 return safexcel_ahash_enqueue(areq); in safexcel_ahash_final()
738 static int safexcel_ahash_finup(struct ahash_request *areq) in safexcel_ahash_finup() argument
740 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_ahash_finup()
744 safexcel_ahash_update(areq); in safexcel_ahash_finup()
745 return safexcel_ahash_final(areq); in safexcel_ahash_finup()
748 static int safexcel_ahash_export(struct ahash_request *areq, void *out) in safexcel_ahash_export() argument
750 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_ahash_export()
764 static int safexcel_ahash_import(struct ahash_request *areq, const void *in) in safexcel_ahash_import() argument
766 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_ahash_import()
770 ret = crypto_ahash_init(areq); in safexcel_ahash_import()
801 static int safexcel_sha1_init(struct ahash_request *areq) in safexcel_sha1_init() argument
803 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sha1_init()
804 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_sha1_init()
816 static int safexcel_sha1_digest(struct ahash_request *areq) in safexcel_sha1_digest() argument
818 int ret = safexcel_sha1_init(areq); in safexcel_sha1_digest()
823 return safexcel_ahash_finup(areq); in safexcel_sha1_digest()
876 static int safexcel_hmac_sha1_init(struct ahash_request *areq) in safexcel_hmac_sha1_init() argument
878 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sha1_init()
879 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_sha1_init()
898 static int safexcel_hmac_sha1_digest(struct ahash_request *areq) in safexcel_hmac_sha1_digest() argument
900 int ret = safexcel_hmac_sha1_init(areq); in safexcel_hmac_sha1_digest()
905 return safexcel_ahash_finup(areq); in safexcel_hmac_sha1_digest()
924 static int safexcel_hmac_init_pad(struct ahash_request *areq, in safexcel_hmac_init_pad() argument
940 ahash_request_set_callback(areq, CRYPTO_TFM_REQ_MAY_BACKLOG, in safexcel_hmac_init_pad()
943 ahash_request_set_crypt(areq, &sg, ipad, keylen); in safexcel_hmac_init_pad()
946 ret = crypto_ahash_digest(areq); in safexcel_hmac_init_pad()
959 keylen = crypto_ahash_digestsize(crypto_ahash_reqtfm(areq)); in safexcel_hmac_init_pad()
973 static int safexcel_hmac_init_iv(struct ahash_request *areq, in safexcel_hmac_init_iv() argument
981 ahash_request_set_callback(areq, CRYPTO_TFM_REQ_MAY_BACKLOG, in safexcel_hmac_init_iv()
984 ahash_request_set_crypt(areq, &sg, pad, blocksize); in safexcel_hmac_init_iv()
987 ret = crypto_ahash_init(areq); in safexcel_hmac_init_iv()
991 req = ahash_request_ctx(areq); in safexcel_hmac_init_iv()
995 ret = crypto_ahash_update(areq); in safexcel_hmac_init_iv()
1003 return crypto_ahash_export(areq, state); in safexcel_hmac_init_iv()
1009 struct ahash_request *areq; in safexcel_hmac_setkey() local
1019 areq = ahash_request_alloc(tfm, GFP_KERNEL); in safexcel_hmac_setkey()
1020 if (!areq) { in safexcel_hmac_setkey()
1036 ret = safexcel_hmac_init_pad(areq, blocksize, key, keylen, ipad, opad); in safexcel_hmac_setkey()
1040 ret = safexcel_hmac_init_iv(areq, blocksize, ipad, istate); in safexcel_hmac_setkey()
1044 ret = safexcel_hmac_init_iv(areq, blocksize, opad, ostate); in safexcel_hmac_setkey()
1049 ahash_request_free(areq); in safexcel_hmac_setkey()
1118 static int safexcel_sha256_init(struct ahash_request *areq) in safexcel_sha256_init() argument
1120 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sha256_init()
1121 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_sha256_init()
1133 static int safexcel_sha256_digest(struct ahash_request *areq) in safexcel_sha256_digest() argument
1135 int ret = safexcel_sha256_init(areq); in safexcel_sha256_digest()
1140 return safexcel_ahash_finup(areq); in safexcel_sha256_digest()
1173 static int safexcel_sha224_init(struct ahash_request *areq) in safexcel_sha224_init() argument
1175 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sha224_init()
1176 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_sha224_init()
1188 static int safexcel_sha224_digest(struct ahash_request *areq) in safexcel_sha224_digest() argument
1190 int ret = safexcel_sha224_init(areq); in safexcel_sha224_digest()
1195 return safexcel_ahash_finup(areq); in safexcel_sha224_digest()
1235 static int safexcel_hmac_sha224_init(struct ahash_request *areq) in safexcel_hmac_sha224_init() argument
1237 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sha224_init()
1238 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_sha224_init()
1257 static int safexcel_hmac_sha224_digest(struct ahash_request *areq) in safexcel_hmac_sha224_digest() argument
1259 int ret = safexcel_hmac_sha224_init(areq); in safexcel_hmac_sha224_digest()
1264 return safexcel_ahash_finup(areq); in safexcel_hmac_sha224_digest()
1305 static int safexcel_hmac_sha256_init(struct ahash_request *areq) in safexcel_hmac_sha256_init() argument
1307 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sha256_init()
1308 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_sha256_init()
1327 static int safexcel_hmac_sha256_digest(struct ahash_request *areq) in safexcel_hmac_sha256_digest() argument
1329 int ret = safexcel_hmac_sha256_init(areq); in safexcel_hmac_sha256_digest()
1334 return safexcel_ahash_finup(areq); in safexcel_hmac_sha256_digest()
1368 static int safexcel_sha512_init(struct ahash_request *areq) in safexcel_sha512_init() argument
1370 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sha512_init()
1371 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_sha512_init()
1383 static int safexcel_sha512_digest(struct ahash_request *areq) in safexcel_sha512_digest() argument
1385 int ret = safexcel_sha512_init(areq); in safexcel_sha512_digest()
1390 return safexcel_ahash_finup(areq); in safexcel_sha512_digest()
1423 static int safexcel_sha384_init(struct ahash_request *areq) in safexcel_sha384_init() argument
1425 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_sha384_init()
1426 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_sha384_init()
1438 static int safexcel_sha384_digest(struct ahash_request *areq) in safexcel_sha384_digest() argument
1440 int ret = safexcel_sha384_init(areq); in safexcel_sha384_digest()
1445 return safexcel_ahash_finup(areq); in safexcel_sha384_digest()
1485 static int safexcel_hmac_sha512_init(struct ahash_request *areq) in safexcel_hmac_sha512_init() argument
1487 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sha512_init()
1488 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_sha512_init()
1507 static int safexcel_hmac_sha512_digest(struct ahash_request *areq) in safexcel_hmac_sha512_digest() argument
1509 int ret = safexcel_hmac_sha512_init(areq); in safexcel_hmac_sha512_digest()
1514 return safexcel_ahash_finup(areq); in safexcel_hmac_sha512_digest()
1555 static int safexcel_hmac_sha384_init(struct ahash_request *areq) in safexcel_hmac_sha384_init() argument
1557 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_sha384_init()
1558 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_sha384_init()
1577 static int safexcel_hmac_sha384_digest(struct ahash_request *areq) in safexcel_hmac_sha384_digest() argument
1579 int ret = safexcel_hmac_sha384_init(areq); in safexcel_hmac_sha384_digest()
1584 return safexcel_ahash_finup(areq); in safexcel_hmac_sha384_digest()
1618 static int safexcel_md5_init(struct ahash_request *areq) in safexcel_md5_init() argument
1620 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_md5_init()
1621 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_md5_init()
1633 static int safexcel_md5_digest(struct ahash_request *areq) in safexcel_md5_digest() argument
1635 int ret = safexcel_md5_init(areq); in safexcel_md5_digest()
1640 return safexcel_ahash_finup(areq); in safexcel_md5_digest()
1673 static int safexcel_hmac_md5_init(struct ahash_request *areq) in safexcel_hmac_md5_init() argument
1675 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(areq)); in safexcel_hmac_md5_init()
1676 struct safexcel_ahash_req *req = ahash_request_ctx(areq); in safexcel_hmac_md5_init()
1703 static int safexcel_hmac_md5_digest(struct ahash_request *areq) in safexcel_hmac_md5_digest() argument
1705 int ret = safexcel_hmac_md5_init(areq); in safexcel_hmac_md5_digest()
1710 return safexcel_ahash_finup(areq); in safexcel_hmac_md5_digest()