/crypto/ |
D | api.c | 33 static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg); 35 struct crypto_alg *crypto_mod_get(struct crypto_alg *alg) in crypto_mod_get() argument 37 return try_module_get(alg->cra_module) ? crypto_alg_get(alg) : NULL; in crypto_mod_get() 41 void crypto_mod_put(struct crypto_alg *alg) in crypto_mod_put() argument 43 struct module *module = alg->cra_module; in crypto_mod_put() 45 crypto_alg_put(alg); in crypto_mod_put() 52 return larval->alg.cra_driver_name[0]; in crypto_is_test_larval() 58 struct crypto_alg *q, *alg = NULL; in __crypto_alg_lookup() local 84 if (alg) in __crypto_alg_lookup() 85 crypto_mod_put(alg); in __crypto_alg_lookup() [all …]
|
D | algapi.c | 31 static int crypto_check_alg(struct crypto_alg *alg) in crypto_check_alg() argument 33 crypto_check_module_sig(alg->cra_module); in crypto_check_alg() 35 if (!alg->cra_name[0] || !alg->cra_driver_name[0]) in crypto_check_alg() 38 if (alg->cra_alignmask & (alg->cra_alignmask + 1)) in crypto_check_alg() 42 if (alg->cra_alignmask > MAX_ALGAPI_ALIGNMASK) in crypto_check_alg() 45 if (alg->cra_blocksize > MAX_ALGAPI_BLOCKSIZE) in crypto_check_alg() 49 if (!alg->cra_type && (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == in crypto_check_alg() 51 if (alg->cra_alignmask > MAX_CIPHER_ALIGNMASK) in crypto_check_alg() 54 if (alg->cra_blocksize > MAX_CIPHER_BLOCKSIZE) in crypto_check_alg() 58 if (alg->cra_priority < 0) in crypto_check_alg() [all …]
|
D | fips140-alg-registration.c | 90 static bool fips140_wait_until_ready(struct crypto_alg *alg) in fips140_wait_until_ready() argument 103 alg->cra_driver_name); in fips140_wait_until_ready() 105 pr_info("tests done, allowing %s to proceed\n", alg->cra_driver_name); in fips140_wait_until_ready() 109 static int fips140_store_init_function(struct crypto_alg *alg, void *func) in fips140_store_init_function() argument 121 ret = xa_store(&fips140_init_func_map, (unsigned long)alg, func, in fips140_store_init_function() 127 static void *fips140_load_init_function(struct crypto_alg *alg) in fips140_load_init_function() argument 129 return xa_load(&fips140_init_func_map, (unsigned long)alg); in fips140_load_init_function() 136 struct crypto_alg *alg = tfm->__crt_alg; in fips140_alg_init_tfm() local 138 fips140_load_init_function(alg); in fips140_alg_init_tfm() 140 if (fips140_wait_until_ready(alg)) in fips140_alg_init_tfm() [all …]
|
D | crypto_user_stat.c | 31 static int crypto_report_aead(struct sk_buff *skb, struct crypto_alg *alg) in crypto_report_aead() argument 39 raead.stat_encrypt_cnt = atomic64_read(&alg->stats.aead.encrypt_cnt); in crypto_report_aead() 40 raead.stat_encrypt_tlen = atomic64_read(&alg->stats.aead.encrypt_tlen); in crypto_report_aead() 41 raead.stat_decrypt_cnt = atomic64_read(&alg->stats.aead.decrypt_cnt); in crypto_report_aead() 42 raead.stat_decrypt_tlen = atomic64_read(&alg->stats.aead.decrypt_tlen); in crypto_report_aead() 43 raead.stat_err_cnt = atomic64_read(&alg->stats.aead.err_cnt); in crypto_report_aead() 48 static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg) in crypto_report_cipher() argument 56 rcipher.stat_encrypt_cnt = atomic64_read(&alg->stats.cipher.encrypt_cnt); in crypto_report_cipher() 57 rcipher.stat_encrypt_tlen = atomic64_read(&alg->stats.cipher.encrypt_tlen); in crypto_report_cipher() 58 rcipher.stat_decrypt_cnt = atomic64_read(&alg->stats.cipher.decrypt_cnt); in crypto_report_cipher() [all …]
|
D | internal.h | 26 struct crypto_alg alg; member 46 static inline unsigned int crypto_cipher_ctxsize(struct crypto_alg *alg) in crypto_cipher_ctxsize() argument 48 return alg->cra_ctxsize; in crypto_cipher_ctxsize() 51 static inline unsigned int crypto_compress_ctxsize(struct crypto_alg *alg) in crypto_compress_ctxsize() argument 53 return alg->cra_ctxsize; in crypto_compress_ctxsize() 56 struct crypto_alg *crypto_mod_get(struct crypto_alg *alg); 60 void crypto_larval_kill(struct crypto_alg *alg); 63 void crypto_remove_spawns(struct crypto_alg *alg, struct list_head *list, 66 void crypto_shoot_alg(struct crypto_alg *alg); 67 struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 type, [all …]
|
D | akcipher.c | 24 static int crypto_akcipher_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_akcipher_report() argument 36 static int crypto_akcipher_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_akcipher_report() argument 42 static void crypto_akcipher_show(struct seq_file *m, struct crypto_alg *alg) 45 static void crypto_akcipher_show(struct seq_file *m, struct crypto_alg *alg) in crypto_akcipher_show() argument 53 struct akcipher_alg *alg = crypto_akcipher_alg(akcipher); in crypto_akcipher_exit_tfm() local 55 alg->exit(akcipher); in crypto_akcipher_exit_tfm() 61 struct akcipher_alg *alg = crypto_akcipher_alg(akcipher); in crypto_akcipher_init_tfm() local 63 if (alg->exit) in crypto_akcipher_init_tfm() 66 if (alg->init) in crypto_akcipher_init_tfm() 67 return alg->init(akcipher); in crypto_akcipher_init_tfm() [all …]
|
D | crypto_user_base.c | 38 struct crypto_alg *q, *alg = NULL; in crypto_alg_match() local 63 alg = q; in crypto_alg_match() 69 return alg; in crypto_alg_match() 72 static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg) in crypto_report_cipher() argument 80 rcipher.blocksize = alg->cra_blocksize; in crypto_report_cipher() 81 rcipher.min_keysize = alg->cra_cipher.cia_min_keysize; in crypto_report_cipher() 82 rcipher.max_keysize = alg->cra_cipher.cia_max_keysize; in crypto_report_cipher() 88 static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg) in crypto_report_comp() argument 99 static int crypto_report_one(struct crypto_alg *alg, in crypto_report_one() argument 104 strscpy(ualg->cru_name, alg->cra_name, sizeof(ualg->cru_name)); in crypto_report_one() [all …]
|
D | proc.c | 38 struct crypto_alg *alg = list_entry(p, struct crypto_alg, cra_list); in c_show() local 40 seq_printf(m, "name : %s\n", alg->cra_name); in c_show() 41 seq_printf(m, "driver : %s\n", alg->cra_driver_name); in c_show() 42 seq_printf(m, "module : %s\n", module_name(alg->cra_module)); in c_show() 43 seq_printf(m, "priority : %d\n", alg->cra_priority); in c_show() 44 seq_printf(m, "refcnt : %u\n", refcount_read(&alg->cra_refcnt)); in c_show() 46 (alg->cra_flags & CRYPTO_ALG_TESTED) ? in c_show() 49 (alg->cra_flags & CRYPTO_ALG_INTERNAL) ? in c_show() 52 if (alg->cra_flags & CRYPTO_ALG_LARVAL) { in c_show() 54 seq_printf(m, "flags : 0x%x\n", alg->cra_flags); in c_show() [all …]
|
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() 146 struct skcipher_alg *alg; in simd_skcipher_create_compat() local 163 alg = &salg->alg; in simd_skcipher_create_compat() 166 if (snprintf(alg->base.cra_name, CRYPTO_MAX_ALG_NAME, "%s", algname) >= in simd_skcipher_create_compat() 170 if (snprintf(alg->base.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", in simd_skcipher_create_compat() 174 alg->base.cra_flags = CRYPTO_ALG_ASYNC | in simd_skcipher_create_compat() 176 alg->base.cra_priority = ialg->base.cra_priority; in simd_skcipher_create_compat() [all …]
|
D | aead.c | 86 struct crypto_alg *alg = aead->base.__crt_alg; in crypto_aead_encrypt() local 90 crypto_stats_get(alg); in crypto_aead_encrypt() 95 crypto_stats_aead_encrypt(cryptlen, alg, ret); in crypto_aead_encrypt() 103 struct crypto_alg *alg = aead->base.__crt_alg; in crypto_aead_decrypt() local 107 crypto_stats_get(alg); in crypto_aead_decrypt() 114 crypto_stats_aead_decrypt(cryptlen, alg, ret); in crypto_aead_decrypt() 122 struct aead_alg *alg = crypto_aead_alg(aead); in crypto_aead_exit_tfm() local 124 alg->exit(aead); in crypto_aead_exit_tfm() 130 struct aead_alg *alg = crypto_aead_alg(aead); in crypto_aead_init_tfm() local 134 aead->authsize = alg->maxauthsize; in crypto_aead_init_tfm() [all …]
|
D | kpp.c | 24 static int crypto_kpp_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_kpp_report() argument 35 static int crypto_kpp_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_kpp_report() argument 41 static void crypto_kpp_show(struct seq_file *m, struct crypto_alg *alg) 44 static void crypto_kpp_show(struct seq_file *m, struct crypto_alg *alg) in crypto_kpp_show() argument 52 struct kpp_alg *alg = crypto_kpp_alg(kpp); in crypto_kpp_exit_tfm() local 54 alg->exit(kpp); in crypto_kpp_exit_tfm() 60 struct kpp_alg *alg = crypto_kpp_alg(kpp); in crypto_kpp_init_tfm() local 62 if (alg->exit) in crypto_kpp_init_tfm() 65 if (alg->init) in crypto_kpp_init_tfm() 66 return alg->init(kpp); in crypto_kpp_init_tfm() [all …]
|
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() 261 struct skcipher_alg *alg; in crypto_rfc3686_create() local 281 alg = crypto_spawn_skcipher_alg(spawn); in crypto_rfc3686_create() [all …]
|
D | acompress.c | 27 static int crypto_acomp_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_acomp_report() argument 38 static int crypto_acomp_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_acomp_report() argument 44 static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg) 47 static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg) in crypto_acomp_show() argument 55 struct acomp_alg *alg = crypto_acomp_alg(acomp); in crypto_acomp_exit_tfm() local 57 alg->exit(acomp); in crypto_acomp_exit_tfm() 63 struct acomp_alg *alg = crypto_acomp_alg(acomp); in crypto_acomp_init_tfm() local 68 acomp->compress = alg->compress; in crypto_acomp_init_tfm() 69 acomp->decompress = alg->decompress; in crypto_acomp_init_tfm() 70 acomp->dst_free = alg->dst_free; in crypto_acomp_init_tfm() [all …]
|
D | ahash.c | 165 const struct hash_alg_common *alg = crypto_hash_alg_common(tfm); in ahash_set_needkey() local 168 !(alg->base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY)) in ahash_set_needkey() 343 struct crypto_alg *alg = tfm->base.__crt_alg; in crypto_ahash_final() local 347 crypto_stats_get(alg); in crypto_ahash_final() 349 crypto_stats_ahash_final(nbytes, ret, alg); in crypto_ahash_final() 357 struct crypto_alg *alg = tfm->base.__crt_alg; in crypto_ahash_finup() local 361 crypto_stats_get(alg); in crypto_ahash_finup() 363 crypto_stats_ahash_final(nbytes, ret, alg); in crypto_ahash_finup() 371 struct crypto_alg *alg = tfm->base.__crt_alg; in crypto_ahash_digest() local 375 crypto_stats_get(alg); in crypto_ahash_digest() [all …]
|
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 …]
|
D | shash.c | 36 bool crypto_shash_alg_has_setkey(struct shash_alg *alg) in crypto_shash_alg_has_setkey() argument 38 return alg->setkey != shash_no_setkey; in crypto_shash_alg_has_setkey() 63 static void shash_set_needkey(struct crypto_shash *tfm, struct shash_alg *alg) in shash_set_needkey() argument 65 if (crypto_shash_alg_needs_key(alg)) in shash_set_needkey() 380 struct shash_alg *alg = __crypto_shash_alg(calg); in crypto_init_shash_ops_async() local 402 if (crypto_shash_alg_has_setkey(alg)) in crypto_init_shash_ops_async() 419 struct shash_alg *alg = crypto_shash_alg(hash); in crypto_shash_exit_tfm() local 421 alg->exit_tfm(hash); in crypto_shash_exit_tfm() 427 struct shash_alg *alg = crypto_shash_alg(hash); in crypto_shash_init_tfm() local 430 hash->descsize = alg->descsize; in crypto_shash_init_tfm() [all …]
|
D | hmac.c | 169 struct crypto_alg *alg; in hmac_create() local 190 alg = &salg->base; in hmac_create() 199 if (ds > alg->cra_blocksize || in hmac_create() 200 ss < alg->cra_blocksize) in hmac_create() 203 err = crypto_inst_setname(shash_crypto_instance(inst), tmpl->name, alg); in hmac_create() 207 inst->alg.base.cra_priority = alg->cra_priority; in hmac_create() 208 inst->alg.base.cra_blocksize = alg->cra_blocksize; in hmac_create() 209 inst->alg.base.cra_alignmask = alg->cra_alignmask; in hmac_create() 211 ss = ALIGN(ss, alg->cra_alignmask + 1); in hmac_create() 212 inst->alg.digestsize = ds; in hmac_create() [all …]
|
D | rng.c | 33 struct crypto_alg *alg = tfm->base.__crt_alg; in crypto_rng_reset() local 48 crypto_stats_get(alg); in crypto_rng_reset() 50 crypto_stats_rng_seed(alg, err); in crypto_rng_reset() 62 static unsigned int seedsize(struct crypto_alg *alg) in seedsize() argument 64 struct rng_alg *ralg = container_of(alg, struct rng_alg, base); in seedsize() 70 static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_rng_report() argument 78 rrng.seedsize = seedsize(alg); in crypto_rng_report() 83 static int crypto_rng_report(struct sk_buff *skb, struct crypto_alg *alg) in crypto_rng_report() argument 89 static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg) 91 static void crypto_rng_show(struct seq_file *m, struct crypto_alg *alg) in crypto_rng_show() argument [all …]
|
D | algboss.c | 36 } alg; member 53 char alg[CRYPTO_MAX_ALG_NAME]; member 75 crypto_alg_put(¶m->larval->alg); in cryptomgr_probe() 84 const char *name = larval->alg.cra_name; in cryptomgr_schedule_probe() 135 param->attrs[i].alg.attr.rta_len = in cryptomgr_schedule_probe() 136 sizeof(param->attrs[i].alg); in cryptomgr_schedule_probe() 137 param->attrs[i].alg.attr.rta_type = CRYPTOA_ALG; in cryptomgr_schedule_probe() 138 memcpy(param->attrs[i].alg.data.name, name, len); in cryptomgr_schedule_probe() 167 param->type.data.type = larval->alg.cra_flags & ~CRYPTO_ALG_TESTED; in cryptomgr_schedule_probe() 171 param->otype = larval->alg.cra_flags; in cryptomgr_schedule_probe() [all …]
|
D | xcbc.c | 193 struct crypto_alg *alg; in xcbc_create() local 211 alg = crypto_spawn_cipher_alg(spawn); in xcbc_create() 214 if (alg->cra_blocksize != XCBC_BLOCKSIZE) in xcbc_create() 217 err = crypto_inst_setname(shash_crypto_instance(inst), tmpl->name, alg); in xcbc_create() 221 alignmask = alg->cra_alignmask | 3; in xcbc_create() 222 inst->alg.base.cra_alignmask = alignmask; in xcbc_create() 223 inst->alg.base.cra_priority = alg->cra_priority; in xcbc_create() 224 inst->alg.base.cra_blocksize = alg->cra_blocksize; in xcbc_create() 226 inst->alg.digestsize = alg->cra_blocksize; in xcbc_create() 227 inst->alg.descsize = ALIGN(sizeof(struct xcbc_desc_ctx), in xcbc_create() [all …]
|
D | pcrypt.c | 221 struct crypto_alg *alg) in pcrypt_init_instance() argument 223 if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, in pcrypt_init_instance() 224 "pcrypt(%s)", alg->cra_driver_name) >= CRYPTO_MAX_ALG_NAME) in pcrypt_init_instance() 227 memcpy(inst->alg.cra_name, alg->cra_name, CRYPTO_MAX_ALG_NAME); in pcrypt_init_instance() 229 inst->alg.cra_priority = alg->cra_priority + 100; in pcrypt_init_instance() 230 inst->alg.cra_blocksize = alg->cra_blocksize; in pcrypt_init_instance() 231 inst->alg.cra_alignmask = alg->cra_alignmask; in pcrypt_init_instance() 241 struct aead_alg *alg; in pcrypt_create_aead() local 265 alg = crypto_spawn_aead_alg(&ctx->spawn); in pcrypt_create_aead() 266 err = pcrypt_init_instance(aead_crypto_instance(inst), &alg->base); in pcrypt_create_aead() [all …]
|
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() 376 struct skcipher_alg *alg; in cryptd_create_skcipher() local 395 alg = crypto_spawn_skcipher_alg(&ctx->spawn); in cryptd_create_skcipher() 396 err = cryptd_init_instance(skcipher_crypto_instance(inst), &alg->base); in cryptd_create_skcipher() [all …]
|
D | cmac.c | 227 struct crypto_alg *alg; in cmac_create() local 245 alg = crypto_spawn_cipher_alg(spawn); in cmac_create() 247 switch (alg->cra_blocksize) { in cmac_create() 256 err = crypto_inst_setname(shash_crypto_instance(inst), tmpl->name, alg); in cmac_create() 260 alignmask = alg->cra_alignmask; in cmac_create() 261 inst->alg.base.cra_alignmask = alignmask; in cmac_create() 262 inst->alg.base.cra_priority = alg->cra_priority; in cmac_create() 263 inst->alg.base.cra_blocksize = alg->cra_blocksize; in cmac_create() 265 inst->alg.digestsize = alg->cra_blocksize; in cmac_create() 266 inst->alg.descsize = in cmac_create() [all …]
|
D | ccm.c | 496 if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME, in crypto_ccm_create_common() 500 if (snprintf(inst->alg.base.cra_driver_name, CRYPTO_MAX_ALG_NAME, in crypto_ccm_create_common() 505 inst->alg.base.cra_priority = (mac->base.cra_priority + in crypto_ccm_create_common() 507 inst->alg.base.cra_blocksize = 1; in crypto_ccm_create_common() 508 inst->alg.base.cra_alignmask = mac->base.cra_alignmask | in crypto_ccm_create_common() 510 inst->alg.ivsize = 16; in crypto_ccm_create_common() 511 inst->alg.chunksize = crypto_skcipher_alg_chunksize(ctr); in crypto_ccm_create_common() 512 inst->alg.maxauthsize = 16; in crypto_ccm_create_common() 513 inst->alg.base.cra_ctxsize = sizeof(struct crypto_ccm_ctx); in crypto_ccm_create_common() 514 inst->alg.init = crypto_ccm_init_tfm; in crypto_ccm_create_common() [all …]
|
D | cts.c | 328 struct skcipher_alg *alg; in crypto_cts_create() local 347 alg = crypto_spawn_skcipher_alg(spawn); in crypto_cts_create() 350 if (crypto_skcipher_alg_ivsize(alg) != alg->base.cra_blocksize) in crypto_cts_create() 353 if (strncmp(alg->base.cra_name, "cbc(", 4)) in crypto_cts_create() 357 &alg->base); in crypto_cts_create() 361 inst->alg.base.cra_priority = alg->base.cra_priority; in crypto_cts_create() 362 inst->alg.base.cra_blocksize = alg->base.cra_blocksize; in crypto_cts_create() 363 inst->alg.base.cra_alignmask = alg->base.cra_alignmask; in crypto_cts_create() 365 inst->alg.ivsize = alg->base.cra_blocksize; in crypto_cts_create() 366 inst->alg.chunksize = crypto_skcipher_alg_chunksize(alg); in crypto_cts_create() [all …]
|