/linux/crypto/ |
H A D | api.c | 39 static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg); 43 struct crypto_alg *crypto_mod_get(struct crypto_alg *alg) in crypto_mod_get() argument 45 return try_module_get(alg->cra_module) ? crypto_alg_get(alg) : NULL; in crypto_mod_get() 49 void crypto_mod_put(struct crypto_alg *alg) in crypto_mod_put() argument 51 struct module *module = alg->cra_module; in crypto_mod_put() 53 crypto_alg_put(alg); in crypto_mod_put() 61 struct crypto_alg *q, *alg = NULL; in __crypto_alg_lookup() local 82 if (alg) in __crypto_alg_lookup() 83 crypto_mod_put(alg); in __crypto_alg_lookup() 84 alg = q; in __crypto_alg_lookup() [all …]
|
H A D | algapi.c | 32 static int crypto_check_alg(struct crypto_alg *alg) in crypto_check_alg() argument 34 crypto_check_module_sig(alg->cra_module); in crypto_check_alg() 36 if (!alg->cra_name[0] || !alg->cra_driver_name[0]) in crypto_check_alg() 39 if (alg->cra_alignmask & (alg->cra_alignmask + 1)) in crypto_check_alg() 43 if (alg->cra_alignmask > MAX_ALGAPI_ALIGNMASK) in crypto_check_alg() 46 if (alg->cra_blocksize > MAX_ALGAPI_BLOCKSIZE) in crypto_check_alg() 50 if (!alg->cra_type && (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == in crypto_check_alg() 52 if (alg->cra_alignmask > MAX_CIPHER_ALIGNMASK) in crypto_check_alg() 55 if (alg->cra_blocksize > MAX_CIPHER_BLOCKSIZE) in crypto_check_alg() 59 if (alg->cra_priority < 0) in crypto_check_alg() [all …]
|
H A D | internal.h | 29 struct crypto_alg alg; member 52 int alg_test(const char *driver, const char *alg, u32 type, u32 mask); 87 static inline unsigned int crypto_cipher_ctxsize(struct crypto_alg *alg) in crypto_cipher_ctxsize() argument 89 return alg->cra_ctxsize; in crypto_cipher_ctxsize() 92 static inline unsigned int crypto_compress_ctxsize(struct crypto_alg *alg) in crypto_compress_ctxsize() argument 94 return alg->cra_ctxsize; in crypto_compress_ctxsize() 97 struct crypto_alg *crypto_mod_get(struct crypto_alg *alg); 104 void crypto_remove_spawns(struct crypto_alg *alg, struct list_head *list, 107 void crypto_shoot_alg(struct crypto_alg *alg); 108 struct crypto_tfm *__crypto_alloc_tfmgfp(struct crypto_alg *alg, u32 type, [all …]
|
H A D | shash.c | 26 static void shash_set_needkey(struct crypto_shash *tfm, struct shash_alg *alg) in shash_set_needkey() argument 28 if (crypto_shash_alg_needs_key(alg)) in shash_set_needkey() 147 struct shash_alg *alg = crypto_shash_alg(hash); in crypto_shash_exit_tfm() local 149 alg->exit_tfm(hash); in crypto_shash_exit_tfm() 155 struct shash_alg *alg = crypto_shash_alg(hash); in crypto_shash_init_tfm() local 158 hash->descsize = alg->descsize; in crypto_shash_init_tfm() 160 shash_set_needkey(hash, alg); in crypto_shash_init_tfm() 162 if (alg->exit_tfm) in crypto_shash_init_tfm() 165 if (!alg->init_tfm) in crypto_shash_init_tfm() 168 err = alg->init_tfm(hash); in crypto_shash_init_tfm() [all …]
|
H A D | crypto_user.c | 37 struct crypto_alg *q, *alg = NULL; in crypto_alg_match() local 62 alg = q; in crypto_alg_match() 68 return alg; in crypto_alg_match() 71 static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg) in crypto_report_cipher() argument 79 rcipher.blocksize = alg->cra_blocksize; in crypto_report_cipher() 80 rcipher.min_keysize = alg->cra_cipher.cia_min_keysize; in crypto_report_cipher() 81 rcipher.max_keysize = alg->cra_cipher.cia_max_keysize; in crypto_report_cipher() 87 static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg) in crypto_report_comp() argument 98 static int crypto_report_one(struct crypto_alg *alg, in crypto_report_one() argument 103 strscpy(ualg->cru_name, alg->cra_name, sizeof(ualg->cru_name)); in crypto_report_one() [all …]
|
H A D | simd.c | 43 struct skcipher_alg alg; member 116 struct skcipher_alg *alg; in simd_skcipher_init() local 119 alg = crypto_skcipher_alg(tfm); in simd_skcipher_init() 120 salg = container_of(alg, struct simd_skcipher_alg, alg); in simd_skcipher_init() 145 struct skcipher_alg *alg; in simd_skcipher_create_compat() local 155 alg = &salg->alg; in simd_skcipher_create_compat() 158 if (snprintf(alg->base.cra_name, CRYPTO_MAX_ALG_NAME, "%s", algname) >= in simd_skcipher_create_compat() 162 if (snprintf(alg->base.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", in simd_skcipher_create_compat() 166 alg->base.cra_flags = CRYPTO_ALG_ASYNC | in simd_skcipher_create_compat() 168 alg->base.cra_priority = ialg->base.cra_priority; in simd_skcipher_create_compat() [all …]
|
H A D | proc.c | 39 struct crypto_alg *alg = list_entry(p, struct crypto_alg, cra_list); in c_show() local 41 seq_printf(m, "name : %s\n", alg->cra_name); in c_show() 42 seq_printf(m, "driver : %s\n", alg->cra_driver_name); in c_show() 43 seq_printf(m, "module : %s\n", module_name(alg->cra_module)); in c_show() 44 seq_printf(m, "priority : %d\n", alg->cra_priority); in c_show() 45 seq_printf(m, "refcnt : %u\n", refcount_read(&alg->cra_refcnt)); in c_show() 47 (alg->cra_flags & CRYPTO_ALG_TESTED) ? in c_show() 50 (alg->cra_flags & CRYPTO_ALG_INTERNAL) ? in c_show() 54 (alg->cra_flags & CRYPTO_ALG_FIPS_INTERNAL) ? in c_show() 58 if (alg->cra_flags & CRYPTO_ALG_LARVAL) { in c_show() [all …]
|
H A D | acompress.c | 26 static inline struct acomp_alg *__crypto_acomp_alg(struct crypto_alg *alg) in __crypto_acomp_alg() argument 28 return container_of(alg, struct acomp_alg, calg.base); in __crypto_acomp_alg() 37 struct sk_buff *skb, struct crypto_alg *alg) in crypto_acomp_report() argument 48 static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg) 51 static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg) in crypto_acomp_show() argument 59 struct acomp_alg *alg = crypto_acomp_alg(acomp); in crypto_acomp_exit_tfm() local 61 alg->exit(acomp); in crypto_acomp_exit_tfm() 67 struct acomp_alg *alg = crypto_acomp_alg(acomp); in crypto_acomp_init_tfm() local 72 acomp->compress = alg->compress; in crypto_acomp_init_tfm() 73 acomp->decompress = alg->decompress; in crypto_acomp_init_tfm() [all …]
|
H A D | ctr.c | 130 struct crypto_alg *alg; in crypto_ctr_create() local 137 alg = skcipher_ialg_simple(inst); in crypto_ctr_create() 141 if (alg->cra_blocksize < 4) in crypto_ctr_create() 145 if (alg->cra_blocksize % 4) in crypto_ctr_create() 149 inst->alg.base.cra_blocksize = 1; in crypto_ctr_create() 155 inst->alg.chunksize = alg->cra_blocksize; in crypto_ctr_create() 157 inst->alg.encrypt = crypto_ctr_crypt; in crypto_ctr_create() 158 inst->alg.decrypt = crypto_ctr_crypt; in crypto_ctr_create() 262 struct skcipher_alg_common *alg; in crypto_rfc3686_create() local 281 alg = crypto_spawn_skcipher_alg_common(spawn); in crypto_rfc3686_create() [all …]
|
H A D | aead.c | 111 struct aead_alg *alg = crypto_aead_alg(aead); in crypto_aead_exit_tfm() local 113 alg->exit(aead); in crypto_aead_exit_tfm() 119 struct aead_alg *alg = crypto_aead_alg(aead); in crypto_aead_init_tfm() local 123 aead->authsize = alg->maxauthsize; in crypto_aead_init_tfm() 125 if (alg->exit) in crypto_aead_init_tfm() 128 if (alg->init) in crypto_aead_init_tfm() 129 return alg->init(aead); in crypto_aead_init_tfm() 135 struct sk_buff *skb, struct crypto_alg *alg) in crypto_aead_report() argument 138 struct aead_alg *aead = container_of(alg, struct aead_alg, base); in crypto_aead_report() 145 raead.blocksize = alg->cra_blocksize; in crypto_aead_report() [all …]
|
H A D | geniv.c | 46 struct aead_alg *alg; in aead_geniv_alloc() local 67 alg = crypto_spawn_aead_alg(spawn); in aead_geniv_alloc() 69 ivsize = crypto_aead_alg_ivsize(alg); in aead_geniv_alloc() 70 maxauthsize = crypto_aead_alg_maxauthsize(alg); in aead_geniv_alloc() 77 if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME, in aead_geniv_alloc() 78 "%s(%s)", tmpl->name, alg->base.cra_name) >= in aead_geniv_alloc() 81 if (snprintf(inst->alg.base.cra_driver_name, CRYPTO_MAX_ALG_NAME, in aead_geniv_alloc() 82 "%s(%s)", tmpl->name, alg->base.cra_driver_name) >= in aead_geniv_alloc() 86 inst->alg.base.cra_priority = alg->base.cra_priority; in aead_geniv_alloc() 87 inst->alg.base.cra_blocksize = alg->base.cra_blocksize; in aead_geniv_alloc() [all …]
|
H A D | kpp.c | 21 struct sk_buff *skb, struct crypto_alg *alg) in crypto_kpp_report() argument 32 static void crypto_kpp_show(struct seq_file *m, struct crypto_alg *alg) 35 static void crypto_kpp_show(struct seq_file *m, struct crypto_alg *alg) in crypto_kpp_show() argument 43 struct kpp_alg *alg = crypto_kpp_alg(kpp); in crypto_kpp_exit_tfm() local 45 alg->exit(kpp); in crypto_kpp_exit_tfm() 51 struct kpp_alg *alg = crypto_kpp_alg(kpp); in crypto_kpp_init_tfm() local 53 if (alg->exit) in crypto_kpp_init_tfm() 56 if (alg->init) in crypto_kpp_init_tfm() 57 return alg->init(kpp); in crypto_kpp_init_tfm() 106 static void kpp_prepare_alg(struct kpp_alg *alg) in kpp_prepare_alg() argument [all …]
|
H A D | lskcipher.c | 27 struct crypto_alg *alg) in __crypto_lskcipher_alg() argument 29 return container_of(alg, struct lskcipher_alg, co.base); in __crypto_lskcipher_alg() 143 struct lskcipher_alg *alg = crypto_lskcipher_alg(tfm); in crypto_lskcipher_encrypt() local 145 return crypto_lskcipher_crypt(tfm, src, dst, len, iv, alg->encrypt); in crypto_lskcipher_encrypt() 152 struct lskcipher_alg *alg = crypto_lskcipher_alg(tfm); in crypto_lskcipher_decrypt() local 154 return crypto_lskcipher_crypt(tfm, src, dst, len, iv, alg->decrypt); in crypto_lskcipher_decrypt() 205 struct lskcipher_alg *alg = crypto_lskcipher_alg(*ctx); in crypto_lskcipher_encrypt_sg() local 207 return crypto_lskcipher_crypt_sg(req, alg->encrypt); in crypto_lskcipher_encrypt_sg() 214 struct lskcipher_alg *alg = crypto_lskcipher_alg(*ctx); in crypto_lskcipher_decrypt_sg() local 216 return crypto_lskcipher_crypt_sg(req, alg->decrypt); in crypto_lskcipher_decrypt_sg() [all …]
|
H A D | ahash.c | 217 static void ahash_set_needkey(struct crypto_ahash *tfm, struct ahash_alg *alg) in ahash_set_needkey() argument 219 if (alg->setkey != ahash_nosetkey && in ahash_set_needkey() 220 !(alg->halg.base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY)) in ahash_set_needkey() 239 struct ahash_alg *alg = crypto_ahash_alg(tfm); in crypto_ahash_setkey() local 242 err = alg->setkey(tfm, key, keylen); in crypto_ahash_setkey() 244 ahash_set_needkey(tfm, alg); in crypto_ahash_setkey() 465 struct ahash_alg *alg = crypto_ahash_alg(hash); in crypto_ahash_exit_tfm() local 467 alg->exit_tfm(hash); in crypto_ahash_exit_tfm() 473 struct ahash_alg *alg = crypto_ahash_alg(hash); in crypto_ahash_init_tfm() local 475 crypto_ahash_set_statesize(hash, alg->halg.statesize); in crypto_ahash_init_tfm() [all …]
|
H A D | skcipher.c | 87 struct crypto_alg *alg) in __crypto_skcipher_alg() argument 89 return container_of(alg, struct skcipher_alg, base); in __crypto_skcipher_alg() 451 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in skcipher_walk_skcipher() local 472 if (alg->co.base.cra_type != &crypto_skcipher_type) in skcipher_walk_skcipher() 473 walk->stride = alg->co.chunksize; in skcipher_walk_skcipher() 475 walk->stride = alg->walksize; in skcipher_walk_skcipher() 637 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in crypto_skcipher_encrypt() local 641 if (alg->co.base.cra_type != &crypto_skcipher_type) in crypto_skcipher_encrypt() 643 return alg->encrypt(req); in crypto_skcipher_encrypt() 650 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in crypto_skcipher_decrypt() local [all …]
|
H A D | crypto_engine.c | 77 struct crypto_engine_alg *alg; in crypto_pump_requests() local 152 alg = container_of(async_req->tfm->__crt_alg, in crypto_pump_requests() 154 op = &alg->op; in crypto_pump_requests() 568 int crypto_engine_register_aead(struct aead_engine_alg *alg) in crypto_engine_register_aead() argument 570 if (!alg->op.do_one_request) in crypto_engine_register_aead() 573 alg->base.base.cra_flags |= CRYPTO_ALG_ENGINE; in crypto_engine_register_aead() 575 return crypto_register_aead(&alg->base); in crypto_engine_register_aead() 579 void crypto_engine_unregister_aead(struct aead_engine_alg *alg) in crypto_engine_unregister_aead() argument 581 crypto_unregister_aead(&alg->base); in crypto_engine_unregister_aead() 613 int crypto_engine_register_ahash(struct ahash_engine_alg *alg) in crypto_engine_register_ahash() argument [all …]
|
H A D | hmac.c | 181 struct crypto_alg *alg; in hmac_create() local 202 alg = &salg->base; in hmac_create() 211 if (ds > alg->cra_blocksize || in hmac_create() 212 ss < alg->cra_blocksize) in hmac_create() 215 err = crypto_inst_setname(shash_crypto_instance(inst), tmpl->name, alg); in hmac_create() 219 inst->alg.base.cra_priority = alg->cra_priority; in hmac_create() 220 inst->alg.base.cra_blocksize = alg->cra_blocksize; in hmac_create() 221 inst->alg.base.cra_ctxsize = sizeof(struct hmac_ctx) + (ss * 2); in hmac_create() 223 inst->alg.digestsize = ds; in hmac_create() 224 inst->alg.statesize = ss; in hmac_create() [all …]
|
H A D | xcbc.c | 188 struct crypto_alg *alg; in xcbc_create() local 205 alg = crypto_spawn_cipher_alg(spawn); in xcbc_create() 208 if (alg->cra_blocksize != XCBC_BLOCKSIZE) in xcbc_create() 211 err = crypto_inst_setname(shash_crypto_instance(inst), tmpl->name, alg); in xcbc_create() 215 inst->alg.base.cra_priority = alg->cra_priority; in xcbc_create() 216 inst->alg.base.cra_blocksize = alg->cra_blocksize; in xcbc_create() 217 inst->alg.base.cra_ctxsize = sizeof(struct xcbc_tfm_ctx) + in xcbc_create() 218 alg->cra_blocksize * 2; in xcbc_create() 220 inst->alg.digestsize = alg->cra_blocksize; in xcbc_create() 221 inst->alg.descsize = sizeof(struct xcbc_desc_ctx) + in xcbc_create() [all …]
|
H A D | ecb.c | 129 inst->alg.co.base.cra_blocksize = cipher_alg->cra_blocksize; in lskcipher_alloc_instance_simple2() 130 inst->alg.co.base.cra_alignmask = cipher_alg->cra_alignmask; in lskcipher_alloc_instance_simple2() 131 inst->alg.co.base.cra_priority = cipher_alg->cra_priority; in lskcipher_alloc_instance_simple2() 132 inst->alg.co.min_keysize = cipher_alg->cra_cipher.cia_min_keysize; in lskcipher_alloc_instance_simple2() 133 inst->alg.co.max_keysize = cipher_alg->cra_cipher.cia_max_keysize; in lskcipher_alloc_instance_simple2() 134 inst->alg.co.ivsize = cipher_alg->cra_blocksize; in lskcipher_alloc_instance_simple2() 137 inst->alg.co.base.cra_ctxsize = sizeof(struct crypto_cipher *); in lskcipher_alloc_instance_simple2() 138 inst->alg.setkey = lskcipher_setkey_simple2; in lskcipher_alloc_instance_simple2() 139 inst->alg.init = lskcipher_init_tfm_simple2; in lskcipher_alloc_instance_simple2() 140 inst->alg.exit = lskcipher_exit_tfm_simple2; in lskcipher_alloc_instance_simple2() [all …]
|
H A D | cryptd.c | 211 struct crypto_alg *alg) in cryptd_init_instance() argument 213 if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, in cryptd_init_instance() 215 alg->cra_driver_name) >= CRYPTO_MAX_ALG_NAME) in cryptd_init_instance() 218 memcpy(inst->alg.cra_name, alg->cra_name, CRYPTO_MAX_ALG_NAME); in cryptd_init_instance() 220 inst->alg.cra_priority = alg->cra_priority + 50; in cryptd_init_instance() 221 inst->alg.cra_blocksize = alg->cra_blocksize; in cryptd_init_instance() 222 inst->alg.cra_alignmask = alg->cra_alignmask; in cryptd_init_instance() 380 struct skcipher_alg_common *alg; in cryptd_create_skcipher() local 399 alg = crypto_spawn_skcipher_alg_common(&ctx->spawn); in cryptd_create_skcipher() 400 err = cryptd_init_instance(skcipher_crypto_instance(inst), &alg->base); in cryptd_create_skcipher() [all …]
|
H A D | ccm.c | 495 if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME, in crypto_ccm_create_common() 499 if (snprintf(inst->alg.base.cra_driver_name, CRYPTO_MAX_ALG_NAME, in crypto_ccm_create_common() 504 inst->alg.base.cra_priority = (mac->base.cra_priority + in crypto_ccm_create_common() 506 inst->alg.base.cra_blocksize = 1; in crypto_ccm_create_common() 507 inst->alg.base.cra_alignmask = ctr->base.cra_alignmask; in crypto_ccm_create_common() 508 inst->alg.ivsize = 16; in crypto_ccm_create_common() 509 inst->alg.chunksize = ctr->chunksize; in crypto_ccm_create_common() 510 inst->alg.maxauthsize = 16; in crypto_ccm_create_common() 511 inst->alg.base.cra_ctxsize = sizeof(struct crypto_ccm_ctx); in crypto_ccm_create_common() 512 inst->alg.init = crypto_ccm_init_tfm; in crypto_ccm_create_common() [all …]
|
H A D | cmac.c | 236 struct crypto_alg *alg; in cmac_create() local 253 alg = crypto_spawn_cipher_alg(spawn); in cmac_create() 255 switch (alg->cra_blocksize) { in cmac_create() 264 err = crypto_inst_setname(shash_crypto_instance(inst), tmpl->name, alg); in cmac_create() 268 inst->alg.base.cra_priority = alg->cra_priority; in cmac_create() 269 inst->alg.base.cra_blocksize = alg->cra_blocksize; in cmac_create() 270 inst->alg.base.cra_ctxsize = sizeof(struct cmac_tfm_ctx) + in cmac_create() 271 alg->cra_blocksize * 2; in cmac_create() 273 inst->alg.digestsize = alg->cra_blocksize; in cmac_create() 274 inst->alg.descsize = sizeof(struct cmac_desc_ctx) + in cmac_create() [all …]
|
H A D | testmgr.c | 64 int alg_test(const char *driver, const char *alg, u32 type, u32 mask) in alg_test() argument 146 const char *alg; member 2040 "unkeyed ones must come first\n", desc->alg); in alg_test_hash() 3938 const char *alg) in do_test_kpp() argument 3979 alg, err); in do_test_kpp() 3995 alg); in do_test_kpp() 4017 alg, err); in do_test_kpp() 4048 alg, err); in do_test_kpp() 4064 alg); in do_test_kpp() 4079 static int test_kpp(struct crypto_kpp *tfm, const char *alg, in test_kpp() argument [all …]
|
/linux/fs/verity/ |
H A D | hash_algs.c | 45 struct fsverity_hash_alg *alg; in fsverity_get_hash_alg() local 54 alg = &fsverity_hash_algs[num]; in fsverity_get_hash_alg() 57 if (likely(smp_load_acquire(&alg->tfm) != NULL)) in fsverity_get_hash_alg() 58 return alg; in fsverity_get_hash_alg() 62 if (alg->tfm != NULL) in fsverity_get_hash_alg() 65 tfm = crypto_alloc_shash(alg->name, 0, 0); in fsverity_get_hash_alg() 70 alg->name); in fsverity_get_hash_alg() 71 alg = ERR_PTR(-ENOPKG); in fsverity_get_hash_alg() 76 alg->name, PTR_ERR(tfm)); in fsverity_get_hash_alg() 77 alg = ERR_CAST(tfm); in fsverity_get_hash_alg() [all …]
|
/linux/tools/crypto/tcrypt/ |
H A D | tcrypt_speed_compare.py | 61 alg = match.group(1) 63 return alg, op 94 alg, op = "", "" 101 alg, op = _alg, _op 102 if alg not in result: 103 result[alg] = {} 104 if op not in result[alg]: 105 result[alg][op] = [] 109 result[alg][op].append(parsed_result) 115 for alg in base.keys(): [all …]
|