Lines Matching refs:tsgl

564 static int init_test_sglist(struct test_sglist *tsgl)  in init_test_sglist()  argument
566 return __testmgr_alloc_buf(tsgl->bufs, 1 /* two pages per buffer */); in init_test_sglist()
569 static void destroy_test_sglist(struct test_sglist *tsgl) in destroy_test_sglist() argument
571 return __testmgr_free_buf(tsgl->bufs, 1 /* two pages per buffer */); in destroy_test_sglist()
592 static int build_test_sglist(struct test_sglist *tsgl, in build_test_sglist() argument
607 BUILD_BUG_ON(ARRAY_SIZE(partitions) != ARRAY_SIZE(tsgl->sgl)); in build_test_sglist()
612 tsgl->nents = 0; in build_test_sglist()
620 partitions[tsgl->nents].div = &divs[i]; in build_test_sglist()
621 partitions[tsgl->nents].length = len_this_sg; in build_test_sglist()
622 tsgl->nents++; in build_test_sglist()
626 if (tsgl->nents == 0) { in build_test_sglist()
627 partitions[tsgl->nents].div = &divs[0]; in build_test_sglist()
628 partitions[tsgl->nents].length = 0; in build_test_sglist()
629 tsgl->nents++; in build_test_sglist()
631 partitions[tsgl->nents - 1].length += len_remaining; in build_test_sglist()
634 sg_init_table(tsgl->sgl, tsgl->nents); in build_test_sglist()
635 for (i = 0; i < tsgl->nents; i++) { in build_test_sglist()
649 addr = &tsgl->bufs[i][offset]; in build_test_sglist()
650 sg_set_buf(&tsgl->sgl[i], addr, partitions[i].length); in build_test_sglist()
670 sg_mark_end(&tsgl->sgl[tsgl->nents - 1]); in build_test_sglist()
671 tsgl->sgl_ptr = tsgl->sgl; in build_test_sglist()
672 memcpy(tsgl->sgl_saved, tsgl->sgl, tsgl->nents * sizeof(tsgl->sgl[0])); in build_test_sglist()
687 static int verify_correct_output(const struct test_sglist *tsgl, in verify_correct_output() argument
695 for (i = 0; i < tsgl->nents; i++) { in verify_correct_output()
696 struct scatterlist *sg = &tsgl->sgl_ptr[i]; in verify_correct_output()
725 static bool is_test_sglist_corrupted(const struct test_sglist *tsgl) in is_test_sglist_corrupted() argument
729 for (i = 0; i < tsgl->nents; i++) { in is_test_sglist_corrupted()
730 if (tsgl->sgl[i].page_link != tsgl->sgl_saved[i].page_link) in is_test_sglist_corrupted()
732 if (tsgl->sgl[i].offset != tsgl->sgl_saved[i].offset) in is_test_sglist_corrupted()
734 if (tsgl->sgl[i].length != tsgl->sgl_saved[i].length) in is_test_sglist_corrupted()
1255 static int build_hash_sglist(struct test_sglist *tsgl, in build_hash_sglist() argument
1267 return build_test_sglist(tsgl, cfg->src_divs, alignmask, vec->psize, in build_hash_sglist()
1306 struct test_sglist *tsgl, in test_shash_vec_cfg() argument
1338 err = build_hash_sglist(tsgl, vec, cfg, 0, divs); in test_shash_vec_cfg()
1353 if (tsgl->nents != 1) in test_shash_vec_cfg()
1357 err = crypto_shash_digest(desc, sg_virt(&tsgl->sgl[0]), in test_shash_vec_cfg()
1358 tsgl->sgl[0].length, result); in test_shash_vec_cfg()
1388 for (i = 0; i < tsgl->nents; i++) { in test_shash_vec_cfg()
1389 if (i + 1 == tsgl->nents && in test_shash_vec_cfg()
1393 err = crypto_shash_finup(desc, sg_virt(&tsgl->sgl[i]), in test_shash_vec_cfg()
1394 tsgl->sgl[i].length, result); in test_shash_vec_cfg()
1405 err = crypto_shash_update(desc, sg_virt(&tsgl->sgl[i]), in test_shash_vec_cfg()
1406 tsgl->sgl[i].length); in test_shash_vec_cfg()
1489 struct test_sglist *tsgl, in test_ahash_vec_cfg() argument
1525 err = build_hash_sglist(tsgl, vec, cfg, 0, divs); in test_ahash_vec_cfg()
1542 ahash_request_set_crypt(req, tsgl->sgl, result, vec->psize); in test_ahash_vec_cfg()
1572 for (i = 0; i < tsgl->nents; i++) { in test_ahash_vec_cfg()
1616 pending_sgl = &tsgl->sgl[i]; in test_ahash_vec_cfg()
1617 pending_len += tsgl->sgl[i].length; in test_ahash_vec_cfg()
1655 struct test_sglist *tsgl, in test_hash_vec_cfg() argument
1667 err = test_shash_vec_cfg(vec, vec_name, cfg, desc, tsgl, in test_hash_vec_cfg()
1673 return test_ahash_vec_cfg(vec, vec_name, cfg, req, tsgl, hashstate); in test_hash_vec_cfg()
1678 struct test_sglist *tsgl, u8 *hashstate) in test_hash_vec() argument
1689 req, desc, tsgl, hashstate); in test_hash_vec()
1706 req, desc, tsgl, hashstate); in test_hash_vec()
1767 struct test_sglist *tsgl, in test_hash_vs_generic_impl() argument
1867 req, desc, tsgl, hashstate); in test_hash_vs_generic_impl()
1887 struct test_sglist *tsgl, in test_hash_vs_generic_impl() argument
1936 struct test_sglist *tsgl = NULL; in __alg_test_hash() local
1973 tsgl = kmalloc(sizeof(*tsgl), GFP_KERNEL); in __alg_test_hash()
1974 if (!tsgl || init_test_sglist(tsgl) != 0) { in __alg_test_hash()
1977 kfree(tsgl); in __alg_test_hash()
1978 tsgl = NULL; in __alg_test_hash()
1998 err = test_hash_vec(&vecs[i], i, req, desc, tsgl, hashstate); in __alg_test_hash()
2004 desc, tsgl, hashstate); in __alg_test_hash()
2007 if (tsgl) { in __alg_test_hash()
2008 destroy_test_sglist(tsgl); in __alg_test_hash()
2009 kfree(tsgl); in __alg_test_hash()