Lines Matching defs:key
35 /* Byte offset for key in encryption security context */
100 * @akey: Authentication key
101 * @akey_len: Authentication key length
126 * @inv_key: Whether the encryption algorithm demands key inversion
128 * @keyed_mac: Whether the authentication algorithm has key
145 void (*prep_iopad)(struct algo_data *algo, const u8 *key,
383 /* Prepare the ipad and opad from key as per SHA algorithm step 1*/
384 static void prepare_kipad(u8 *k_ipad, const u8 *key, u16 key_sz)
389 k_ipad[i] = key[i] ^ 0x36;
396 static void prepare_kopad(u8 *k_opad, const u8 *key, u16 key_sz)
401 k_opad[i] = key[i] ^ 0x5c;
435 static void sa_prepare_iopads(struct algo_data *data, const u8 *key,
449 prepare_kipad(sha.k_pad, key, key_sz);
455 prepare_kopad(sha.k_pad, key, key_sz);
465 /* Derive the inverse key used in AES-CBC decryption operation */
466 static inline int sa_aes_inv_key(u8 *inv_key, const u8 *key, u16 key_sz)
471 if (aes_expandkey(&ctx, key, key_sz)) {
472 dev_err(sa_k3_dev, "%s: bad key len(%d)\n", __func__, key_sz);
494 dev_err(sa_k3_dev, "%s: bad key len(%d)\n", __func__, key_sz);
503 static int sa_set_sc_enc(struct algo_data *ad, const u8 *key, u16 key_sz,
519 /* For AES-CBC decryption get the inverse key */
521 if (sa_aes_inv_key(&sc_buf[SC_ENC_KEY_OFFSET], key, key_sz))
523 /* For all other cases: key is used */
525 memcpy(&sc_buf[SC_ENC_KEY_OFFSET], key, key_sz);
532 static void sa_set_sc_auth(struct algo_data *ad, const u8 *key, u16 key_sz,
546 ad->prep_iopad(ad, key, key_sz, ipad, opad);
885 static int sa_cipher_setkey(struct crypto_skcipher *tfm, const u8 *key,
908 ret = crypto_skcipher_setkey(child, key, keylen);
913 if (sa_init_sc(&ctx->enc, ctx->dev_data->match_data, key, keylen, NULL, 0,
926 if (sa_init_sc(&ctx->dec, ctx->dev_data->match_data, key, keylen, NULL, 0,
947 static int sa_aes_cbc_setkey(struct crypto_skcipher *tfm, const u8 *key,
951 /* Convert the key size (16/24/32) to the key size index (0/1/2) */
964 return sa_cipher_setkey(tfm, key, keylen, &ad);
967 static int sa_aes_ecb_setkey(struct crypto_skcipher *tfm, const u8 *key,
971 /* Convert the key size (16/24/32) to the key size index (0/1/2) */
982 return sa_cipher_setkey(tfm, key, keylen, &ad);
985 static int sa_3des_cbc_setkey(struct crypto_skcipher *tfm, const u8 *key,
996 return sa_cipher_setkey(tfm, key, keylen, &ad);
999 static int sa_3des_ecb_setkey(struct crypto_skcipher *tfm, const u8 *key,
1007 return sa_cipher_setkey(tfm, key, keylen, &ad);
1801 const u8 *key, unsigned int keylen,
1810 if (crypto_authenc_extractkeys(&keys, key, keylen) != 0)
1813 /* Convert the key size (16/24/32) to the key size index (0/1/2) */
1873 return crypto_aead_setkey(ctx->fallback.aead, key, keylen);
1884 const u8 *key, unsigned int keylen)
1893 return sa_aead_setkey(authenc, key, keylen, &ad);
1897 const u8 *key, unsigned int keylen)
1906 return sa_aead_setkey(authenc, key, keylen, &ad);