Lines Matching refs:tsgl

563 static int init_test_sglist(struct test_sglist *tsgl)
565 return __testmgr_alloc_buf(tsgl->bufs, 1 /* two pages per buffer */);
568 static void destroy_test_sglist(struct test_sglist *tsgl)
570 return __testmgr_free_buf(tsgl->bufs, 1 /* two pages per buffer */);
576 * @tsgl: the scatterlist to build. @tsgl->bufs[] contains an array of 2-page
577 * buffers which the scatterlist @tsgl->sgl[] will be made to point into.
591 static int build_test_sglist(struct test_sglist *tsgl,
606 BUILD_BUG_ON(ARRAY_SIZE(partitions) != ARRAY_SIZE(tsgl->sgl));
611 tsgl->nents = 0;
619 partitions[tsgl->nents].div = &divs[i];
620 partitions[tsgl->nents].length = len_this_sg;
621 tsgl->nents++;
625 if (tsgl->nents == 0) {
626 partitions[tsgl->nents].div = &divs[0];
627 partitions[tsgl->nents].length = 0;
628 tsgl->nents++;
630 partitions[tsgl->nents - 1].length += len_remaining;
633 sg_init_table(tsgl->sgl, tsgl->nents);
634 for (i = 0; i < tsgl->nents; i++) {
648 addr = &tsgl->bufs[i][offset];
649 sg_set_buf(&tsgl->sgl[i], addr, partitions[i].length);
669 sg_mark_end(&tsgl->sgl[tsgl->nents - 1]);
670 tsgl->sgl_ptr = tsgl->sgl;
671 memcpy(tsgl->sgl_saved, tsgl->sgl, tsgl->nents * sizeof(tsgl->sgl[0]));
678 * @tsgl: scatterlist containing the actual output
681 * @unchecked_prefix_len: number of ignored bytes in @tsgl prior to real result
686 static int verify_correct_output(const struct test_sglist *tsgl,
694 for (i = 0; i < tsgl->nents; i++) {
695 struct scatterlist *sg = &tsgl->sgl_ptr[i];
724 static bool is_test_sglist_corrupted(const struct test_sglist *tsgl)
728 for (i = 0; i < tsgl->nents; i++) {
729 if (tsgl->sgl[i].page_link != tsgl->sgl_saved[i].page_link)
731 if (tsgl->sgl[i].offset != tsgl->sgl_saved[i].offset)
733 if (tsgl->sgl[i].length != tsgl->sgl_saved[i].length)
1247 static int build_hash_sglist(struct test_sglist *tsgl,
1259 return build_test_sglist(tsgl, cfg->src_divs, alignmask, vec->psize,
1298 struct test_sglist *tsgl,
1330 err = build_hash_sglist(tsgl, vec, cfg, 0, divs);
1345 if (tsgl->nents != 1)
1349 err = crypto_shash_digest(desc, sg_virt(&tsgl->sgl[0]),
1350 tsgl->sgl[0].length, result);
1380 for (i = 0; i < tsgl->nents; i++) {
1381 if (i + 1 == tsgl->nents &&
1385 err = crypto_shash_finup(desc, sg_virt(&tsgl->sgl[i]),
1386 tsgl->sgl[i].length, result);
1397 err = crypto_shash_update(desc, sg_virt(&tsgl->sgl[i]),
1398 tsgl->sgl[i].length);
1481 struct test_sglist *tsgl,
1517 err = build_hash_sglist(tsgl, vec, cfg, 0, divs);
1534 ahash_request_set_crypt(req, tsgl->sgl, result, vec->psize);
1564 for (i = 0; i < tsgl->nents; i++) {
1608 pending_sgl = &tsgl->sgl[i];
1609 pending_len += tsgl->sgl[i].length;
1647 struct test_sglist *tsgl,
1659 err = test_shash_vec_cfg(vec, vec_name, cfg, desc, tsgl,
1665 return test_ahash_vec_cfg(vec, vec_name, cfg, req, tsgl, hashstate);
1670 struct test_sglist *tsgl, u8 *hashstate)
1681 req, desc, tsgl, hashstate);
1697 req, desc, tsgl, hashstate);
1757 struct test_sglist *tsgl,
1855 req, desc, tsgl, hashstate);
1913 struct test_sglist *tsgl = NULL;
1950 tsgl = kmalloc(sizeof(*tsgl), GFP_KERNEL);
1951 if (!tsgl || init_test_sglist(tsgl) != 0) {
1954 kfree(tsgl);
1955 tsgl = NULL;
1975 err = test_hash_vec(&vecs[i], i, req, desc, tsgl, hashstate);
1981 desc, tsgl, hashstate);
1984 if (tsgl) {
1985 destroy_test_sglist(tsgl);
1986 kfree(tsgl);