Lines Matching refs:tsgl

499 static int init_test_sglist(struct test_sglist *tsgl)  in init_test_sglist()  argument
501 return __testmgr_alloc_buf(tsgl->bufs, 1 /* two pages per buffer */); in init_test_sglist()
504 static void destroy_test_sglist(struct test_sglist *tsgl) in destroy_test_sglist() argument
506 return __testmgr_free_buf(tsgl->bufs, 1 /* two pages per buffer */); in destroy_test_sglist()
527 static int build_test_sglist(struct test_sglist *tsgl, in build_test_sglist() argument
542 BUILD_BUG_ON(ARRAY_SIZE(partitions) != ARRAY_SIZE(tsgl->sgl)); in build_test_sglist()
547 tsgl->nents = 0; in build_test_sglist()
555 partitions[tsgl->nents].div = &divs[i]; in build_test_sglist()
556 partitions[tsgl->nents].length = len_this_sg; in build_test_sglist()
557 tsgl->nents++; in build_test_sglist()
561 if (tsgl->nents == 0) { in build_test_sglist()
562 partitions[tsgl->nents].div = &divs[0]; in build_test_sglist()
563 partitions[tsgl->nents].length = 0; in build_test_sglist()
564 tsgl->nents++; in build_test_sglist()
566 partitions[tsgl->nents - 1].length += len_remaining; in build_test_sglist()
569 sg_init_table(tsgl->sgl, tsgl->nents); in build_test_sglist()
570 for (i = 0; i < tsgl->nents; i++) { in build_test_sglist()
584 addr = &tsgl->bufs[i][offset]; in build_test_sglist()
585 sg_set_buf(&tsgl->sgl[i], addr, partitions[i].length); in build_test_sglist()
605 sg_mark_end(&tsgl->sgl[tsgl->nents - 1]); in build_test_sglist()
606 tsgl->sgl_ptr = tsgl->sgl; in build_test_sglist()
607 memcpy(tsgl->sgl_saved, tsgl->sgl, tsgl->nents * sizeof(tsgl->sgl[0])); in build_test_sglist()
622 static int verify_correct_output(const struct test_sglist *tsgl, in verify_correct_output() argument
630 for (i = 0; i < tsgl->nents; i++) { in verify_correct_output()
631 struct scatterlist *sg = &tsgl->sgl_ptr[i]; in verify_correct_output()
660 static bool is_test_sglist_corrupted(const struct test_sglist *tsgl) in is_test_sglist_corrupted() argument
664 for (i = 0; i < tsgl->nents; i++) { in is_test_sglist_corrupted()
665 if (tsgl->sgl[i].page_link != tsgl->sgl_saved[i].page_link) in is_test_sglist_corrupted()
667 if (tsgl->sgl[i].offset != tsgl->sgl_saved[i].offset) in is_test_sglist_corrupted()
669 if (tsgl->sgl[i].length != tsgl->sgl_saved[i].length) in is_test_sglist_corrupted()
1035 static int build_hash_sglist(struct test_sglist *tsgl, in build_hash_sglist() argument
1047 return build_test_sglist(tsgl, cfg->src_divs, alignmask, vec->psize, in build_hash_sglist()
1092 struct test_sglist *tsgl, in test_shash_vec_cfg() argument
1123 err = build_hash_sglist(tsgl, vec, cfg, alignmask, divs); in test_shash_vec_cfg()
1138 if (tsgl->nents != 1) in test_shash_vec_cfg()
1142 err = crypto_shash_digest(desc, sg_data(&tsgl->sgl[0]), in test_shash_vec_cfg()
1143 tsgl->sgl[0].length, result); in test_shash_vec_cfg()
1173 for (i = 0; i < tsgl->nents; i++) { in test_shash_vec_cfg()
1174 if (i + 1 == tsgl->nents && in test_shash_vec_cfg()
1178 err = crypto_shash_finup(desc, sg_data(&tsgl->sgl[i]), in test_shash_vec_cfg()
1179 tsgl->sgl[i].length, result); in test_shash_vec_cfg()
1190 err = crypto_shash_update(desc, sg_data(&tsgl->sgl[i]), in test_shash_vec_cfg()
1191 tsgl->sgl[i].length); in test_shash_vec_cfg()
1275 struct test_sglist *tsgl, in test_ahash_vec_cfg() argument
1310 err = build_hash_sglist(tsgl, vec, cfg, alignmask, divs); in test_ahash_vec_cfg()
1327 ahash_request_set_crypt(req, tsgl->sgl, result, vec->psize); in test_ahash_vec_cfg()
1357 for (i = 0; i < tsgl->nents; i++) { in test_ahash_vec_cfg()
1401 pending_sgl = &tsgl->sgl[i]; in test_ahash_vec_cfg()
1402 pending_len += tsgl->sgl[i].length; in test_ahash_vec_cfg()
1441 struct test_sglist *tsgl, in test_hash_vec_cfg() argument
1453 err = test_shash_vec_cfg(driver, vec, vec_name, cfg, desc, tsgl, in test_hash_vec_cfg()
1459 return test_ahash_vec_cfg(driver, vec, vec_name, cfg, req, tsgl, in test_hash_vec_cfg()
1465 struct shash_desc *desc, struct test_sglist *tsgl, in test_hash_vec() argument
1477 req, desc, tsgl, hashstate); in test_hash_vec()
1491 req, desc, tsgl, hashstate); in test_hash_vec()
1552 struct test_sglist *tsgl, in test_hash_vs_generic_impl() argument
1647 req, desc, tsgl, hashstate); in test_hash_vs_generic_impl()
1668 struct test_sglist *tsgl, in test_hash_vs_generic_impl() argument
1717 struct test_sglist *tsgl = NULL; in __alg_test_hash() local
1751 tsgl = kmalloc(sizeof(*tsgl), GFP_KERNEL); in __alg_test_hash()
1752 if (!tsgl || init_test_sglist(tsgl) != 0) { in __alg_test_hash()
1755 kfree(tsgl); in __alg_test_hash()
1756 tsgl = NULL; in __alg_test_hash()
1773 err = test_hash_vec(driver, &vecs[i], i, req, desc, tsgl, in __alg_test_hash()
1780 desc, tsgl, hashstate); in __alg_test_hash()
1783 if (tsgl) { in __alg_test_hash()
1784 destroy_test_sglist(tsgl); in __alg_test_hash()
1785 kfree(tsgl); in __alg_test_hash()