| /linux/crypto/ |
| H A D | api.c | 38 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() 62 struct crypto_alg *q, *alg = NULL; in __crypto_alg_lookup() local 83 if (alg) in __crypto_alg_lookup() 84 crypto_mod_put(alg); in __crypto_alg_lookup() 85 alg = q; in __crypto_alg_lookup() [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 | testmgr.c | 64 int alg_test(const char *driver, const char *alg, u32 type, u32 mask) in alg_test() argument 141 const char *alg; member 145 int fips_allowed; /* set if alg is allowed in fips mode */ 1236 pr_err("alg: generic driver name for \"%s\" would be too long\n", in build_generic_driver_name() 1265 pr_err("alg: %s: %s test failed (wrong result) on test vector %s, cfg=\"%s\"\n", in check_hash_result() 1270 pr_err("alg: %s: %s overran result buffer on test vector %s, cfg=\"%s\"\n", in check_hash_result() 1282 pr_err("alg: shash: %s %s() failed with err %d on test vector %s, cfg=\"%s\"\n", in check_shash_op() 1311 …pr_err("alg: shash: %s setkey failed on test vector %s; expected_error=%d, actual_error=%d, flags=… in test_shash_vec_cfg() 1317 pr_err("alg: shash: %s setkey unexpectedly succeeded on test vector %s; expected_error=%d\n", in test_shash_vec_cfg() 1326 pr_err("alg: shash: %s: error preparing scatterlist for test vector %s, cfg=\"%s\"\n", in test_shash_vec_cfg() [all …]
|
| H A D | gcm.c | 615 if (snprintf(inst->alg.base.cra_name, CRYPTO_MAX_ALG_NAME, in crypto_gcm_create_common() 619 if (snprintf(inst->alg.base.cra_driver_name, CRYPTO_MAX_ALG_NAME, in crypto_gcm_create_common() 625 inst->alg.base.cra_priority = (ghash->base.cra_priority + in crypto_gcm_create_common() 627 inst->alg.base.cra_blocksize = 1; in crypto_gcm_create_common() 628 inst->alg.base.cra_alignmask = ctr->base.cra_alignmask; in crypto_gcm_create_common() 629 inst->alg.base.cra_ctxsize = sizeof(struct crypto_gcm_ctx); in crypto_gcm_create_common() 630 inst->alg.ivsize = GCM_AES_IV_SIZE; in crypto_gcm_create_common() 631 inst->alg.chunksize = ctr->chunksize; in crypto_gcm_create_common() 632 inst->alg.maxauthsize = 16; in crypto_gcm_create_common() 633 inst->alg.init = crypto_gcm_init_tfm; in crypto_gcm_create_common() [all …]
|
| H A D | algboss.c | 46 char alg[CRYPTO_MAX_ALG_NAME]; member 68 param->larval->alg.cra_flags |= CRYPTO_ALG_DEAD; in cryptomgr_probe() 70 crypto_alg_put(¶m->larval->alg); in cryptomgr_probe() 79 const char *name = larval->alg.cra_name; in cryptomgr_schedule_probe() 147 param->type.data.type = larval->alg.cra_flags & ~CRYPTO_ALG_TESTED; in cryptomgr_schedule_probe() 151 param->otype = larval->alg.cra_flags; in cryptomgr_schedule_probe() 154 crypto_alg_get(&larval->alg); in cryptomgr_schedule_probe() 164 crypto_alg_put(&larval->alg); in cryptomgr_schedule_probe() 179 err = alg_test(param->driver, param->alg, type, CRYPTO_ALG_TESTED); in cryptomgr_test() 187 static int cryptomgr_schedule_test(struct crypto_alg *alg) in cryptomgr_schedule_test() argument [all …]
|
| H A D | essiv.c | 414 struct crypto_alg *alg; in essiv_supported_algorithms() local 417 alg = crypto_alg_mod_lookup(essiv_cipher_name, in essiv_supported_algorithms() 420 if (IS_ERR(alg)) in essiv_supported_algorithms() 423 if (hash_alg->digestsize < alg->cra_cipher.cia_min_keysize || in essiv_supported_algorithms() 424 hash_alg->digestsize > alg->cra_cipher.cia_max_keysize) in essiv_supported_algorithms() 427 if (ivsize != alg->cra_blocksize) in essiv_supported_algorithms() 436 crypto_mod_put(alg); in essiv_supported_algorithms() 481 base = &skcipher_inst->alg.base; in essiv_create() 501 base = &aead_inst->alg.base; in essiv_create() 575 skcipher_inst->alg.setkey = essiv_skcipher_setkey; in essiv_create() [all …]
|
| /linux/tools/crypto/tcrypt/ |
| H A D | tcrypt_speed_compare.py | 33 modprobe tcrypt alg="pcrypt(rfc4106(gcm(aes)))" type=3 40 modprobe tcrypt alg="pcrypt(rfc4106(gcm(aes)))" type=3 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] = [] [all …]
|
| /linux/scripts/crypto/ |
| H A D | gen-hash-testvecs.py | 82 def hash_init(alg): argument 83 if alg == 'poly1305': 87 if alg == 'polyval': 89 return hashlib.new(alg) 97 def compute_hash(alg, data): argument 98 ctx = hash_init(alg) 118 def alg_digest_size_const(alg): argument 119 if alg.startswith('blake2'): 120 return f'{alg.upper()}_HASH_SIZE' 121 return f"{alg.upper().replace('-', '_')}_DIGEST_SIZE" [all …]
|
| /linux/drivers/crypto/bcm/ |
| H A D | cipher.c | 323 cipher_parms.alg = ctx->cipher.alg; in handle_skcipher_req() 382 * any other cipher alg. in handle_skcipher_req() 413 0, ctx->auth.alg, ctx->auth.mode, in handle_skcipher_req() 500 &iproc_priv.cipher_cnt[ctx->cipher.alg][ctx->cipher.mode]); in handle_skcipher_resp() 700 hash_parms.alg = ctx->auth.alg; in handle_ahash_req() 769 if (hash_parms.alg == HASH_ALG_AES) in handle_ahash_req() 774 digestsize = spu->spu_digest_size(ctx->digestsize, ctx->auth.alg, in handle_ahash_req() 784 hash_parms.pad_len = spu->spu_hash_pad_len(hash_parms.alg, in handle_ahash_req() 794 (hash_parms.alg != HASH_ALG_AES)) { in handle_ahash_req() 841 hash_parms.pad_len, ctx->auth.alg, in handle_ahash_req() [all …]
|
| H A D | util.c | 295 /* Returns the name for a given cipher alg/mode */ 296 char *spu_alg_name(enum spu_cipher_alg alg, enum spu_cipher_mode mode) in spu_alg_name() argument 298 switch (alg) { in spu_alg_name() 359 u32 alg; in spu_debugfs_read() local 386 for (alg = 0; alg < CIPHER_ALG_LAST; alg++) { in spu_debugfs_read() 388 op_cnt = atomic_read(&ipriv->cipher_cnt[alg][mode]); in spu_debugfs_read() 393 spu_alg_name(alg, mode), op_cnt); in spu_debugfs_read() 400 for (alg = 0; alg < HASH_ALG_LAST; alg++) { in spu_debugfs_read() 401 op_cnt = atomic_read(&ipriv->hash_cnt[alg]); in spu_debugfs_read() 406 hash_alg_name[alg], op_cnt); in spu_debugfs_read() [all …]
|
| /linux/fs/verity/ |
| H A D | hash_algs.c | 33 * Return: pointer to the hash alg if it's known, otherwise NULL. 48 * @alg: hash algorithm 55 fsverity_prepare_hash_state(const struct fsverity_hash_alg *alg, in fsverity_prepare_hash_state() argument 70 padded_salt_size = round_up(salt_size, alg->block_size); in fsverity_prepare_hash_state() 76 switch (alg->algo_id) { in fsverity_prepare_hash_state() 132 * @alg: the hash algorithm to use 135 * @out: output digest, size 'alg->digest_size' bytes 137 void fsverity_hash_buffer(const struct fsverity_hash_alg *alg, in fsverity_hash_buffer() argument 140 switch (alg->algo_id) { in fsverity_hash_buffer() 161 const struct fsverity_hash_alg *alg = &fsverity_hash_algs[i]; in fsverity_check_hash_algs() local [all …]
|
| /linux/net/ipv4/ |
| H A D | tcp_sigpool.c | 24 const char *alg; member 120 static int __cpool_alloc_ahash(struct sigpool_entry *e, const char *alg) in __cpool_alloc_ahash() argument 125 e->alg = kstrdup(alg, GFP_KERNEL); in __cpool_alloc_ahash() 126 if (!e->alg) in __cpool_alloc_ahash() 129 cpu0_hash = crypto_alloc_ahash(alg, 0, CRYPTO_ALG_ASYNC); in __cpool_alloc_ahash() 147 kfree(e->alg); in __cpool_alloc_ahash() 148 e->alg = NULL; in __cpool_alloc_ahash() 154 * @alg: name of async hash algorithm 157 int tcp_sigpool_alloc_ahash(const char *alg, size_ argument [all...] |
| /linux/drivers/crypto/ccp/ |
| H A D | ccp-crypto-aes-xts.c | 231 struct skcipher_alg *alg; in ccp_register_aes_xts_alg() local 240 alg = &ccp_alg->alg; in ccp_register_aes_xts_alg() 242 snprintf(alg->base.cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name); in ccp_register_aes_xts_alg() 243 snprintf(alg->base.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", in ccp_register_aes_xts_alg() 245 alg->base.cra_flags = CRYPTO_ALG_ASYNC | in ccp_register_aes_xts_alg() 249 alg->base.cra_blocksize = AES_BLOCK_SIZE; in ccp_register_aes_xts_alg() 250 alg->base.cra_ctxsize = sizeof(struct ccp_ctx) + in ccp_register_aes_xts_alg() 252 alg->base.cra_priority = CCP_CRA_PRIORITY; in ccp_register_aes_xts_alg() 253 alg->base.cra_module = THIS_MODULE; in ccp_register_aes_xts_alg() 255 alg->setkey = ccp_aes_xts_setkey; in ccp_register_aes_xts_alg() [all …]
|
| H A D | ccp-crypto-sha.c | 187 struct ccp_crypto_ahash_alg *alg = in ccp_sha_init() local 194 rctx->type = alg->type; in ccp_sha_init() 334 struct ccp_crypto_ahash_alg *alg = ccp_crypto_ahash_alg(tfm); in ccp_hmac_sha_cra_init() local 337 hmac_tfm = crypto_alloc_shash(alg->child_alg, 0, 0); in ccp_hmac_sha_cra_init() 340 alg->child_alg); in ccp_hmac_sha_cra_init() 416 struct ahash_alg *alg; in ccp_register_hmac_alg() local 431 alg = &ccp_alg->alg; in ccp_register_hmac_alg() 432 alg->setkey = ccp_sha_setkey; in ccp_register_hmac_alg() 434 halg = &alg->halg; in ccp_register_hmac_alg() 443 ret = crypto_register_ahash(alg); in ccp_register_hmac_alg() [all …]
|
| H A D | ccp-crypto-des3.c | 41 struct ccp_crypto_skcipher_alg *alg = ccp_crypto_skcipher_alg(tfm); in ccp_des3_setkey() local 53 ctx->u.des3.mode = alg->mode; in ccp_des3_setkey() 182 struct skcipher_alg *alg; in ccp_register_des3_alg() local 194 alg = &ccp_alg->alg; in ccp_register_des3_alg() 195 *alg = *def->alg_defaults; in ccp_register_des3_alg() 196 snprintf(alg->base.cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name); in ccp_register_des3_alg() 197 snprintf(alg->base.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", in ccp_register_des3_alg() 199 alg->base.cra_blocksize = def->blocksize; in ccp_register_des3_alg() 200 alg->ivsize = def->ivsize; in ccp_register_des3_alg() 202 ret = crypto_register_skcipher(alg); in ccp_register_des3_alg() [all …]
|
| H A D | ccp-crypto.h | 41 struct skcipher_alg alg; member 49 struct aead_alg alg; member 62 struct ahash_alg alg; member 68 struct akcipher_alg alg; member 74 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in ccp_crypto_skcipher_alg() local 76 return container_of(alg, struct ccp_crypto_skcipher_alg, alg); in ccp_crypto_skcipher_alg() 82 struct crypto_alg *alg = tfm->__crt_alg; in ccp_crypto_ahash_alg() local 85 ahash_alg = container_of(alg, struct ahash_alg, halg.base); in ccp_crypto_ahash_alg() 87 return container_of(ahash_alg, struct ccp_crypto_ahash_alg, alg); in ccp_crypto_ahash_alg()
|
| /linux/drivers/net/wireless/intel/ipw2x00/ |
| H A D | libipw_crypto.c | 160 struct libipw_crypto_alg *alg; in libipw_register_crypto_ops() local 162 alg = kzalloc_obj(*alg); in libipw_register_crypto_ops() 163 if (alg == NULL) in libipw_register_crypto_ops() 166 alg->ops = ops; in libipw_register_crypto_ops() 169 list_add(&alg->list, &libipw_crypto_algs); in libipw_register_crypto_ops() 181 struct libipw_crypto_alg *alg; in libipw_unregister_crypto_ops() local 185 list_for_each_entry(alg, &libipw_crypto_algs, list) { in libipw_unregister_crypto_ops() 186 if (alg->ops == ops) in libipw_unregister_crypto_ops() 195 list_del(&alg->list); in libipw_unregister_crypto_ops() 197 kfree(alg); in libipw_unregister_crypto_ops() [all …]
|
| /linux/drivers/crypto/qce/ |
| H A D | skcipher.c | 440 struct skcipher_alg *alg; in qce_skcipher_register_one() local 447 alg = &tmpl->alg.skcipher; in qce_skcipher_register_one() 449 snprintf(alg->base.cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name); in qce_skcipher_register_one() 450 snprintf(alg->base.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s", in qce_skcipher_register_one() 453 alg->base.cra_blocksize = def->blocksize; in qce_skcipher_register_one() 454 alg->chunksize = def->chunksize; in qce_skcipher_register_one() 455 alg->ivsize = def->ivsize; in qce_skcipher_register_one() 456 alg->min_keysize = def->min_keysize; in qce_skcipher_register_one() 457 alg->max_keysize = def->max_keysize; in qce_skcipher_register_one() 458 alg->setkey = IS_3DES(def->flags) ? qce_des3_setkey : in qce_skcipher_register_one() [all …]
|
| /linux/security/ipe/ |
| H A D | digest.c | 29 char *alg = NULL; in ipe_digest_parse() local 42 alg = kstrndup(valstr, sep - valstr, GFP_KERNEL); in ipe_digest_parse() 43 if (!alg) { in ipe_digest_parse() 64 info->alg = alg; in ipe_digest_parse() 69 kfree(alg); in ipe_digest_parse() 88 (!strcmp(expected->alg, digest->alg)) && in ipe_digest_eval() 101 kfree(info->alg); in ipe_digest_free() 116 audit_log_untrustedstring(ab, info->alg); in ipe_digest_audit()
|
| /linux/drivers/crypto/tegra/ |
| H A D | tegra-se-aes.c | 27 u32 alg; member 48 u32 alg; member 72 unsigned int alg; member 121 if (ctx->alg == SE_ALG_CBC) { in tegra_aes_update_iv() 123 } else if (ctx->alg == SE_ALG_CTR) { in tegra_aes_update_iv() 132 static int tegra234_aes_crypto_cfg(u32 alg, bool encrypt) in tegra234_aes_crypto_cfg() argument 134 switch (alg) { in tegra234_aes_crypto_cfg() 168 static int tegra234_aes_cfg(u32 alg, bool encrypt) in tegra234_aes_cfg() argument 170 switch (alg) { in tegra234_aes_cfg() 272 rctx->iv = (ctx->alg == SE_ALG_ECB) ? NULL : (u32 *)req->iv; in tegra_aes_do_one_req() [all …]
|
| /linux/include/crypto/internal/ |
| H A D | aead.h | 25 struct aead_alg alg; member 50 return container_of(&inst->alg.base, struct crypto_instance, alg); in aead_crypto_instance() 55 return container_of(&inst->alg, struct aead_instance, alg.base); in aead_instance() 111 return container_of(spawn->base.alg, struct aead_alg, base); in crypto_spawn_aead_alg() 139 static inline unsigned int crypto_aead_alg_chunksize(struct aead_alg *alg) in crypto_aead_alg_chunksize() argument 141 return alg->chunksize; in crypto_aead_alg_chunksize() 160 int crypto_register_aead(struct aead_alg *alg); 161 void crypto_unregister_aead(struct aead_alg *alg);
|
| /linux/Documentation/crypto/ |
| H A D | api-samples.rst | 104 static struct sdesc *init_sdesc(struct crypto_shash *alg) 109 size = sizeof(struct shash_desc) + crypto_shash_descsize(alg); 113 sdesc->shash.tfm = alg; 117 static int calc_hash(struct crypto_shash *alg, 124 sdesc = init_sdesc(alg); 138 struct crypto_shash *alg; 142 alg = crypto_alloc_shash(hash_alg_name, 0, 0); 143 if (IS_ERR(alg)) { 144 pr_info("can't alloc alg %s\n", hash_alg_name); 145 return PTR_ERR(alg); [all …]
|
| /linux/drivers/crypto/rockchip/ |
| H A D | rk3288_crypto_skcipher.c | 26 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in rk_cipher_need_fallback() local 27 struct rk_crypto_tmp *algt = container_of(alg, struct rk_crypto_tmp, alg.skcipher.base); in rk_cipher_need_fallback() 73 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in rk_cipher_fallback() local 74 struct rk_crypto_tmp *algt = container_of(alg, struct rk_crypto_tmp, alg.skcipher.base); in rk_cipher_fallback() 313 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in rk_cipher_run() local 314 struct rk_crypto_tmp *algt = container_of(alg, struct rk_crypto_tmp, alg.skcipher.base); in rk_cipher_run() 437 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in rk_cipher_tfm_init() local 438 struct rk_crypto_tmp *algt = container_of(alg, struct rk_crypto_tmp, alg.skcipher.base); in rk_cipher_tfm_init() 463 .alg.skcipher.base = { 481 .alg.skcipher.op = { [all …]
|
| /linux/drivers/crypto/amcc/ |
| H A D | crypto4xx_core.c | 908 struct skcipher_alg *alg = crypto_skcipher_alg(sk); in crypto4xx_sk_init() local 912 if (alg->base.cra_flags & CRYPTO_ALG_NEED_FALLBACK) { in crypto4xx_sk_init() 914 crypto_alloc_sync_skcipher(alg->base.cra_name, 0, in crypto4xx_sk_init() 920 amcc_alg = container_of(alg, struct crypto4xx_alg, alg.u.cipher); in crypto4xx_sk_init() 941 struct aead_alg *alg = crypto_aead_alg(tfm); in crypto4xx_aead_init() local 945 ctx->sw_cipher.aead = crypto_alloc_aead(alg->base.cra_name, 0, in crypto4xx_aead_init() 951 amcc_alg = container_of(alg, struct crypto4xx_alg, alg.u.aead); in crypto4xx_aead_init() 971 struct crypto4xx_alg *alg; in crypto4xx_register_alg() local 976 alg = kzalloc_obj(struct crypto4xx_alg); in crypto4xx_register_alg() 977 if (!alg) in crypto4xx_register_alg() [all …]
|
| /linux/lib/crypto/tests/ |
| H A D | sha3_kunit.c | 250 static void shake(int alg, const u8 *in, size_t in_len, u8 *out, size_t out_len) in shake() argument 252 if (alg == 0) in shake() 258 static void shake_init(struct shake_ctx *ctx, int alg) in shake_init() argument 260 if (alg == 0) in shake_init() 283 for (int alg = 0; alg < 2; alg++) { in test_shake_all_lens_up_to_4096() local 288 shake(alg, in, in_len, out, out_len); in test_shake_all_lens_up_to_4096() 292 if (alg == 0) in test_shake_all_lens_up_to_4096() 320 const int alg = rand32() % 2; in test_shake_multiple_squeezes() local 334 shake(alg, in, in_len, ref_out, out_len); in test_shake_multiple_squeezes() 337 shake_init(&ctx, alg); in test_shake_multiple_squeezes() [all …]
|