/linux/arch/x86/crypto/ |
H A D | aes_ctrby8_avx-x86_64.S | 112 .macro do_aes b, k, key_len, xctr 115 .set klen, \key_len 400 .macro do_aes_load val, key_len, xctr 401 do_aes \val, 1, \key_len, \xctr 404 .macro do_aes_noload val, key_len, xctr 405 do_aes \val, 0, \key_len, \xctr 410 .macro do_aes_ctrmain key_len, xctr 412 jb .Ldo_return2\xctr\key_len 425 jz .Lmult_of_8_blks\xctr\key_len 429 jg .Lgt4\xctr\key_len [all …]
|
/linux/drivers/firmware/efi/ |
H A D | apple-properties.c | 57 u32 key_len, val_len, entry_len; in unmarshal_key_value_pairs() local 61 if (sizeof(key_len) > remaining) in unmarshal_key_value_pairs() 64 key_len = *(typeof(key_len) *)ptr; in unmarshal_key_value_pairs() 65 if (key_len + sizeof(val_len) > remaining || in unmarshal_key_value_pairs() 66 key_len < sizeof(key_len) + sizeof(efi_char16_t) || in unmarshal_key_value_pairs() 67 *(efi_char16_t *)(ptr + sizeof(key_len)) == 0) { in unmarshal_key_value_pairs() 73 val_len = *(typeof(val_len) *)(ptr + key_len); in unmarshal_key_value_pairs() 74 if (key_len + val_len > remaining || in unmarshal_key_value_pairs() 77 ptr - (void *)dev_header + key_len); in unmarshal_key_value_pairs() 82 key = kzalloc((key_len - sizeof(key_len)) * 4 + 1, GFP_KERNEL); in unmarshal_key_value_pairs() [all …]
|
/linux/arch/sparc/crypto/ |
H A D | camellia_glue.c | 31 int key_len; member 35 unsigned int key_len, u64 *decrypt_key); 38 unsigned int key_len) in camellia_set_key() argument 43 if (key_len != 16 && key_len != 24 && key_len != 32) in camellia_set_key() 46 ctx->key_len = key_len; in camellia_set_key() 49 key_len, &ctx->decrypt_key[0]); in camellia_set_key() 54 const u8 *in_key, unsigned int key_len) in camellia_set_key_skcipher() argument 56 return camellia_set_key(crypto_skcipher_tfm(tfm), in_key, key_len); in camellia_set_key_skcipher() 60 u32 *output, unsigned int key_len); 68 (u32 *) dst, ctx->key_len); in camellia_encrypt() [all …]
|
/linux/arch/s390/crypto/ |
H A D | aes_s390.c | 45 int key_len; member 61 int key_len; member 78 unsigned int key_len) in setkey_fallback_cip() argument 86 return crypto_cipher_setkey(sctx->fallback.cip, in_key, key_len); in setkey_fallback_cip() 90 unsigned int key_len) in aes_set_key() argument 96 fc = (key_len == 16) ? CPACF_KM_AES_128 : in aes_set_key() 97 (key_len == 24) ? CPACF_KM_AES_192 : in aes_set_key() 98 (key_len == 32) ? CPACF_KM_AES_256 : 0; in aes_set_key() 103 return setkey_fallback_cip(tfm, in_key, key_len); in aes_set_key() 105 sctx->key_len = key_len; in aes_set_key() [all …]
|
/linux/drivers/nvme/common/ |
H A D | auth.c | 153 u32 nvme_auth_key_struct_size(u32 key_len) in nvme_auth_key_struct_size() argument 157 return struct_size(&key, key, key_len); in nvme_auth_key_struct_size() 167 int ret, key_len; in nvme_auth_extract_key() local 178 key_len = base64_decode(secret, allocated_len, key->key); in nvme_auth_extract_key() 179 if (key_len < 0) { in nvme_auth_extract_key() 181 key_len); in nvme_auth_extract_key() 182 ret = key_len; in nvme_auth_extract_key() 186 if (key_len != 36 && key_len != 52 && in nvme_auth_extract_key() 187 key_len != 68) { in nvme_auth_extract_key() 188 pr_err("Invalid key len %d\n", key_len); in nvme_auth_extract_key() [all …]
|
/linux/drivers/crypto/ccp/ |
H A D | ccp-crypto-aes-xts.c | 76 unsigned int key_len) in ccp_aes_xts_setkey() argument 82 ret = xts_verify_key(tfm, key, key_len); in ccp_aes_xts_setkey() 89 switch (key_len) { in ccp_aes_xts_setkey() 91 memcpy(ctx->u.aes.key, key, key_len); in ccp_aes_xts_setkey() 95 memcpy(ctx->u.aes.key, key, key_len); in ccp_aes_xts_setkey() 98 ctx->u.aes.key_len = key_len / 2; in ccp_aes_xts_setkey() 99 sg_init_one(&ctx->u.aes.key_sg, ctx->u.aes.key, key_len); in ccp_aes_xts_setkey() 101 return crypto_skcipher_setkey(ctx->u.aes.tfm_skcipher, key, key_len); in ccp_aes_xts_setkey() 116 if (!ctx->u.aes.key_len) in ccp_aes_xts_crypt() 142 (ctx->u.aes.key_len != AES_KEYSIZE_128)) in ccp_aes_xts_crypt() [all …]
|
H A D | ccp-crypto-aes.c | 39 unsigned int key_len) in ccp_aes_setkey() argument 44 switch (key_len) { in ccp_aes_setkey() 58 ctx->u.aes.key_len = key_len; in ccp_aes_setkey() 60 memcpy(ctx->u.aes.key, key, key_len); in ccp_aes_setkey() 61 sg_init_one(&ctx->u.aes.key_sg, ctx->u.aes.key, key_len); in ccp_aes_setkey() 74 if (!ctx->u.aes.key_len) in ccp_aes_crypt() 100 rctx->cmd.u.aes.key_len = ctx->u.aes.key_len; in ccp_aes_crypt() 125 ctx->u.aes.key_len = 0; in ccp_aes_init_tfm() 145 unsigned int key_len) in ccp_aes_rfc3686_setkey() argument 149 if (key_len < CTR_RFC3686_NONCE_SIZE) in ccp_aes_rfc3686_setkey() [all …]
|
H A D | ccp-crypto-aes-galois.c | 30 unsigned int key_len) in ccp_aes_gcm_setkey() argument 34 switch (key_len) { in ccp_aes_gcm_setkey() 49 ctx->u.aes.key_len = key_len; in ccp_aes_gcm_setkey() 51 memcpy(ctx->u.aes.key, key, key_len); in ccp_aes_gcm_setkey() 52 sg_init_one(&ctx->u.aes.key_sg, ctx->u.aes.key, key_len); in ccp_aes_gcm_setkey() 86 if (!ctx->u.aes.key_len) in ccp_aes_gcm_crypt() 124 rctx->cmd.u.aes.key_len = ctx->u.aes.key_len; in ccp_aes_gcm_crypt() 154 ctx->u.aes.key_len = 0; in ccp_aes_gcm_cra_init()
|
H A D | ccp-crypto-des3.c | 38 unsigned int key_len) in ccp_des3_setkey() argument 53 ctx->u.des3.key_len = key_len; in ccp_des3_setkey() 55 memcpy(ctx->u.des3.key, key, key_len); in ccp_des3_setkey() 56 sg_init_one(&ctx->u.des3.key_sg, ctx->u.des3.key, key_len); in ccp_des3_setkey() 69 if (!ctx->u.des3.key_len) in ccp_des3_crypt() 96 rctx->cmd.u.des3.key_len = ctx->u.des3.key_len; in ccp_des3_crypt() 121 ctx->u.des3.key_len = 0; in ccp_des3_init_tfm()
|
H A D | ccp-crypto-aes-cmac.c | 69 if (!ctx->u.aes.key_len) in ccp_do_cmac_update() 163 rctx->cmd.u.aes.key_len = ctx->u.aes.key_len; in ccp_do_cmac_update() 257 unsigned int key_len) in ccp_aes_cmac_setkey() argument 268 switch (key_len) { in ccp_aes_cmac_setkey() 284 ctx->u.aes.key_len = 0; in ccp_aes_cmac_setkey() 287 ret = aes_expandkey(&aes, key, key_len); in ccp_aes_cmac_setkey() 328 memcpy(ctx->u.aes.key, key, key_len); in ccp_aes_cmac_setkey() 329 ctx->u.aes.key_len = key_len; in ccp_aes_cmac_setkey() 330 sg_init_one(&ctx->u.aes.key_sg, ctx->u.aes.key, key_len); in ccp_aes_cmac_setkey() 341 ctx->u.aes.key_len = 0; in ccp_aes_cmac_cra_init()
|
/linux/arch/arm64/crypto/ |
H A D | aes-ce-glue.c | 75 unsigned int key_len) in ce_aes_expandkey() argument 84 u32 kwords = key_len / sizeof(u32); in ce_aes_expandkey() 88 if (key_len != AES_KEYSIZE_128 && in ce_aes_expandkey() 89 key_len != AES_KEYSIZE_192 && in ce_aes_expandkey() 90 key_len != AES_KEYSIZE_256) in ce_aes_expandkey() 93 ctx->key_length = key_len; in ce_aes_expandkey() 107 if (key_len == AES_KEYSIZE_192) { in ce_aes_expandkey() 112 } else if (key_len == AES_KEYSIZE_256) { in ce_aes_expandkey() 143 unsigned int key_len) in ce_aes_setkey() argument 147 return ce_aes_expandkey(ctx, in_key, key_len); in ce_aes_setkey()
|
/linux/security/keys/trusted-keys/ |
H A D | trusted_core.c | 99 p->key_len = keylen; in datablob_parse() 158 size_t key_len; in trusted_instantiate() local 191 key_len = payload->key_len; in trusted_instantiate() 193 key_len); in trusted_instantiate() 197 if (ret != key_len) { in trusted_instantiate() 267 new_p->key_len = p->key_len; in trusted_update() 268 memcpy(new_p->key, p->key, p->key_len); in trusted_update() 327 static int kernel_get_random(unsigned char *key, size_t key_len) in kernel_get_random() argument 329 return get_random_bytes_wait(key, key_len) ?: key_len; in kernel_get_random() 334 int (*get_random)(unsigned char *key, size_t key_len); in init_trusted()
|
/linux/drivers/crypto/nx/ |
H A D | nx-aes-ctr.c | 24 unsigned int key_len) in ctr_aes_nx_set_key() argument 31 switch (key_len) { in ctr_aes_nx_set_key() 49 memcpy(csbcpb->cpb.aes_ctr.key, in_key, key_len); in ctr_aes_nx_set_key() 56 unsigned int key_len) in ctr3686_aes_nx_set_key() argument 60 if (key_len < CTR_RFC3686_NONCE_SIZE) in ctr3686_aes_nx_set_key() 64 in_key + key_len - CTR_RFC3686_NONCE_SIZE, in ctr3686_aes_nx_set_key() 67 key_len -= CTR_RFC3686_NONCE_SIZE; in ctr3686_aes_nx_set_key() 69 return ctr_aes_nx_set_key(tfm, in_key, key_len); in ctr3686_aes_nx_set_key()
|
/linux/drivers/crypto/bcm/ |
H A D | spu2.c | 1003 flow_log(" key: %d\n", cipher_parms->key_len); in spu2_create_request() 1004 flow_dump(" key: ", cipher_parms->key_buf, cipher_parms->key_len); in spu2_create_request() 1010 flow_log(" authkey: %d\n", hash_parms->key_len); in spu2_create_request() 1011 flow_dump(" authkey: ", hash_parms->key_buf, hash_parms->key_len); in spu2_create_request() 1037 hash_parms->key_len = cipher_parms->key_len; in spu2_create_request() 1039 cipher_parms->key_len); in spu2_create_request() 1040 cipher_parms->key_len = 0; in spu2_create_request() 1075 hash_parms->key_len, cipher_parms->key_len, in spu2_create_request() 1082 spu2_fmd_ctrl2_write(fmd, cipher_offset, hash_parms->key_len, 0, in spu2_create_request() 1083 cipher_parms->key_len, cipher_parms->iv_len); in spu2_create_request() [all …]
|
H A D | spu.c | 647 flow_log(" key: %d\n", cipher_parms->key_len); in spum_create_request() 648 flow_dump(" key: ", cipher_parms->key_buf, cipher_parms->key_len); in spum_create_request() 654 flow_log(" authkey: %d\n", hash_parms->key_len); in spum_create_request() 655 flow_dump(" authkey: ", hash_parms->key_buf, hash_parms->key_len); in spum_create_request() 703 if (hash_parms->key_len) { in spum_create_request() 704 memcpy(ptr, hash_parms->key_buf, hash_parms->key_len); in spum_create_request() 705 ptr += hash_parms->key_len; in spum_create_request() 706 buf_len += hash_parms->key_len; in spum_create_request() 707 sctx_words += hash_parms->key_len / 4; in spum_create_request() 737 if (cipher_parms->key_len) { in spum_create_request() [all …]
|
/linux/arch/powerpc/platforms/pseries/ |
H A D | plpks-secvar.c | 75 static int plpks_get_variable(const char *key, u64 key_len, u8 *data, in plpks_get_variable() argument 83 var.name = kcalloc(key_len - 1, sizeof(wchar_t), GFP_KERNEL); in plpks_get_variable() 86 rc = utf8s_to_utf16s(key, key_len - 1, UTF16_LITTLE_ENDIAN, (wchar_t *)var.name, in plpks_get_variable() 87 key_len - 1); in plpks_get_variable() 115 static int plpks_set_variable(const char *key, u64 key_len, u8 *data, in plpks_set_variable() argument 129 var.name = kcalloc(key_len - 1, sizeof(wchar_t), GFP_KERNEL); in plpks_set_variable() 132 rc = utf8s_to_utf16s(key, key_len - 1, UTF16_LITTLE_ENDIAN, (wchar_t *)var.name, in plpks_set_variable() 133 key_len - 1); in plpks_set_variable()
|
/linux/crypto/ |
H A D | aria_generic.c | 28 unsigned int key_len) in aria_set_encrypt_key() argument 36 ck = &key_rc[(key_len - 16) / 2]; in aria_set_encrypt_key() 50 if (key_len > 16) { in aria_set_encrypt_key() 53 if (key_len > 24) { in aria_set_encrypt_key() 134 if (key_len > 16) { in aria_set_encrypt_key() 140 if (key_len > 24) { in aria_set_encrypt_key() 174 int aria_set_key(struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len) in aria_set_key() argument 178 if (key_len != 16 && key_len != 24 && key_len != 32) in aria_set_key() 185 ctx->key_length = key_len; in aria_set_key() 186 ctx->rounds = (key_len + 32) / 4; in aria_set_key() [all …]
|
H A D | aes_generic.c | 1137 unsigned int key_len) in crypto_aes_set_key() argument 1141 return aes_expandkey(ctx, in_key, key_len); in crypto_aes_set_key() 1181 const int key_len = ctx->key_length; in crypto_aes_encrypt() local 1188 if (key_len > 24) { in crypto_aes_encrypt() 1193 if (key_len > 16) { in crypto_aes_encrypt() 1250 const int key_len = ctx->key_length; in crypto_aes_decrypt() local 1258 if (key_len > 24) { in crypto_aes_decrypt() 1263 if (key_len > 16) { in crypto_aes_decrypt()
|
/linux/lib/crypto/ |
H A D | aes.c | 186 unsigned int key_len) in aes_expandkey() argument 188 u32 kwords = key_len / sizeof(u32); in aes_expandkey() 192 err = aes_check_keylen(key_len); in aes_expandkey() 196 ctx->key_length = key_len; in aes_expandkey() 210 if (key_len == AES_KEYSIZE_192) { in aes_expandkey() 215 } else if (key_len == AES_KEYSIZE_256) { in aes_expandkey() 231 ctx->key_dec[0] = ctx->key_enc[key_len + 24]; in aes_expandkey() 232 ctx->key_dec[1] = ctx->key_enc[key_len + 25]; in aes_expandkey() 233 ctx->key_dec[2] = ctx->key_enc[key_len + 26]; in aes_expandkey() 234 ctx->key_dec[3] = ctx->key_enc[key_len + 27]; in aes_expandkey() [all …]
|
/linux/arch/arm/crypto/ |
H A D | aes-neonbs-glue.c | 68 unsigned int key_len) in aesbs_setkey() argument 74 err = aes_expandkey(&rk, in_key, key_len); in aesbs_setkey() 78 ctx->rounds = 6 + key_len / 4; in aesbs_setkey() 127 unsigned int key_len) in aesbs_cbc_setkey() argument 132 err = aes_expandkey(&ctx->fallback, in_key, key_len); in aesbs_cbc_setkey() 136 ctx->key.rounds = 6 + key_len / 4; in aesbs_cbc_setkey() 204 unsigned int key_len) in aesbs_ctr_setkey_sync() argument 209 err = aes_expandkey(&ctx->fallback, in_key, key_len); in aesbs_ctr_setkey_sync() 213 ctx->key.rounds = 6 + key_len / 4; in aesbs_ctr_setkey_sync() 273 unsigned int key_len) in aesbs_xts_setkey() argument [all …]
|
/linux/tools/testing/selftests/bpf/progs/ |
H A D | crypto_bench.c | 15 u32 key_len, authsize; variable 27 .key_len = key_len, in crypto_setup() 34 if (!cipher[0] || !key_len || key_len > 256) { in crypto_setup()
|
/linux/net/mac80211/ |
H A D | fils_aead.c | 66 static int aes_siv_encrypt(const u8 *key, size_t key_len, in aes_siv_encrypt() argument 79 key_len /= 2; /* S2V key || CTR key */ in aes_siv_encrypt() 91 res = crypto_shash_setkey(tfm, key, key_len); in aes_siv_encrypt() 122 res = crypto_skcipher_setkey(tfm2, key + key_len, key_len); in aes_siv_encrypt() 144 static int aes_siv_decrypt(const u8 *key, size_t key_len, in aes_siv_decrypt() argument 159 key_len /= 2; /* S2V key || CTR key */ in aes_siv_decrypt() 179 res = crypto_skcipher_setkey(tfm2, key + key_len, key_len); in aes_siv_decrypt() 206 res = crypto_shash_setkey(tfm, key, key_len); in aes_siv_decrypt()
|
/linux/drivers/net/ethernet/netronome/nfp/ |
H A D | nfp_net_debugdump.c | 204 u32 tl_len, key_len; in nfp_calc_hwinfo_field_sz() local 208 key_len = strnlen(spec->data, tl_len); in nfp_calc_hwinfo_field_sz() 209 if (key_len == tl_len) in nfp_calc_hwinfo_field_sz() 216 return sizeof(struct nfp_dump_tl) + ALIGN8(key_len + strlen(value) + 2); in nfp_calc_hwinfo_field_sz() 239 u32 tl_len, key_len; in nfp_calc_rtsym_dump_sz() local 243 key_len = strnlen(spec_rtsym->rtsym, tl_len); in nfp_calc_rtsym_dump_sz() 244 if (key_len == tl_len) in nfp_calc_rtsym_dump_sz() 251 return ALIGN8(offsetof(struct nfp_dump_rtsym, rtsym) + key_len + 1) + in nfp_calc_rtsym_dump_sz() 420 u32 tl_len, key_len, val_len; in nfp_dump_hwinfo_field() local 426 key_len = strnlen(spec->data, tl_len); in nfp_dump_hwinfo_field() [all …]
|
/linux/drivers/net/ethernet/netronome/nfp/crypto/ |
H A D | ipsec.c | 274 int i, key_len, trunc_len, err = 0; in nfp_net_xfrm_add_state() local 368 key_len = DIV_ROUND_UP(x->aalg->alg_key_len, BITS_PER_BYTE); in nfp_net_xfrm_add_state() 369 if (key_len > sizeof(cfg->auth_key)) { in nfp_net_xfrm_add_state() 373 for (i = 0; i < key_len / sizeof(cfg->auth_key[0]) ; i++) in nfp_net_xfrm_add_state() 461 key_len = DIV_ROUND_UP(x->aead->alg_key_len, BITS_PER_BYTE); in nfp_net_xfrm_add_state() 462 key_len -= salt_len; in nfp_net_xfrm_add_state() 464 if (key_len > sizeof(cfg->ciph_key)) { in nfp_net_xfrm_add_state() 474 key_offset = key_len / sizeof(cfg->ciph_key[0]) >> 1; in nfp_net_xfrm_add_state() 476 for (i = 0; i < key_len / sizeof(cfg->ciph_key[0]); i++) { in nfp_net_xfrm_add_state() 477 int index = (i + key_offset) % (key_len / sizeof(cfg->ciph_key[0])); in nfp_net_xfrm_add_state() [all …]
|
/linux/include/keys/ |
H A D | trusted-type.h | 28 unsigned int key_len; member 68 int (*get_random)(unsigned char *key, size_t key_len); 86 pr_info("key_len %d\n", p->key_len); in dump_payload() 88 16, 1, p->key, p->key_len, 0); in dump_payload()
|