Lines Matching refs:tsgl
553 static int init_test_sglist(struct test_sglist *tsgl) in init_test_sglist() argument
555 return __testmgr_alloc_buf(tsgl->bufs, 1 /* two pages per buffer */); in init_test_sglist()
558 static void destroy_test_sglist(struct test_sglist *tsgl) in destroy_test_sglist() argument
560 return __testmgr_free_buf(tsgl->bufs, 1 /* two pages per buffer */); in destroy_test_sglist()
581 static int build_test_sglist(struct test_sglist *tsgl, in build_test_sglist() argument
596 BUILD_BUG_ON(ARRAY_SIZE(partitions) != ARRAY_SIZE(tsgl->sgl)); in build_test_sglist()
601 tsgl->nents = 0; in build_test_sglist()
609 partitions[tsgl->nents].div = &divs[i]; in build_test_sglist()
610 partitions[tsgl->nents].length = len_this_sg; in build_test_sglist()
611 tsgl->nents++; in build_test_sglist()
615 if (tsgl->nents == 0) { in build_test_sglist()
616 partitions[tsgl->nents].div = &divs[0]; in build_test_sglist()
617 partitions[tsgl->nents].length = 0; in build_test_sglist()
618 tsgl->nents++; in build_test_sglist()
620 partitions[tsgl->nents - 1].length += len_remaining; in build_test_sglist()
623 sg_init_table(tsgl->sgl, tsgl->nents); in build_test_sglist()
624 for (i = 0; i < tsgl->nents; i++) { in build_test_sglist()
638 addr = &tsgl->bufs[i][offset]; in build_test_sglist()
639 sg_set_buf(&tsgl->sgl[i], addr, partitions[i].length); in build_test_sglist()
659 sg_mark_end(&tsgl->sgl[tsgl->nents - 1]); in build_test_sglist()
660 tsgl->sgl_ptr = tsgl->sgl; in build_test_sglist()
661 memcpy(tsgl->sgl_saved, tsgl->sgl, tsgl->nents * sizeof(tsgl->sgl[0])); in build_test_sglist()
676 static int verify_correct_output(const struct test_sglist *tsgl, in verify_correct_output() argument
684 for (i = 0; i < tsgl->nents; i++) { in verify_correct_output()
685 struct scatterlist *sg = &tsgl->sgl_ptr[i]; in verify_correct_output()
714 static bool is_test_sglist_corrupted(const struct test_sglist *tsgl) in is_test_sglist_corrupted() argument
718 for (i = 0; i < tsgl->nents; i++) { in is_test_sglist_corrupted()
719 if (tsgl->sgl[i].page_link != tsgl->sgl_saved[i].page_link) in is_test_sglist_corrupted()
721 if (tsgl->sgl[i].offset != tsgl->sgl_saved[i].offset) in is_test_sglist_corrupted()
723 if (tsgl->sgl[i].length != tsgl->sgl_saved[i].length) in is_test_sglist_corrupted()
1223 static int build_hash_sglist(struct test_sglist *tsgl, in build_hash_sglist() argument
1235 return build_test_sglist(tsgl, cfg->src_divs, alignmask, vec->psize, in build_hash_sglist()
1274 struct test_sglist *tsgl, in test_shash_vec_cfg() argument
1307 err = build_hash_sglist(tsgl, vec, cfg, alignmask, divs); in test_shash_vec_cfg()
1322 if (tsgl->nents != 1) in test_shash_vec_cfg()
1326 err = crypto_shash_digest(desc, sg_virt(&tsgl->sgl[0]), in test_shash_vec_cfg()
1327 tsgl->sgl[0].length, result); in test_shash_vec_cfg()
1357 for (i = 0; i < tsgl->nents; i++) { in test_shash_vec_cfg()
1358 if (i + 1 == tsgl->nents && in test_shash_vec_cfg()
1362 err = crypto_shash_finup(desc, sg_virt(&tsgl->sgl[i]), in test_shash_vec_cfg()
1363 tsgl->sgl[i].length, result); in test_shash_vec_cfg()
1374 err = crypto_shash_update(desc, sg_virt(&tsgl->sgl[i]), in test_shash_vec_cfg()
1375 tsgl->sgl[i].length); in test_shash_vec_cfg()
1458 struct test_sglist *tsgl, in test_ahash_vec_cfg() argument
1495 err = build_hash_sglist(tsgl, vec, cfg, alignmask, divs); in test_ahash_vec_cfg()
1512 ahash_request_set_crypt(req, tsgl->sgl, result, vec->psize); in test_ahash_vec_cfg()
1542 for (i = 0; i < tsgl->nents; i++) { in test_ahash_vec_cfg()
1586 pending_sgl = &tsgl->sgl[i]; in test_ahash_vec_cfg()
1587 pending_len += tsgl->sgl[i].length; in test_ahash_vec_cfg()
1625 struct test_sglist *tsgl, in test_hash_vec_cfg() argument
1637 err = test_shash_vec_cfg(vec, vec_name, cfg, desc, tsgl, in test_hash_vec_cfg()
1643 return test_ahash_vec_cfg(vec, vec_name, cfg, req, tsgl, hashstate); in test_hash_vec_cfg()
1648 struct test_sglist *tsgl, u8 *hashstate) in test_hash_vec() argument
1659 req, desc, tsgl, hashstate); in test_hash_vec()
1676 req, desc, tsgl, hashstate); in test_hash_vec()
1737 struct test_sglist *tsgl, in test_hash_vs_generic_impl() argument
1837 req, desc, tsgl, hashstate); in test_hash_vs_generic_impl()
1857 struct test_sglist *tsgl, in test_hash_vs_generic_impl() argument
1906 struct test_sglist *tsgl = NULL; in __alg_test_hash() local
1941 tsgl = kmalloc(sizeof(*tsgl), GFP_KERNEL); in __alg_test_hash()
1942 if (!tsgl || init_test_sglist(tsgl) != 0) { in __alg_test_hash()
1945 kfree(tsgl); in __alg_test_hash()
1946 tsgl = NULL; in __alg_test_hash()
1966 err = test_hash_vec(&vecs[i], i, req, desc, tsgl, hashstate); in __alg_test_hash()
1972 desc, tsgl, hashstate); in __alg_test_hash()
1975 if (tsgl) { in __alg_test_hash()
1976 destroy_test_sglist(tsgl); in __alg_test_hash()
1977 kfree(tsgl); in __alg_test_hash()