Lines Matching refs:tsgl
526 static int init_test_sglist(struct test_sglist *tsgl)
528 return __testmgr_alloc_buf(tsgl->bufs, 1 /* two pages per buffer */);
531 static void destroy_test_sglist(struct test_sglist *tsgl)
533 return __testmgr_free_buf(tsgl->bufs, 1 /* two pages per buffer */);
539 * @tsgl: the scatterlist to build. @tsgl->bufs[] contains an array of 2-page
540 * buffers which the scatterlist @tsgl->sgl[] will be made to point into.
554 static int build_test_sglist(struct test_sglist *tsgl,
569 BUILD_BUG_ON(ARRAY_SIZE(partitions) != ARRAY_SIZE(tsgl->sgl));
574 tsgl->nents = 0;
582 partitions[tsgl->nents].div = &divs[i];
583 partitions[tsgl->nents].length = len_this_sg;
584 tsgl->nents++;
588 if (tsgl->nents == 0) {
589 partitions[tsgl->nents].div = &divs[0];
590 partitions[tsgl->nents].length = 0;
591 tsgl->nents++;
593 partitions[tsgl->nents - 1].length += len_remaining;
596 sg_init_table(tsgl->sgl, tsgl->nents);
597 for (i = 0; i < tsgl->nents; i++) {
611 addr = &tsgl->bufs[i][offset];
612 sg_set_buf(&tsgl->sgl[i], addr, partitions[i].length);
632 sg_mark_end(&tsgl->sgl[tsgl->nents - 1]);
633 tsgl->sgl_ptr = tsgl->sgl;
634 memcpy(tsgl->sgl_saved, tsgl->sgl, tsgl->nents * sizeof(tsgl->sgl[0]));
641 * @tsgl: scatterlist containing the actual output
644 * @unchecked_prefix_len: number of ignored bytes in @tsgl prior to real result
649 static int verify_correct_output(const struct test_sglist *tsgl,
657 for (i = 0; i < tsgl->nents; i++) {
658 struct scatterlist *sg = &tsgl->sgl_ptr[i];
687 static bool is_test_sglist_corrupted(const struct test_sglist *tsgl)
691 for (i = 0; i < tsgl->nents; i++) {
692 if (tsgl->sgl[i].page_link != tsgl->sgl_saved[i].page_link)
694 if (tsgl->sgl[i].offset != tsgl->sgl_saved[i].offset)
696 if (tsgl->sgl[i].length != tsgl->sgl_saved[i].length)
1122 static int build_hash_sglist(struct test_sglist *tsgl,
1134 return build_test_sglist(tsgl, cfg->src_divs, alignmask, vec->psize,
1179 struct test_sglist *tsgl,
1211 err = build_hash_sglist(tsgl, vec, cfg, alignmask, divs);
1226 if (tsgl->nents != 1)
1230 err = crypto_shash_digest(desc, sg_data(&tsgl->sgl[0]),
1231 tsgl->sgl[0].length, result);
1261 for (i = 0; i < tsgl->nents; i++) {
1262 if (i + 1 == tsgl->nents &&
1266 err = crypto_shash_finup(desc, sg_data(&tsgl->sgl[i]),
1267 tsgl->sgl[i].length, result);
1278 err = crypto_shash_update(desc, sg_data(&tsgl->sgl[i]),
1279 tsgl->sgl[i].length);
1363 struct test_sglist *tsgl,
1399 err = build_hash_sglist(tsgl, vec, cfg, alignmask, divs);
1416 ahash_request_set_crypt(req, tsgl->sgl, result, vec->psize);
1446 for (i = 0; i < tsgl->nents; i++) {
1490 pending_sgl = &tsgl->sgl[i];
1491 pending_len += tsgl->sgl[i].length;
1530 struct test_sglist *tsgl,
1542 err = test_shash_vec_cfg(driver, vec, vec_name, cfg, desc, tsgl,
1548 return test_ahash_vec_cfg(driver, vec, vec_name, cfg, req, tsgl,
1554 struct shash_desc *desc, struct test_sglist *tsgl,
1566 req, desc, tsgl, hashstate);
1580 req, desc, tsgl, hashstate);
1641 struct test_sglist *tsgl,
1736 req, desc, tsgl, hashstate);
1757 struct test_sglist *tsgl,
1806 struct test_sglist *tsgl = NULL;
1840 tsgl = kmalloc(sizeof(*tsgl), GFP_KERNEL);
1841 if (!tsgl || init_test_sglist(tsgl) != 0) {
1844 kfree(tsgl);
1845 tsgl = NULL;
1862 err = test_hash_vec(driver, &vecs[i], i, req, desc, tsgl,
1869 desc, tsgl, hashstate);
1872 if (tsgl) {
1873 destroy_test_sglist(tsgl);
1874 kfree(tsgl);