Lines Matching refs:tsgl
529 static int init_test_sglist(struct test_sglist *tsgl) in init_test_sglist() argument
531 return __testmgr_alloc_buf(tsgl->bufs, 1 /* two pages per buffer */); in init_test_sglist()
534 static void destroy_test_sglist(struct test_sglist *tsgl) in destroy_test_sglist() argument
536 return __testmgr_free_buf(tsgl->bufs, 1 /* two pages per buffer */); in destroy_test_sglist()
557 static int build_test_sglist(struct test_sglist *tsgl, in build_test_sglist() argument
572 BUILD_BUG_ON(ARRAY_SIZE(partitions) != ARRAY_SIZE(tsgl->sgl)); in build_test_sglist()
577 tsgl->nents = 0; in build_test_sglist()
585 partitions[tsgl->nents].div = &divs[i]; in build_test_sglist()
586 partitions[tsgl->nents].length = len_this_sg; in build_test_sglist()
587 tsgl->nents++; in build_test_sglist()
591 if (tsgl->nents == 0) { in build_test_sglist()
592 partitions[tsgl->nents].div = &divs[0]; in build_test_sglist()
593 partitions[tsgl->nents].length = 0; in build_test_sglist()
594 tsgl->nents++; in build_test_sglist()
596 partitions[tsgl->nents - 1].length += len_remaining; in build_test_sglist()
599 sg_init_table(tsgl->sgl, tsgl->nents); in build_test_sglist()
600 for (i = 0; i < tsgl->nents; i++) { in build_test_sglist()
614 addr = &tsgl->bufs[i][offset]; in build_test_sglist()
615 sg_set_buf(&tsgl->sgl[i], addr, partitions[i].length); in build_test_sglist()
635 sg_mark_end(&tsgl->sgl[tsgl->nents - 1]); in build_test_sglist()
636 tsgl->sgl_ptr = tsgl->sgl; in build_test_sglist()
637 memcpy(tsgl->sgl_saved, tsgl->sgl, tsgl->nents * sizeof(tsgl->sgl[0])); in build_test_sglist()
652 static int verify_correct_output(const struct test_sglist *tsgl, in verify_correct_output() argument
660 for (i = 0; i < tsgl->nents; i++) { in verify_correct_output()
661 struct scatterlist *sg = &tsgl->sgl_ptr[i]; in verify_correct_output()
690 static bool is_test_sglist_corrupted(const struct test_sglist *tsgl) in is_test_sglist_corrupted() argument
694 for (i = 0; i < tsgl->nents; i++) { in is_test_sglist_corrupted()
695 if (tsgl->sgl[i].page_link != tsgl->sgl_saved[i].page_link) in is_test_sglist_corrupted()
697 if (tsgl->sgl[i].offset != tsgl->sgl_saved[i].offset) in is_test_sglist_corrupted()
699 if (tsgl->sgl[i].length != tsgl->sgl_saved[i].length) in is_test_sglist_corrupted()
1125 static int build_hash_sglist(struct test_sglist *tsgl, in build_hash_sglist() argument
1137 return build_test_sglist(tsgl, cfg->src_divs, alignmask, vec->psize, in build_hash_sglist()
1182 struct test_sglist *tsgl, in test_shash_vec_cfg() argument
1214 err = build_hash_sglist(tsgl, vec, cfg, alignmask, divs); in test_shash_vec_cfg()
1229 if (tsgl->nents != 1) in test_shash_vec_cfg()
1233 err = crypto_shash_digest(desc, sg_data(&tsgl->sgl[0]), in test_shash_vec_cfg()
1234 tsgl->sgl[0].length, result); in test_shash_vec_cfg()
1264 for (i = 0; i < tsgl->nents; i++) { in test_shash_vec_cfg()
1265 if (i + 1 == tsgl->nents && in test_shash_vec_cfg()
1269 err = crypto_shash_finup(desc, sg_data(&tsgl->sgl[i]), in test_shash_vec_cfg()
1270 tsgl->sgl[i].length, result); in test_shash_vec_cfg()
1281 err = crypto_shash_update(desc, sg_data(&tsgl->sgl[i]), in test_shash_vec_cfg()
1282 tsgl->sgl[i].length); in test_shash_vec_cfg()
1366 struct test_sglist *tsgl, in test_ahash_vec_cfg() argument
1402 err = build_hash_sglist(tsgl, vec, cfg, alignmask, divs); in test_ahash_vec_cfg()
1419 ahash_request_set_crypt(req, tsgl->sgl, result, vec->psize); in test_ahash_vec_cfg()
1449 for (i = 0; i < tsgl->nents; i++) { in test_ahash_vec_cfg()
1493 pending_sgl = &tsgl->sgl[i]; in test_ahash_vec_cfg()
1494 pending_len += tsgl->sgl[i].length; in test_ahash_vec_cfg()
1533 struct test_sglist *tsgl, in test_hash_vec_cfg() argument
1545 err = test_shash_vec_cfg(driver, vec, vec_name, cfg, desc, tsgl, in test_hash_vec_cfg()
1551 return test_ahash_vec_cfg(driver, vec, vec_name, cfg, req, tsgl, in test_hash_vec_cfg()
1557 struct shash_desc *desc, struct test_sglist *tsgl, in test_hash_vec() argument
1569 req, desc, tsgl, hashstate); in test_hash_vec()
1583 req, desc, tsgl, hashstate); in test_hash_vec()
1644 struct test_sglist *tsgl, in test_hash_vs_generic_impl() argument
1739 req, desc, tsgl, hashstate); in test_hash_vs_generic_impl()
1760 struct test_sglist *tsgl, in test_hash_vs_generic_impl() argument
1809 struct test_sglist *tsgl = NULL; in __alg_test_hash() local
1843 tsgl = kmalloc(sizeof(*tsgl), GFP_KERNEL); in __alg_test_hash()
1844 if (!tsgl || init_test_sglist(tsgl) != 0) { in __alg_test_hash()
1847 kfree(tsgl); in __alg_test_hash()
1848 tsgl = NULL; in __alg_test_hash()
1865 err = test_hash_vec(driver, &vecs[i], i, req, desc, tsgl, in __alg_test_hash()
1872 desc, tsgl, hashstate); in __alg_test_hash()
1875 if (tsgl) { in __alg_test_hash()
1876 destroy_test_sglist(tsgl); in __alg_test_hash()
1877 kfree(tsgl); in __alg_test_hash()