Lines Matching refs:cfg
454 static bool valid_testvec_config(const struct testvec_config *cfg) in valid_testvec_config() argument
458 if (cfg->name == NULL) in valid_testvec_config()
461 if (!valid_sg_divisions(cfg->src_divs, ARRAY_SIZE(cfg->src_divs), in valid_testvec_config()
465 if (cfg->dst_divs[0].proportion_of_total) { in valid_testvec_config()
466 if (!valid_sg_divisions(cfg->dst_divs, in valid_testvec_config()
467 ARRAY_SIZE(cfg->dst_divs), &flags)) in valid_testvec_config()
470 if (memchr_inv(cfg->dst_divs, 0, sizeof(cfg->dst_divs))) in valid_testvec_config()
475 if (cfg->iv_offset + in valid_testvec_config()
476 (cfg->iv_offset_relative_to_alignmask ? MAX_ALGAPI_ALIGNMASK : 0) > in valid_testvec_config()
481 cfg->finalization_type == FINALIZATION_TYPE_DIGEST) in valid_testvec_config()
484 if ((cfg->nosimd || (flags & SGDIVS_HAVE_NOSIMD)) && in valid_testvec_config()
485 (cfg->req_flags & CRYPTO_TFM_REQ_MAY_SLEEP)) in valid_testvec_config()
713 const struct testvec_config *cfg, in build_cipher_test_sglists() argument
724 err = build_test_sglist(&tsgls->src, cfg->src_divs, alignmask, in build_cipher_test_sglists()
725 cfg->inplace ? in build_cipher_test_sglists()
732 if (cfg->inplace) { in build_cipher_test_sglists()
738 cfg->dst_divs[0].proportion_of_total ? in build_cipher_test_sglists()
739 cfg->dst_divs : cfg->src_divs, in build_cipher_test_sglists()
904 static void generate_random_testvec_config(struct testvec_config *cfg, in generate_random_testvec_config() argument
910 memset(cfg, 0, sizeof(*cfg)); in generate_random_testvec_config()
912 cfg->name = name; in generate_random_testvec_config()
917 cfg->inplace = true; in generate_random_testvec_config()
922 cfg->req_flags |= CRYPTO_TFM_REQ_MAY_SLEEP; in generate_random_testvec_config()
928 cfg->finalization_type = FINALIZATION_TYPE_FINAL; in generate_random_testvec_config()
932 cfg->finalization_type = FINALIZATION_TYPE_FINUP; in generate_random_testvec_config()
936 cfg->finalization_type = FINALIZATION_TYPE_DIGEST; in generate_random_testvec_config()
941 if (!(cfg->req_flags & CRYPTO_TFM_REQ_MAY_SLEEP) && in generate_random_testvec_config()
943 cfg->nosimd = true; in generate_random_testvec_config()
948 p = generate_random_sgl_divisions(cfg->src_divs, in generate_random_testvec_config()
949 ARRAY_SIZE(cfg->src_divs), p, end, in generate_random_testvec_config()
950 (cfg->finalization_type != in generate_random_testvec_config()
952 cfg->req_flags); in generate_random_testvec_config()
955 if (!cfg->inplace && prandom_u32() % 2 == 0) { in generate_random_testvec_config()
957 p = generate_random_sgl_divisions(cfg->dst_divs, in generate_random_testvec_config()
958 ARRAY_SIZE(cfg->dst_divs), in generate_random_testvec_config()
960 cfg->req_flags); in generate_random_testvec_config()
965 cfg->iv_offset = 1 + (prandom_u32() % MAX_ALGAPI_ALIGNMASK); in generate_random_testvec_config()
966 p += scnprintf(p, end - p, " iv_offset=%u", cfg->iv_offset); in generate_random_testvec_config()
969 WARN_ON_ONCE(!valid_testvec_config(cfg)); in generate_random_testvec_config()
1037 const struct testvec_config *cfg, in build_hash_sglist() argument
1047 return build_test_sglist(tsgl, cfg->src_divs, alignmask, vec->psize, in build_hash_sglist()
1056 const struct testvec_config *cfg) in check_hash_result() argument
1060 type, driver, vec_name, cfg->name); in check_hash_result()
1065 type, driver, vec_name, cfg->name); in check_hash_result()
1073 const struct testvec_config *cfg) in check_shash_op() argument
1077 driver, op, err, vec_name, cfg->name); in check_shash_op()
1090 const struct testvec_config *cfg, in test_shash_vec_cfg() argument
1123 err = build_hash_sglist(tsgl, vec, cfg, alignmask, divs); in test_shash_vec_cfg()
1126 driver, vec_name, cfg->name); in test_shash_vec_cfg()
1135 if (cfg->finalization_type == FINALIZATION_TYPE_DIGEST || in test_shash_vec_cfg()
1140 if (cfg->nosimd) in test_shash_vec_cfg()
1144 if (cfg->nosimd) in test_shash_vec_cfg()
1151 cfg->name); in test_shash_vec_cfg()
1156 driver, vec_name, vec->digest_error, cfg->name); in test_shash_vec_cfg()
1164 if (cfg->nosimd) in test_shash_vec_cfg()
1167 if (cfg->nosimd) in test_shash_vec_cfg()
1169 err = check_shash_op("init", err, driver, vec_name, cfg); in test_shash_vec_cfg()
1175 cfg->finalization_type == FINALIZATION_TYPE_FINUP) { in test_shash_vec_cfg()
1183 cfg); in test_shash_vec_cfg()
1194 err = check_shash_op("update", err, driver, vec_name, cfg); in test_shash_vec_cfg()
1203 cfg); in test_shash_vec_cfg()
1209 driver, vec_name, cfg->name); in test_shash_vec_cfg()
1215 cfg); in test_shash_vec_cfg()
1221 if (cfg->nosimd) in test_shash_vec_cfg()
1224 if (cfg->nosimd) in test_shash_vec_cfg()
1226 err = check_shash_op("final", err, driver, vec_name, cfg); in test_shash_vec_cfg()
1231 driver, cfg); in test_shash_vec_cfg()
1254 const struct testvec_config *cfg) in check_nonfinal_ahash_op() argument
1258 driver, op, err, vec_name, cfg->name); in check_nonfinal_ahash_op()
1263 driver, op, vec_name, cfg->name); in check_nonfinal_ahash_op()
1273 const struct testvec_config *cfg, in test_ahash_vec_cfg() argument
1282 const u32 req_flags = CRYPTO_TFM_REQ_MAY_BACKLOG | cfg->req_flags; in test_ahash_vec_cfg()
1310 err = build_hash_sglist(tsgl, vec, cfg, alignmask, divs); in test_ahash_vec_cfg()
1313 driver, vec_name, cfg->name); in test_ahash_vec_cfg()
1322 if (cfg->finalization_type == FINALIZATION_TYPE_DIGEST || in test_ahash_vec_cfg()
1328 err = do_ahash_op(crypto_ahash_digest, req, &wait, cfg->nosimd); in test_ahash_vec_cfg()
1334 cfg->name); in test_ahash_vec_cfg()
1339 driver, vec_name, vec->digest_error, cfg->name); in test_ahash_vec_cfg()
1349 err = do_ahash_op(crypto_ahash_init, req, &wait, cfg->nosimd); in test_ahash_vec_cfg()
1351 driver, vec_name, cfg); in test_ahash_vec_cfg()
1369 driver, vec_name, cfg); in test_ahash_vec_cfg()
1382 driver, vec_name, cfg); in test_ahash_vec_cfg()
1388 driver, vec_name, cfg->name); in test_ahash_vec_cfg()
1396 driver, vec_name, cfg); in test_ahash_vec_cfg()
1407 if (cfg->finalization_type == FINALIZATION_TYPE_FINAL) { in test_ahash_vec_cfg()
1409 err = do_ahash_op(crypto_ahash_update, req, &wait, cfg->nosimd); in test_ahash_vec_cfg()
1411 driver, vec_name, cfg); in test_ahash_vec_cfg()
1414 err = do_ahash_op(crypto_ahash_final, req, &wait, cfg->nosimd); in test_ahash_vec_cfg()
1417 driver, err, vec_name, cfg->name); in test_ahash_vec_cfg()
1422 err = do_ahash_op(crypto_ahash_finup, req, &wait, cfg->nosimd); in test_ahash_vec_cfg()
1425 driver, err, vec_name, cfg->name); in test_ahash_vec_cfg()
1432 driver, cfg); in test_ahash_vec_cfg()
1438 const struct testvec_config *cfg, 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()
1484 struct testvec_config cfg; in test_hash_vec() local
1488 generate_random_testvec_config(&cfg, cfgname, in test_hash_vec()
1490 err = test_hash_vec_cfg(driver, vec, vec_name, &cfg, in test_hash_vec()
1566 struct testvec_config *cfg; in test_hash_vs_generic_impl() local
1596 cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); in test_hash_vs_generic_impl()
1597 if (!cfg) { in test_hash_vs_generic_impl()
1644 generate_random_testvec_config(cfg, cfgname, sizeof(cfgname)); in test_hash_vs_generic_impl()
1646 err = test_hash_vec_cfg(driver, &vec, vec_name, cfg, in test_hash_vs_generic_impl()
1654 kfree(cfg); in test_hash_vs_generic_impl()
1840 const struct testvec_config *cfg, in test_aead_vec_cfg() argument
1848 const u32 req_flags = CRYPTO_TFM_REQ_MAY_BACKLOG | cfg->req_flags; in test_aead_vec_cfg()
1853 cfg->iv_offset + in test_aead_vec_cfg()
1854 (cfg->iv_offset_relative_to_alignmask ? alignmask : 0); in test_aead_vec_cfg()
1906 err = build_cipher_test_sglists(tsgls, cfg, alignmask, in test_aead_vec_cfg()
1914 driver, op, vec_name, cfg->name); in test_aead_vec_cfg()
1924 if (cfg->nosimd) in test_aead_vec_cfg()
1927 if (cfg->nosimd) in test_aead_vec_cfg()
1942 driver, op, vec_name, cfg->name); in test_aead_vec_cfg()
1965 driver, op, vec_name, cfg->name); in test_aead_vec_cfg()
1971 driver, op, vec_name, cfg->name); in test_aead_vec_cfg()
1981 driver, op, vec_name, expected_error, err, cfg->name); in test_aead_vec_cfg()
1986 driver, op, vec_name, expected_error, cfg->name); in test_aead_vec_cfg()
1993 vec->alen, enc || !cfg->inplace); in test_aead_vec_cfg()
1996 driver, op, vec_name, cfg->name); in test_aead_vec_cfg()
2001 driver, op, vec_name, cfg->name); in test_aead_vec_cfg()
2032 struct testvec_config cfg; in test_aead_vec() local
2036 generate_random_testvec_config(&cfg, cfgname, in test_aead_vec()
2039 &cfg, req, tsgls); in test_aead_vec()
2152 struct testvec_config *cfg; in test_aead_vs_generic_impl() local
2182 cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); in test_aead_vs_generic_impl()
2183 if (!cfg) { in test_aead_vs_generic_impl()
2242 generate_random_testvec_config(cfg, cfgname, sizeof(cfgname)); in test_aead_vs_generic_impl()
2244 err = test_aead_vec_cfg(driver, ENCRYPT, &vec, vec_name, cfg, in test_aead_vs_generic_impl()
2248 err = test_aead_vec_cfg(driver, DECRYPT, &vec, vec_name, cfg, in test_aead_vs_generic_impl()
2256 kfree(cfg); in test_aead_vs_generic_impl()
2437 const struct testvec_config *cfg, in test_skcipher_vec_cfg() argument
2444 const u32 req_flags = CRYPTO_TFM_REQ_MAY_BACKLOG | cfg->req_flags; in test_skcipher_vec_cfg()
2449 cfg->iv_offset + in test_skcipher_vec_cfg()
2450 (cfg->iv_offset_relative_to_alignmask ? alignmask : 0); in test_skcipher_vec_cfg()
2497 err = build_cipher_test_sglists(tsgls, cfg, alignmask, in test_skcipher_vec_cfg()
2501 driver, op, vec_name, cfg->name); in test_skcipher_vec_cfg()
2510 if (cfg->nosimd) in test_skcipher_vec_cfg()
2513 if (cfg->nosimd) in test_skcipher_vec_cfg()
2527 driver, op, vec_name, cfg->name); in test_skcipher_vec_cfg()
2548 driver, op, vec_name, cfg->name); in test_skcipher_vec_cfg()
2554 driver, op, vec_name, cfg->name); in test_skcipher_vec_cfg()
2563 driver, op, vec_name, vec->crypt_error, err, cfg->name); in test_skcipher_vec_cfg()
2568 driver, op, vec_name, vec->crypt_error, cfg->name); in test_skcipher_vec_cfg()
2577 driver, op, vec_name, cfg->name); in test_skcipher_vec_cfg()
2582 driver, op, vec_name, cfg->name); in test_skcipher_vec_cfg()
2589 driver, op, vec_name, cfg->name); in test_skcipher_vec_cfg()
2622 struct testvec_config cfg; in test_skcipher_vec() local
2626 generate_random_testvec_config(&cfg, cfgname, in test_skcipher_vec()
2629 &cfg, req, tsgls); in test_skcipher_vec()
2706 struct testvec_config *cfg; in test_skcipher_vs_generic_impl() local
2740 cfg = kzalloc(sizeof(*cfg), GFP_KERNEL); in test_skcipher_vs_generic_impl()
2741 if (!cfg) { in test_skcipher_vs_generic_impl()
2793 generate_random_testvec_config(cfg, cfgname, sizeof(cfgname)); in test_skcipher_vs_generic_impl()
2796 cfg, req, tsgls); in test_skcipher_vs_generic_impl()
2800 cfg, req, tsgls); in test_skcipher_vs_generic_impl()
2807 kfree(cfg); in test_skcipher_vs_generic_impl()