Lines Matching refs:tsgl

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