/openbmc/linux/drivers/staging/wlan-ng/ |
H A D | p80211wep.c | 46 int wep_change_key(struct wlandevice *wlandev, int keynum, u8 *key, int keylen) in wep_change_key() argument 48 if (keylen < 0) in wep_change_key() 50 if (keylen >= MAX_KEYLEN) in wep_change_key() 59 wlandev->wep_keylens[keynum] = keylen; in wep_change_key() 60 memcpy(wlandev->wep_keys[keynum], key, keylen); in wep_change_key() 72 u32 i, j, k, crc, keylen; in wep_decrypt() local 92 keylen = wlandev->wep_keylens[keyidx]; in wep_decrypt() 94 if (keylen == 0) in wep_decrypt() 98 memcpy(key + 3, wlandev->wep_keys[keyidx], keylen); in wep_decrypt() 100 keylen += 3; /* add in IV bytes */ in wep_decrypt() [all …]
|
/openbmc/linux/include/crypto/ |
H A D | blake2s.h | 47 const void *key, size_t keylen) in __blake2s_init() argument 49 state->h[0] = BLAKE2S_IV0 ^ (0x01010000 | keylen << 8 | outlen); in __blake2s_init() 63 if (keylen) { in __blake2s_init() 64 memcpy(state->buf, key, keylen); in __blake2s_init() 65 memset(&state->buf[keylen], 0, BLAKE2S_BLOCK_SIZE - keylen); in __blake2s_init() 78 const size_t keylen) in blake2s_init_key() argument 81 !key || !keylen || keylen > BLAKE2S_KEY_SIZE)); in blake2s_init_key() 83 __blake2s_init(state, outlen, key, keylen); in blake2s_init_key() 91 const size_t keylen) in blake2s() argument 96 outlen > BLAKE2S_HASH_SIZE || keylen > BLAKE2S_KEY_SIZE || in blake2s() [all …]
|
H A D | xts.h | 12 const u8 *key, unsigned int keylen) in xts_verify_key() argument 18 if (keylen % 2) in xts_verify_key() 25 if (fips_enabled && keylen != 32 && keylen != 64) in xts_verify_key() 34 !crypto_memneq(key, key + (keylen / 2), keylen / 2)) in xts_verify_key()
|
H A D | blake2b.h | 43 const void *key, size_t keylen) in __blake2b_init() argument 45 state->h[0] = BLAKE2B_IV0 ^ (0x01010000 | keylen << 8 | outlen); in __blake2b_init() 59 if (keylen) { in __blake2b_init() 60 memcpy(state->buf, key, keylen); in __blake2b_init() 61 memset(&state->buf[keylen], 0, BLAKE2B_BLOCK_SIZE - keylen); in __blake2b_init()
|
/openbmc/linux/drivers/crypto/amcc/ |
H A D | crypto4xx_alg.c | 123 unsigned int keylen, in crypto4xx_setkey_aes() argument 131 if (keylen != AES_KEYSIZE_256 && keylen != AES_KEYSIZE_192 && in crypto4xx_setkey_aes() 132 keylen != AES_KEYSIZE_128) in crypto4xx_setkey_aes() 139 rc = crypto4xx_alloc_sa(ctx, SA_AES128_LEN + (keylen-16) / 4); in crypto4xx_setkey_aes() 161 key, keylen); in crypto4xx_setkey_aes() 162 sa->sa_contents.w = SA_AES_CONTENTS | (keylen << 2); in crypto4xx_setkey_aes() 163 sa->sa_command_1.bf.key_len = keylen >> 3; in crypto4xx_setkey_aes() 178 const u8 *key, unsigned int keylen) in crypto4xx_setkey_aes_cbc() argument 180 return crypto4xx_setkey_aes(cipher, key, keylen, CRYPTO_MODE_CBC, in crypto4xx_setkey_aes_cbc() 185 const u8 *key, unsigned int keylen) in crypto4xx_setkey_aes_cfb() argument [all …]
|
/openbmc/linux/fs/cachefiles/ |
H A D | key.c | 41 unsigned int acc, i, n, nle, nbe, keylen = object->cookie->key_len; in cachefiles_cook_key() local 45 _enter(",%u,%*phN", keylen, keylen, key); in cachefiles_cook_key() 47 BUG_ON(keylen > NAME_MAX - 3); in cachefiles_cook_key() 50 for (i = 0; i < keylen; i++) { in cachefiles_cook_key() 57 len = 1 + keylen; in cachefiles_cook_key() 63 memcpy(name + 1, key, keylen); in cachefiles_cook_key() 71 n = round_up(keylen, 4); in cachefiles_cook_key() 81 b64len = DIV_ROUND_UP(keylen, 3); in cachefiles_cook_key() 82 pad = b64len * 3 - keylen; in cachefiles_cook_key() 84 _debug("len=%u nbe=%u nle=%u b64=%u", keylen, nbe, nle, b64len); in cachefiles_cook_key() [all …]
|
/openbmc/linux/fs/hfs/ |
H A D | bfind.c | 58 u16 off, len, keylen; in __hfs_brec_find() local 69 keylen = hfs_brec_keylen(bnode, rec); in __hfs_brec_find() 70 if (keylen == 0) { in __hfs_brec_find() 74 hfs_bnode_read(bnode, fd->key, off, keylen); in __hfs_brec_find() 88 keylen = hfs_brec_keylen(bnode, e); in __hfs_brec_find() 89 if (keylen == 0) { in __hfs_brec_find() 93 hfs_bnode_read(bnode, fd->key, off, keylen); in __hfs_brec_find() 98 fd->keylength = keylen; in __hfs_brec_find() 99 fd->entryoffset = off + keylen; in __hfs_brec_find() 100 fd->entrylength = len - keylen; in __hfs_brec_find() [all …]
|
/openbmc/linux/fs/hfsplus/ |
H A D | bfind.c | 106 u16 off, len, keylen; in __hfs_brec_find() local 118 keylen = hfs_brec_keylen(bnode, rec); in __hfs_brec_find() 119 if (keylen == 0) { in __hfs_brec_find() 123 hfs_bnode_read(bnode, fd->key, off, keylen); in __hfs_brec_find() 132 keylen = hfs_brec_keylen(bnode, e); in __hfs_brec_find() 133 if (keylen == 0) { in __hfs_brec_find() 137 hfs_bnode_read(bnode, fd->key, off, keylen); in __hfs_brec_find() 143 fd->keylength = keylen; in __hfs_brec_find() 144 fd->entryoffset = off + keylen; in __hfs_brec_find() 145 fd->entrylength = len - keylen; in __hfs_brec_find() [all …]
|
/openbmc/linux/drivers/crypto/cavium/cpt/ |
H A D | cptvf_algs.c | 233 u32 keylen) in cvm_xts_setkey() argument 238 const u8 *key2 = key + (keylen / 2); in cvm_xts_setkey() 240 err = xts_verify_key(cipher, key, keylen); in cvm_xts_setkey() 243 ctx->key_len = keylen; in cvm_xts_setkey() 244 memcpy(ctx->enc_key, key1, keylen / 2); in cvm_xts_setkey() 245 memcpy(ctx->enc_key + KEY2_OFFSET, key2, keylen / 2); in cvm_xts_setkey() 261 static int cvm_validate_keylen(struct cvm_enc_ctx *ctx, u32 keylen) in cvm_validate_keylen() argument 263 if ((keylen == 16) || (keylen == 24) || (keylen == 32)) { in cvm_validate_keylen() 264 ctx->key_len = keylen; in cvm_validate_keylen() 289 u32 keylen, u8 cipher_type) in cvm_setkey() argument [all …]
|
/openbmc/linux/crypto/asymmetric_keys/ |
H A D | public_key.c | 174 key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen, in software_key_query() 179 memcpy(key, pkey->key, pkey->keylen); in software_key_query() 180 ptr = key + pkey->keylen; in software_key_query() 193 ret = crypto_sig_set_privkey(sig, key, pkey->keylen); in software_key_query() 195 ret = crypto_sig_set_pubkey(sig, key, pkey->keylen); in software_key_query() 218 ret = crypto_akcipher_set_priv_key(tfm, key, pkey->keylen); in software_key_query() 220 ret = crypto_akcipher_set_pub_key(tfm, key, pkey->keylen); in software_key_query() 293 key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen, in software_key_eds_op() 298 memcpy(key, pkey->key, pkey->keylen); in software_key_eds_op() 299 ptr = key + pkey->keylen; in software_key_eds_op() [all …]
|
/openbmc/linux/crypto/ |
H A D | cipher.c | 21 unsigned int keylen) in setkey_unaligned() argument 29 absize = keylen + alignmask; in setkey_unaligned() 35 memcpy(alignbuffer, key, keylen); in setkey_unaligned() 36 ret = cia->cia_setkey(crypto_cipher_tfm(tfm), alignbuffer, keylen); in setkey_unaligned() 43 const u8 *key, unsigned int keylen) in crypto_cipher_setkey() argument 48 if (keylen < cia->cia_min_keysize || keylen > cia->cia_max_keysize) in crypto_cipher_setkey() 52 return setkey_unaligned(tfm, key, keylen); in crypto_cipher_setkey() 54 return cia->cia_setkey(crypto_cipher_tfm(tfm), key, keylen); in crypto_cipher_setkey()
|
/openbmc/linux/drivers/crypto/caam/ |
H A D | key_gen.c | 45 struct alginfo * const adata, const u8 *key_in, u32 keylen, in gen_split_key() argument 54 adata->keylen = split_key_len(adata->algtype & OP_ALG_ALGSEL_MASK); in gen_split_key() 57 local_max = max(keylen, adata->keylen_pad); in gen_split_key() 60 adata->keylen, adata->keylen_pad); in gen_split_key() 62 DUMP_PREFIX_ADDRESS, 16, 4, key_in, keylen, 1); in gen_split_key() 73 memcpy(key_out, key_in, keylen); in gen_split_key() 82 append_key(desc, dma_addr, keylen, CLASS_2 | KEY_DEST_CLASS_REG); in gen_split_key() 100 append_fifo_store(desc, dma_addr, adata->keylen, in gen_split_key()
|
H A D | caamhash_desc.c | 36 if (state != OP_ALG_AS_UPDATE && adata->keylen) { in cnstr_shdsc_ahash() 46 adata->keylen, CLASS_2 | in cnstr_shdsc_ahash() 98 append_key_as_imm(desc, adata->key_virt, adata->keylen, in cnstr_shdsc_sk_hash() 99 adata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); in cnstr_shdsc_sk_hash() 103 append_key(desc, adata->key_dma, adata->keylen, in cnstr_shdsc_sk_hash() 106 append_key_as_imm(desc, adata->key_virt, adata->keylen, in cnstr_shdsc_sk_hash() 107 adata->keylen, CLASS_1 | in cnstr_shdsc_sk_hash() 138 append_fifo_store(desc, adata->key_dma, adata->keylen, in cnstr_shdsc_sk_hash()
|
H A D | caamalg_desc.c | 69 adata->keylen_pad, adata->keylen, in cnstr_shdsc_aead_null_encap() 73 append_key(desc, adata->key_dma, adata->keylen, in cnstr_shdsc_aead_null_encap() 148 adata->keylen_pad, adata->keylen, in cnstr_shdsc_aead_null_decap() 152 append_key(desc, adata->key_dma, adata->keylen, in cnstr_shdsc_aead_null_decap() 216 unsigned int enckeylen = cdata->keylen; in init_sh_desc_key_aead() 236 adata->keylen_pad, adata->keylen, in init_sh_desc_key_aead() 240 append_key(desc, adata->key_dma, adata->keylen, in init_sh_desc_key_aead() 647 append_key_as_imm(desc, cdata->key_virt, cdata->keylen, in cnstr_shdsc_gcm_encap() 648 cdata->keylen, CLASS_1 | KEY_DEST_CLASS_REG); in cnstr_shdsc_gcm_encap() 650 append_key(desc, cdata->key_dma, cdata->keylen, CLASS_1 | in cnstr_shdsc_gcm_encap() [all …]
|
/openbmc/linux/net/mac80211/ |
H A D | wep.c | 31 static inline bool ieee80211_wep_weak_iv(u32 iv, int keylen) in ieee80211_wep_weak_iv() argument 40 if (B >= 3 && B < 3 + keylen) in ieee80211_wep_weak_iv() 48 int keylen, int keyidx, u8 *iv) in ieee80211_wep_get_iv() argument 51 if (ieee80211_wep_weak_iv(local->wep_iv, keylen)) in ieee80211_wep_get_iv() 66 int keylen, int keyidx) in ieee80211_wep_add_iv() argument 87 ieee80211_wep_get_iv(local, keylen, keyidx, newhdr + hdrlen); in ieee80211_wep_add_iv() 133 const u8 *key, int keylen, int keyidx) in ieee80211_wep_encrypt() argument 142 iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); in ieee80211_wep_encrypt() 152 memcpy(rc4key + 3, key, keylen); in ieee80211_wep_encrypt() 157 return ieee80211_wep_encrypt_data(&local->wep_tx_ctx, rc4key, keylen + 3, in ieee80211_wep_encrypt() [all …]
|
/openbmc/linux/drivers/net/wireless/silabs/wfx/ |
H A D | key.c | 36 WARN(key->keylen > sizeof(msg->key_data), "inconsistent data"); in fill_wep_pair() 37 msg->key_length = key->keylen; in fill_wep_pair() 38 memcpy(msg->key_data, key->key, key->keylen); in fill_wep_pair() 46 WARN(key->keylen > sizeof(msg->key_data), "inconsistent data"); in fill_wep_group() 48 msg->key_length = key->keylen; in fill_wep_group() 49 memcpy(msg->key_data, key->key, key->keylen); in fill_wep_group() 58 WARN(key->keylen != sizeof(msg->tkip_key_data) + sizeof(msg->tx_mic_key) + in fill_tkip_pair() 74 WARN(key->keylen != sizeof(msg->tkip_key_data) + 2 * sizeof(msg->rx_mic_key), in fill_tkip_group() 93 WARN(key->keylen != sizeof(msg->aes_key_data), "inconsistent data"); in fill_ccmp_pair() 95 memcpy(msg->aes_key_data, key->key, key->keylen); in fill_ccmp_pair() [all …]
|
/openbmc/linux/drivers/s390/crypto/ |
H A D | pkey_api.c | 293 static int pkey_ep11key2pkey(const u8 *key, size_t keylen, in pkey_ep11key2pkey() argument 306 ep11_kb_wkvp(key, keylen)); in pkey_ep11key2pkey() 314 rc = ep11_kblob2protkey(card, dom, key, keylen, in pkey_ep11key2pkey() 519 u32 keylen; in nonccatokecc2pkey() local 524 keylen = 32; in nonccatokecc2pkey() 527 keylen = 48; in nonccatokecc2pkey() 530 keylen = 80; in nonccatokecc2pkey() 533 keylen = 32; in nonccatokecc2pkey() 536 keylen = 64; in nonccatokecc2pkey() 544 if (t->len != keylen) { in nonccatokecc2pkey() [all …]
|
/openbmc/linux/include/crypto/internal/ |
H A D | blake2b.h | 69 unsigned int keylen; member 73 const u8 *key, unsigned int keylen) in crypto_blake2b_setkey() argument 77 if (keylen == 0 || keylen > BLAKE2B_KEY_SIZE) in crypto_blake2b_setkey() 80 memcpy(tctx->key, key, keylen); in crypto_blake2b_setkey() 81 tctx->keylen = keylen; in crypto_blake2b_setkey() 92 __blake2b_init(state, outlen, tctx->key, tctx->keylen); in crypto_blake2b_init()
|
/openbmc/linux/drivers/crypto/cavium/nitrox/ |
H A D | nitrox_skcipher.c | 167 unsigned int keylen) in nitrox_skcipher_setkey() argument 192 memcpy(fctx->crypto.u.key, key, keylen); in nitrox_skcipher_setkey() 198 unsigned int keylen) in nitrox_aes_setkey() argument 202 aes_keylen = flexi_aes_keylen(keylen); in nitrox_aes_setkey() 205 return nitrox_skcipher_setkey(cipher, aes_keylen, key, keylen); in nitrox_aes_setkey() 321 const u8 *key, unsigned int keylen) in nitrox_3des_setkey() argument 324 nitrox_skcipher_setkey(cipher, 0, key, keylen); in nitrox_3des_setkey() 338 const u8 *key, unsigned int keylen) in nitrox_aes_xts_setkey() argument 344 ret = xts_verify_key(cipher, key, keylen); in nitrox_aes_xts_setkey() 348 keylen /= 2; in nitrox_aes_xts_setkey() [all …]
|
/openbmc/qemu/tests/unit/ |
H A D | test-crypto-akcipher.c | 667 size_t keylen; member 697 .keylen = sizeof(rsa1024_public_key), 705 .keylen = sizeof(rsa1024_private_key), 713 .keylen = sizeof(rsa2048_public_key), 721 .keylen = sizeof(rsa2048_private_key), 729 .keylen = sizeof(rsa_public_key_lack_element), 736 .keylen = sizeof(rsa_private_key_lack_element), 743 .keylen = sizeof(rsa_public_key_empty_element), 750 .keylen = sizeof(rsa_private_key_empty_element), 757 .keylen = 0, [all …]
|
H A D | test-crypto-xts.c | 33 int keylen; member 348 AES_set_encrypt_key(data->key1, data->keylen / 2 * 8, &aesdata.enc); in test_xts() 349 AES_set_decrypt_key(data->key1, data->keylen / 2 * 8, &aesdata.dec); in test_xts() 350 AES_set_encrypt_key(data->key2, data->keylen / 2 * 8, &aestweak.enc); in test_xts() 351 AES_set_decrypt_key(data->key2, data->keylen / 2 * 8, &aestweak.dec); in test_xts() 384 AES_set_encrypt_key(data->key1, data->keylen / 2 * 8, &aesdata.enc); in test_xts_split() 385 AES_set_decrypt_key(data->key1, data->keylen / 2 * 8, &aesdata.dec); in test_xts_split() 386 AES_set_encrypt_key(data->key2, data->keylen / 2 * 8, &aestweak.enc); in test_xts_split() 387 AES_set_decrypt_key(data->key2, data->keylen / 2 * 8, &aestweak.dec); in test_xts_split() 429 AES_set_encrypt_key(data->key1, data->keylen / 2 * 8, &aesdata.enc); in test_xts_unaligned() [all …]
|
/openbmc/linux/drivers/crypto/intel/qat/qat_common/ |
H A D | qat_algs.c | 412 const u8 *key, unsigned int keylen) in qat_alg_skcipher_init_com() argument 432 memcpy(cd->ucs_aes.key, key, keylen); in qat_alg_skcipher_init_com() 433 keylen = keylen / 2; in qat_alg_skcipher_init_com() 437 memcpy(cd->ucs_aes.key, key, keylen); in qat_alg_skcipher_init_com() 438 keylen = round_up(keylen, 16); in qat_alg_skcipher_init_com() 440 memcpy(cd->aes.key, key, keylen); in qat_alg_skcipher_init_com() 444 cd_ctrl->cipher_key_sz = keylen >> 3; in qat_alg_skcipher_init_com() 453 unsigned int keylen, int mode) in qat_alg_skcipher_init_enc() argument 459 qat_alg_skcipher_init_com(ctx, req, enc_cd, key, keylen); in qat_alg_skcipher_init_enc() 464 static void qat_alg_xts_reverse_key(const u8 *key_forward, unsigned int keylen, in qat_alg_xts_reverse_key() argument [all …]
|
/openbmc/linux/drivers/crypto/rockchip/ |
H A D | rk3288_crypto_skcipher.c | 109 const u8 *key, unsigned int keylen) in rk_aes_setkey() argument 114 if (keylen != AES_KEYSIZE_128 && keylen != AES_KEYSIZE_192 && in rk_aes_setkey() 115 keylen != AES_KEYSIZE_256) in rk_aes_setkey() 117 ctx->keylen = keylen; in rk_aes_setkey() 118 memcpy(ctx->key, key, keylen); in rk_aes_setkey() 120 return crypto_skcipher_setkey(ctx->fallback_tfm, key, keylen); in rk_aes_setkey() 124 const u8 *key, unsigned int keylen) in rk_des_setkey() argument 133 ctx->keylen = keylen; in rk_des_setkey() 134 memcpy(ctx->key, key, keylen); in rk_des_setkey() 136 return crypto_skcipher_setkey(ctx->fallback_tfm, key, keylen); in rk_des_setkey() [all …]
|
/openbmc/linux/arch/powerpc/platforms/powernv/ |
H A D | opal-secvar.c | 73 static int opal_get_next_variable(const char *key, u64 *keylen, u64 keybufsize) in opal_get_next_variable() argument 77 if (!key || !keylen) in opal_get_next_variable() 80 *keylen = cpu_to_be64(*keylen); in opal_get_next_variable() 82 rc = opal_secvar_get_next(key, keylen, keybufsize); in opal_get_next_variable() 84 *keylen = be64_to_cpu(*keylen); in opal_get_next_variable()
|
/openbmc/linux/fs/befs/ |
H A D | btree.c | 117 int index, u16 * keylen); 335 u16 keylen; in befs_find_key() local 346 thiskey = befs_bt_get_key(sb, node, last, &keylen); in befs_find_key() 348 eq = befs_compare_strings(thiskey, keylen, findkey, findkey_len); in befs_find_key() 363 thiskey = befs_bt_get_key(sb, node, mid, &keylen); in befs_find_key() 364 eq = befs_compare_strings(thiskey, keylen, findkey, in befs_find_key() 421 u16 keylen; in befs_btree_read() local 490 keystart = befs_bt_get_key(sb, this_node, cur_key, &keylen); in befs_btree_read() 494 (int)keylen); in befs_btree_read() 496 if (bufsize < keylen + 1) { in befs_btree_read() [all …]
|