Lines Matching refs:tfm

191 static int __test_hash(struct crypto_ahash *tfm, struct hash_testvec *template,  in __test_hash()  argument
195 const char *algo = crypto_tfm_alg_driver_name(crypto_ahash_tfm(tfm)); in __test_hash()
217 req = ahash_request_alloc(tfm, GFP_KERNEL); in __test_hash()
245 crypto_ahash_clear_flags(tfm, ~0); in __test_hash()
253 ret = crypto_ahash_setkey(tfm, key, template[i].ksize); in __test_hash()
292 crypto_ahash_digestsize(tfm))) { in __test_hash()
295 hexdump(result, crypto_ahash_digestsize(tfm)); in __test_hash()
336 crypto_ahash_clear_flags(tfm, ~0); in __test_hash()
338 ret = crypto_ahash_setkey(tfm, key, template[i].ksize); in __test_hash()
369 crypto_ahash_digestsize(tfm))) { in __test_hash()
372 hexdump(result, crypto_ahash_digestsize(tfm)); in __test_hash()
390 static int test_hash(struct crypto_ahash *tfm, struct hash_testvec *template, in test_hash() argument
396 ret = __test_hash(tfm, template, tcount, use_digest, 0); in test_hash()
401 ret = __test_hash(tfm, template, tcount, use_digest, 1); in test_hash()
405 alignmask = crypto_tfm_alg_alignmask(&tfm->base); in test_hash()
408 ret = __test_hash(tfm, template, tcount, use_digest, in test_hash()
417 static int __test_aead(struct crypto_aead *tfm, int enc, in __test_aead() argument
421 const char *algo = crypto_tfm_alg_driver_name(crypto_aead_tfm(tfm)); in __test_aead()
473 req = aead_request_alloc(tfm, GFP_KERNEL); in __test_aead()
503 iv_len = crypto_aead_ivsize(tfm); in __test_aead()
509 crypto_aead_clear_flags(tfm, ~0); in __test_aead()
511 crypto_aead_set_flags(tfm, CRYPTO_TFM_REQ_WEAK_KEY); in __test_aead()
522 ret = crypto_aead_setkey(tfm, key, template[i].klen); in __test_aead()
525 d, j, algo, crypto_aead_get_flags(tfm)); in __test_aead()
531 ret = crypto_aead_setauthsize(tfm, authsize); in __test_aead()
612 crypto_aead_clear_flags(tfm, ~0); in __test_aead()
614 crypto_aead_set_flags(tfm, CRYPTO_TFM_REQ_WEAK_KEY); in __test_aead()
623 ret = crypto_aead_setkey(tfm, key, template[i].klen); in __test_aead()
626 d, j, algo, crypto_aead_get_flags(tfm)); in __test_aead()
664 ret = crypto_aead_setauthsize(tfm, authsize); in __test_aead()
798 static int test_aead(struct crypto_aead *tfm, int enc, in test_aead() argument
805 ret = __test_aead(tfm, enc, template, tcount, false, 0); in test_aead()
810 ret = __test_aead(tfm, enc, template, tcount, true, 0); in test_aead()
815 ret = __test_aead(tfm, enc, template, tcount, true, 1); in test_aead()
819 alignmask = crypto_tfm_alg_alignmask(&tfm->base); in test_aead()
822 ret = __test_aead(tfm, enc, template, tcount, true, in test_aead()
831 static int test_cipher(struct crypto_cipher *tfm, int enc, in test_cipher() argument
834 const char *algo = crypto_tfm_alg_driver_name(crypto_cipher_tfm(tfm)); in test_cipher()
864 crypto_cipher_clear_flags(tfm, ~0); in test_cipher()
866 crypto_cipher_set_flags(tfm, CRYPTO_TFM_REQ_WEAK_KEY); in test_cipher()
868 ret = crypto_cipher_setkey(tfm, template[i].key, in test_cipher()
873 algo, crypto_cipher_get_flags(tfm)); in test_cipher()
879 k += crypto_cipher_blocksize(tfm)) { in test_cipher()
881 crypto_cipher_encrypt_one(tfm, data + k, in test_cipher()
884 crypto_cipher_decrypt_one(tfm, data + k, in test_cipher()
906 static int __test_skcipher(struct crypto_ablkcipher *tfm, int enc, in __test_skcipher() argument
911 crypto_tfm_alg_driver_name(crypto_ablkcipher_tfm(tfm)); in __test_skcipher()
943 req = ablkcipher_request_alloc(tfm, GFP_KERNEL); in __test_skcipher()
972 crypto_ablkcipher_clear_flags(tfm, ~0); in __test_skcipher()
974 crypto_ablkcipher_set_flags(tfm, CRYPTO_TFM_REQ_WEAK_KEY); in __test_skcipher()
976 ret = crypto_ablkcipher_setkey(tfm, template[i].key, in __test_skcipher()
980 d, j, algo, crypto_ablkcipher_get_flags(tfm)); in __test_skcipher()
1039 crypto_ablkcipher_clear_flags(tfm, ~0); in __test_skcipher()
1041 crypto_ablkcipher_set_flags(tfm, CRYPTO_TFM_REQ_WEAK_KEY); in __test_skcipher()
1043 ret = crypto_ablkcipher_setkey(tfm, template[i].key, in __test_skcipher()
1047 d, j, algo, crypto_ablkcipher_get_flags(tfm)); in __test_skcipher()
1151 static int test_skcipher(struct crypto_ablkcipher *tfm, int enc, in test_skcipher() argument
1158 ret = __test_skcipher(tfm, enc, template, tcount, false, 0); in test_skcipher()
1163 ret = __test_skcipher(tfm, enc, template, tcount, true, 0); in test_skcipher()
1168 ret = __test_skcipher(tfm, enc, template, tcount, true, 1); in test_skcipher()
1172 alignmask = crypto_tfm_alg_alignmask(&tfm->base); in test_skcipher()
1175 ret = __test_skcipher(tfm, enc, template, tcount, true, in test_skcipher()
1184 static int test_comp(struct crypto_comp *tfm, struct comp_testvec *ctemplate, in test_comp() argument
1187 const char *algo = crypto_tfm_alg_driver_name(crypto_comp_tfm(tfm)); in test_comp()
1199 ret = crypto_comp_compress(tfm, ctemplate[i].input, in test_comp()
1232 ret = crypto_comp_decompress(tfm, dtemplate[i].input, in test_comp()
1264 static int test_pcomp(struct crypto_pcomp *tfm, in test_pcomp() argument
1269 const char *algo = crypto_tfm_alg_driver_name(crypto_pcomp_tfm(tfm)); in test_pcomp()
1278 res = crypto_compress_setup(tfm, ctemplate[i].params, in test_pcomp()
1286 res = crypto_compress_init(tfm); in test_pcomp()
1300 res = crypto_compress_update(tfm, &req); in test_pcomp()
1312 res = crypto_compress_update(tfm, &req); in test_pcomp()
1324 res = crypto_compress_final(tfm, &req); in test_pcomp()
1359 res = crypto_decompress_setup(tfm, dtemplate[i].params, in test_pcomp()
1367 res = crypto_decompress_init(tfm); in test_pcomp()
1381 res = crypto_decompress_update(tfm, &req); in test_pcomp()
1393 res = crypto_decompress_update(tfm, &req); in test_pcomp()
1405 res = crypto_decompress_final(tfm, &req); in test_pcomp()
1441 static int test_cprng(struct crypto_rng *tfm, struct cprng_testvec *template, in test_cprng() argument
1444 const char *algo = crypto_tfm_alg_driver_name(crypto_rng_tfm(tfm)); in test_cprng()
1449 seedsize = crypto_rng_seedsize(tfm); in test_cprng()
1467 err = crypto_rng_reset(tfm, seed, seedsize); in test_cprng()
1475 err = crypto_rng_get_bytes(tfm, result, in test_cprng()
1505 struct crypto_aead *tfm; in alg_test_aead() local
1508 tfm = crypto_alloc_aead(driver, type | CRYPTO_ALG_INTERNAL, mask); in alg_test_aead()
1509 if (IS_ERR(tfm)) { in alg_test_aead()
1511 "%ld\n", driver, PTR_ERR(tfm)); in alg_test_aead()
1512 return PTR_ERR(tfm); in alg_test_aead()
1516 err = test_aead(tfm, ENCRYPT, desc->suite.aead.enc.vecs, in alg_test_aead()
1523 err = test_aead(tfm, DECRYPT, desc->suite.aead.dec.vecs, in alg_test_aead()
1527 crypto_free_aead(tfm); in alg_test_aead()
1534 struct crypto_cipher *tfm; in alg_test_cipher() local
1537 tfm = crypto_alloc_cipher(driver, type | CRYPTO_ALG_INTERNAL, mask); in alg_test_cipher()
1538 if (IS_ERR(tfm)) { in alg_test_cipher()
1540 "%s: %ld\n", driver, PTR_ERR(tfm)); in alg_test_cipher()
1541 return PTR_ERR(tfm); in alg_test_cipher()
1545 err = test_cipher(tfm, ENCRYPT, desc->suite.cipher.enc.vecs, in alg_test_cipher()
1552 err = test_cipher(tfm, DECRYPT, desc->suite.cipher.dec.vecs, in alg_test_cipher()
1556 crypto_free_cipher(tfm); in alg_test_cipher()
1563 struct crypto_ablkcipher *tfm; in alg_test_skcipher() local
1566 tfm = crypto_alloc_ablkcipher(driver, type | CRYPTO_ALG_INTERNAL, mask); in alg_test_skcipher()
1567 if (IS_ERR(tfm)) { in alg_test_skcipher()
1569 "%s: %ld\n", driver, PTR_ERR(tfm)); in alg_test_skcipher()
1570 return PTR_ERR(tfm); in alg_test_skcipher()
1574 err = test_skcipher(tfm, ENCRYPT, desc->suite.cipher.enc.vecs, in alg_test_skcipher()
1581 err = test_skcipher(tfm, DECRYPT, desc->suite.cipher.dec.vecs, in alg_test_skcipher()
1585 crypto_free_ablkcipher(tfm); in alg_test_skcipher()
1592 struct crypto_comp *tfm; in alg_test_comp() local
1595 tfm = crypto_alloc_comp(driver, type, mask); in alg_test_comp()
1596 if (IS_ERR(tfm)) { in alg_test_comp()
1598 "%ld\n", driver, PTR_ERR(tfm)); in alg_test_comp()
1599 return PTR_ERR(tfm); in alg_test_comp()
1602 err = test_comp(tfm, desc->suite.comp.comp.vecs, in alg_test_comp()
1607 crypto_free_comp(tfm); in alg_test_comp()
1614 struct crypto_pcomp *tfm; in alg_test_pcomp() local
1617 tfm = crypto_alloc_pcomp(driver, type, mask); in alg_test_pcomp()
1618 if (IS_ERR(tfm)) { in alg_test_pcomp()
1620 driver, PTR_ERR(tfm)); in alg_test_pcomp()
1621 return PTR_ERR(tfm); in alg_test_pcomp()
1624 err = test_pcomp(tfm, desc->suite.pcomp.comp.vecs, in alg_test_pcomp()
1629 crypto_free_pcomp(tfm); in alg_test_pcomp()
1636 struct crypto_ahash *tfm; in alg_test_hash() local
1639 tfm = crypto_alloc_ahash(driver, type | CRYPTO_ALG_INTERNAL, mask); in alg_test_hash()
1640 if (IS_ERR(tfm)) { in alg_test_hash()
1642 "%ld\n", driver, PTR_ERR(tfm)); in alg_test_hash()
1643 return PTR_ERR(tfm); in alg_test_hash()
1646 err = test_hash(tfm, desc->suite.hash.vecs, in alg_test_hash()
1649 err = test_hash(tfm, desc->suite.hash.vecs, in alg_test_hash()
1652 crypto_free_ahash(tfm); in alg_test_hash()
1659 struct crypto_shash *tfm; in alg_test_crc32c() local
1667 tfm = crypto_alloc_shash(driver, type | CRYPTO_ALG_INTERNAL, mask); in alg_test_crc32c()
1668 if (IS_ERR(tfm)) { in alg_test_crc32c()
1670 "%ld\n", driver, PTR_ERR(tfm)); in alg_test_crc32c()
1671 err = PTR_ERR(tfm); in alg_test_crc32c()
1676 SHASH_DESC_ON_STACK(shash, tfm); in alg_test_crc32c()
1679 shash->tfm = tfm; in alg_test_crc32c()
1697 crypto_free_shash(tfm); in alg_test_crc32c()