Lines Matching refs:tfm

847 #define do_setkey(setkey_f, tfm, key, ksize, cfg, alignmask)		\  argument
855 err = setkey_f((tfm), keyptr, (ksize)); \
1277 struct crypto_shash *tfm = desc->tfm; in test_shash_vec_cfg() local
1278 const unsigned int alignmask = crypto_shash_alignmask(tfm); in test_shash_vec_cfg()
1279 const unsigned int digestsize = crypto_shash_digestsize(tfm); in test_shash_vec_cfg()
1280 const unsigned int statesize = crypto_shash_statesize(tfm); in test_shash_vec_cfg()
1281 const char *driver = crypto_shash_driver_name(tfm); in test_shash_vec_cfg()
1289 err = do_setkey(crypto_shash_setkey, tfm, vec->key, vec->ksize, in test_shash_vec_cfg()
1296 crypto_shash_get_flags(tfm)); in test_shash_vec_cfg()
1316 testmgr_poison(desc->__ctx, crypto_shash_descsize(tfm)); in test_shash_vec_cfg()
1396 testmgr_poison(desc->__ctx, crypto_shash_descsize(tfm)); in test_shash_vec_cfg()
1461 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); in test_ahash_vec_cfg() local
1462 const unsigned int alignmask = crypto_ahash_alignmask(tfm); in test_ahash_vec_cfg()
1463 const unsigned int digestsize = crypto_ahash_digestsize(tfm); in test_ahash_vec_cfg()
1464 const unsigned int statesize = crypto_ahash_statesize(tfm); in test_ahash_vec_cfg()
1465 const char *driver = crypto_ahash_driver_name(tfm); in test_ahash_vec_cfg()
1477 err = do_setkey(crypto_ahash_setkey, tfm, vec->key, vec->ksize, in test_ahash_vec_cfg()
1484 crypto_ahash_get_flags(tfm)); in test_ahash_vec_cfg()
1504 testmgr_poison(req->__ctx, crypto_ahash_reqsize(tfm)); in test_ahash_vec_cfg()
1577 testmgr_poison(req->__ctx, crypto_ahash_reqsize(tfm)); in test_ahash_vec_cfg()
1714 vec->setkey_error = crypto_shash_setkey(desc->tfm, vec->key, in generate_random_hash_testvec()
1740 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); in test_hash_vs_generic_impl() local
1741 const unsigned int digestsize = crypto_ahash_digestsize(tfm); in test_hash_vs_generic_impl()
1742 const unsigned int blocksize = crypto_ahash_blocksize(tfm); in test_hash_vs_generic_impl()
1744 const char *algname = crypto_hash_alg_common(tfm)->base.cra_name; in test_hash_vs_generic_impl()
1745 const char *driver = crypto_ahash_driver_name(tfm); in test_hash_vs_generic_impl()
1797 generic_desc->tfm = generic_tfm; in test_hash_vs_generic_impl()
1868 struct crypto_shash *tfm; in alloc_shash() local
1871 tfm = crypto_alloc_shash(driver, type, mask); in alloc_shash()
1872 if (IS_ERR(tfm)) { in alloc_shash()
1873 if (PTR_ERR(tfm) == -ENOENT) { in alloc_shash()
1881 driver, PTR_ERR(tfm)); in alloc_shash()
1882 return PTR_ERR(tfm); in alloc_shash()
1885 desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(tfm), GFP_KERNEL); in alloc_shash()
1887 crypto_free_shash(tfm); in alloc_shash()
1890 desc->tfm = tfm; in alloc_shash()
1892 *tfm_ret = tfm; in alloc_shash()
2035 struct crypto_aead *tfm = crypto_aead_reqtfm(req); in test_aead_vec_cfg() local
2036 const unsigned int alignmask = crypto_aead_alignmask(tfm); in test_aead_vec_cfg()
2037 const unsigned int ivsize = crypto_aead_ivsize(tfm); in test_aead_vec_cfg()
2039 const char *driver = crypto_aead_driver_name(tfm); in test_aead_vec_cfg()
2052 crypto_aead_set_flags(tfm, CRYPTO_TFM_REQ_FORBID_WEAK_KEYS); in test_aead_vec_cfg()
2054 crypto_aead_clear_flags(tfm, CRYPTO_TFM_REQ_FORBID_WEAK_KEYS); in test_aead_vec_cfg()
2056 err = do_setkey(crypto_aead_setkey, tfm, vec->key, vec->klen, in test_aead_vec_cfg()
2061 crypto_aead_get_flags(tfm)); in test_aead_vec_cfg()
2071 err = crypto_aead_setauthsize(tfm, authsize); in test_aead_vec_cfg()
2112 testmgr_poison(req->__ctx, crypto_aead_reqsize(tfm)); in test_aead_vec_cfg()
2130 crypto_aead_reqtfm(req) != tfm || in test_aead_vec_cfg()
2146 if (crypto_aead_reqtfm(req) != tfm) in test_aead_vec_cfg()
2261 struct crypto_aead *tfm; member
2314 struct crypto_aead *tfm = crypto_aead_reqtfm(req); in generate_aead_message() local
2315 const unsigned int ivsize = crypto_aead_ivsize(tfm); in generate_aead_message()
2384 struct crypto_aead *tfm = crypto_aead_reqtfm(req); in generate_random_aead_testvec() local
2385 const unsigned int ivsize = crypto_aead_ivsize(tfm); in generate_random_aead_testvec()
2386 const unsigned int maxauthsize = crypto_aead_maxauthsize(tfm); in generate_random_aead_testvec()
2395 vec->setkey_error = crypto_aead_setkey(tfm, vec->key, vec->klen); in generate_random_aead_testvec()
2409 vec->setauthsize_error = crypto_aead_setauthsize(tfm, authsize); in generate_random_aead_testvec()
2490 struct crypto_aead *tfm = ctx->tfm; in test_aead_vs_generic_impl() local
2491 const char *algname = crypto_aead_alg(tfm)->base.cra_name; in test_aead_vs_generic_impl()
2492 const char *driver = crypto_aead_driver_name(tfm); in test_aead_vs_generic_impl()
2531 if (crypto_aead_maxauthsize(tfm) != in test_aead_vs_generic_impl()
2534 driver, crypto_aead_maxauthsize(tfm), in test_aead_vs_generic_impl()
2540 if (crypto_aead_ivsize(tfm) != crypto_aead_ivsize(generic_tfm)) { in test_aead_vs_generic_impl()
2542 driver, crypto_aead_ivsize(tfm), in test_aead_vs_generic_impl()
2548 if (crypto_aead_blocksize(tfm) != crypto_aead_blocksize(generic_tfm)) { in test_aead_vs_generic_impl()
2550 driver, crypto_aead_blocksize(tfm), in test_aead_vs_generic_impl()
2608 ctx->tfm = crypto_aead_reqtfm(req); in test_aead_extra()
2618 ctx->vec.iv = kmalloc(crypto_aead_ivsize(ctx->tfm), GFP_KERNEL); in test_aead_extra()
2671 struct crypto_aead *tfm; in alg_test_aead() local
2681 tfm = crypto_alloc_aead(driver, type, mask); in alg_test_aead()
2682 if (IS_ERR(tfm)) { in alg_test_aead()
2684 driver, PTR_ERR(tfm)); in alg_test_aead()
2685 return PTR_ERR(tfm); in alg_test_aead()
2687 driver = crypto_aead_driver_name(tfm); in alg_test_aead()
2689 req = aead_request_alloc(tfm, GFP_KERNEL); in alg_test_aead()
2717 crypto_free_aead(tfm); in alg_test_aead()
2721 static int test_cipher(struct crypto_cipher *tfm, int enc, in test_cipher() argument
2725 const char *algo = crypto_tfm_alg_driver_name(crypto_cipher_tfm(tfm)); in test_cipher()
2759 crypto_cipher_clear_flags(tfm, ~0); in test_cipher()
2761 crypto_cipher_set_flags(tfm, CRYPTO_TFM_REQ_FORBID_WEAK_KEYS); in test_cipher()
2763 ret = crypto_cipher_setkey(tfm, template[i].key, in test_cipher()
2770 crypto_cipher_get_flags(tfm)); in test_cipher()
2781 k += crypto_cipher_blocksize(tfm)) { in test_cipher()
2783 crypto_cipher_encrypt_one(tfm, data + k, in test_cipher()
2786 crypto_cipher_decrypt_one(tfm, data + k, in test_cipher()
2814 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in test_skcipher_vec_cfg() local
2815 const unsigned int alignmask = crypto_skcipher_alignmask(tfm); in test_skcipher_vec_cfg()
2816 const unsigned int ivsize = crypto_skcipher_ivsize(tfm); in test_skcipher_vec_cfg()
2817 const char *driver = crypto_skcipher_driver_name(tfm); in test_skcipher_vec_cfg()
2830 crypto_skcipher_set_flags(tfm, CRYPTO_TFM_REQ_FORBID_WEAK_KEYS); in test_skcipher_vec_cfg()
2832 crypto_skcipher_clear_flags(tfm, in test_skcipher_vec_cfg()
2834 err = do_setkey(crypto_skcipher_setkey, tfm, vec->key, vec->klen, in test_skcipher_vec_cfg()
2841 crypto_skcipher_get_flags(tfm)); in test_skcipher_vec_cfg()
2881 testmgr_poison(req->__ctx, crypto_skcipher_reqsize(tfm)); in test_skcipher_vec_cfg()
2897 crypto_skcipher_reqtfm(req) != tfm || in test_skcipher_vec_cfg()
2911 if (crypto_skcipher_reqtfm(req) != tfm) in test_skcipher_vec_cfg()
3027 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in generate_random_cipher_testvec() local
3028 const unsigned int maxkeysize = crypto_skcipher_max_keysize(tfm); in generate_random_cipher_testvec()
3029 const unsigned int ivsize = crypto_skcipher_ivsize(tfm); in generate_random_cipher_testvec()
3039 vec->setkey_error = crypto_skcipher_setkey(tfm, vec->key, vec->klen); in generate_random_cipher_testvec()
3081 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in test_skcipher_vs_generic_impl() local
3082 const unsigned int maxkeysize = crypto_skcipher_max_keysize(tfm); in test_skcipher_vs_generic_impl()
3083 const unsigned int ivsize = crypto_skcipher_ivsize(tfm); in test_skcipher_vs_generic_impl()
3084 const unsigned int blocksize = crypto_skcipher_blocksize(tfm); in test_skcipher_vs_generic_impl()
3086 const char *algname = crypto_skcipher_alg(tfm)->base.cra_name; in test_skcipher_vs_generic_impl()
3087 const char *driver = crypto_skcipher_driver_name(tfm); in test_skcipher_vs_generic_impl()
3145 if (crypto_skcipher_min_keysize(tfm) != in test_skcipher_vs_generic_impl()
3148 driver, crypto_skcipher_min_keysize(tfm), in test_skcipher_vs_generic_impl()
3248 struct crypto_skcipher *tfm; in alg_test_skcipher() local
3258 tfm = crypto_alloc_skcipher(driver, type, mask); in alg_test_skcipher()
3259 if (IS_ERR(tfm)) { in alg_test_skcipher()
3261 driver, PTR_ERR(tfm)); in alg_test_skcipher()
3262 return PTR_ERR(tfm); in alg_test_skcipher()
3264 driver = crypto_skcipher_driver_name(tfm); in alg_test_skcipher()
3266 req = skcipher_request_alloc(tfm, GFP_KERNEL); in alg_test_skcipher()
3294 crypto_free_skcipher(tfm); in alg_test_skcipher()
3298 static int test_comp(struct crypto_comp *tfm, in test_comp() argument
3303 const char *algo = crypto_tfm_alg_driver_name(crypto_comp_tfm(tfm)); in test_comp()
3326 ret = crypto_comp_compress(tfm, ctemplate[i].input, in test_comp()
3337 ret = crypto_comp_decompress(tfm, output, in test_comp()
3370 ret = crypto_comp_decompress(tfm, dtemplate[i].input, in test_comp()
3404 static int test_acomp(struct crypto_acomp *tfm, in test_acomp() argument
3409 const char *algo = crypto_tfm_alg_driver_name(crypto_acomp_tfm(tfm)); in test_acomp()
3443 req = acomp_request_alloc(tfm); in test_acomp()
3535 req = acomp_request_alloc(tfm); in test_acomp()
3602 static int test_cprng(struct crypto_rng *tfm, in test_cprng() argument
3606 const char *algo = crypto_tfm_alg_driver_name(crypto_rng_tfm(tfm)); in test_cprng()
3611 seedsize = crypto_rng_seedsize(tfm); in test_cprng()
3629 err = crypto_rng_reset(tfm, seed, seedsize); in test_cprng()
3637 err = crypto_rng_get_bytes(tfm, result, in test_cprng()
3668 struct crypto_cipher *tfm; in alg_test_cipher() local
3671 tfm = crypto_alloc_cipher(driver, type, mask); in alg_test_cipher()
3672 if (IS_ERR(tfm)) { in alg_test_cipher()
3674 "%s: %ld\n", driver, PTR_ERR(tfm)); in alg_test_cipher()
3675 return PTR_ERR(tfm); in alg_test_cipher()
3678 err = test_cipher(tfm, ENCRYPT, suite->vecs, suite->count); in alg_test_cipher()
3680 err = test_cipher(tfm, DECRYPT, suite->vecs, suite->count); in alg_test_cipher()
3682 crypto_free_cipher(tfm); in alg_test_cipher()
3727 struct crypto_shash *tfm; in alg_test_crc32c() local
3735 tfm = crypto_alloc_shash(driver, type, mask); in alg_test_crc32c()
3736 if (IS_ERR(tfm)) { in alg_test_crc32c()
3737 if (PTR_ERR(tfm) == -ENOENT) { in alg_test_crc32c()
3746 "%ld\n", driver, PTR_ERR(tfm)); in alg_test_crc32c()
3747 return PTR_ERR(tfm); in alg_test_crc32c()
3749 driver = crypto_shash_driver_name(tfm); in alg_test_crc32c()
3752 SHASH_DESC_ON_STACK(shash, tfm); in alg_test_crc32c()
3755 shash->tfm = tfm; in alg_test_crc32c()
3772 crypto_free_shash(tfm); in alg_test_crc32c()
3891 static int do_test_kpp(struct crypto_kpp *tfm, const struct kpp_testvec *vec, in do_test_kpp() argument
3905 req = kpp_request_alloc(tfm, GFP_KERNEL); in do_test_kpp()
3911 err = crypto_kpp_set_secret(tfm, vec->secret, vec->secret_size); in do_test_kpp()
3915 out_len_max = crypto_kpp_maxsize(tfm); in do_test_kpp()
3987 err = crypto_kpp_set_secret(tfm, vec->b_secret, in do_test_kpp()
4033 static int test_kpp(struct crypto_kpp *tfm, const char *alg, in test_kpp() argument
4039 ret = do_test_kpp(tfm, vecs++, alg); in test_kpp()
4052 struct crypto_kpp *tfm; in alg_test_kpp() local
4055 tfm = crypto_alloc_kpp(driver, type, mask); in alg_test_kpp()
4056 if (IS_ERR(tfm)) { in alg_test_kpp()
4058 driver, PTR_ERR(tfm)); in alg_test_kpp()
4059 return PTR_ERR(tfm); in alg_test_kpp()
4062 err = test_kpp(tfm, desc->alg, desc->suite.kpp.vecs, in alg_test_kpp()
4065 crypto_free_kpp(tfm); in alg_test_kpp()
4075 static int test_akcipher_one(struct crypto_akcipher *tfm, in test_akcipher_one() argument
4094 req = akcipher_request_alloc(tfm, GFP_KERNEL); in test_akcipher_one()
4111 err = crypto_akcipher_set_pub_key(tfm, key, vecs->key_len); in test_akcipher_one()
4113 err = crypto_akcipher_set_priv_key(tfm, key, vecs->key_len); in test_akcipher_one()
4122 out_len_max = crypto_akcipher_maxsize(tfm); in test_akcipher_one()
4257 static int test_akcipher(struct crypto_akcipher *tfm, const char *alg, in test_akcipher() argument
4262 crypto_tfm_alg_driver_name(crypto_akcipher_tfm(tfm)); in test_akcipher()
4266 ret = test_akcipher_one(tfm, vecs++); in test_akcipher()
4280 struct crypto_akcipher *tfm; in alg_test_akcipher() local
4283 tfm = crypto_alloc_akcipher(driver, type, mask); in alg_test_akcipher()
4284 if (IS_ERR(tfm)) { in alg_test_akcipher()
4286 driver, PTR_ERR(tfm)); in alg_test_akcipher()
4287 return PTR_ERR(tfm); in alg_test_akcipher()
4290 err = test_akcipher(tfm, desc->alg, desc->suite.akcipher.vecs, in alg_test_akcipher()
4293 crypto_free_akcipher(tfm); in alg_test_akcipher()