Lines Matching defs:key

29 /* max key is sum of AES_MAX_KEY_SIZE, max split key size */
68 * @key: [authentication key], encryption key
70 * @key_dma: I/O virtual address of the key
71 * @dir: DMA direction for mapping key and Flow Contexts
77 * to unsupported xts key lengths
82 u8 key[CAAM_MAX_KEY_SIZE];
207 nonce = (u32 *)((void *)ctx->key + ctx->adata.keylen_pad +
212 * In case |user key| > |derived key|, using DKP<imm,imm> would result
213 * in invalid opcodes (last bytes of user key) in the resulting
214 * descriptor. Use DKP<ptr,imm> instead => both virtual and dma key
217 ctx->adata.key_virt = ctx->key;
220 ctx->cdata.key_virt = ctx->key + ctx->adata.keylen_pad;
289 static int aead_setkey(struct crypto_aead *aead, const u8 *key,
296 if (crypto_authenc_extractkeys(&keys, key, keylen) != 0)
302 print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
303 DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
312 memcpy(ctx->key, keys.authkey, keys.authkeylen);
313 memcpy(ctx->key + ctx->adata.keylen_pad, keys.enckey, keys.enckeylen);
316 print_hex_dump_debug("ctx.key@" __stringify(__LINE__)": ",
317 DUMP_PREFIX_ADDRESS, 16, 4, ctx->key,
329 static int des3_aead_setkey(struct crypto_aead *aead, const u8 *key,
335 err = crypto_authenc_extractkeys(&keys, key, keylen);
344 aead_setkey(aead, key, keylen);
634 static int chachapoly_setkey(struct crypto_aead *aead, const u8 *key,
644 memcpy(ctx->key, key, keylen);
645 ctx->cdata.key_virt = ctx->key;
671 ctx->cdata.key_virt = ctx->key;
691 ctx->cdata.key_virt = ctx->key;
724 const u8 *key, unsigned int keylen)
733 print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
734 DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
736 memcpy(ctx->key, key, keylen);
756 ctx->cdata.key_virt = ctx->key;
819 const u8 *key, unsigned int keylen)
829 print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
830 DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
832 memcpy(ctx->key, key, keylen);
834 * The last four bytes of the key material are used as the salt value
835 * in the nonce. Update the AES key length.
857 ctx->cdata.key_virt = ctx->key;
918 const u8 *key, unsigned int keylen)
928 print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
929 DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
931 memcpy(ctx->key, key, keylen);
933 * The last four bytes of the key material are used as the salt value
934 * in the nonce. Update the AES key length.
943 static int skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key,
956 print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
957 DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
960 ctx->cdata.key_virt = key;
987 const u8 *key, unsigned int keylen)
995 return skcipher_setkey(skcipher, key, keylen, 0);
999 const u8 *key, unsigned int keylen)
1007 * | *key = {KEY, NONCE}
1016 return skcipher_setkey(skcipher, key, keylen, ctx1_iv_off);
1020 const u8 *key, unsigned int keylen)
1036 return skcipher_setkey(skcipher, key, keylen, ctx1_iv_off);
1040 const u8 *key, unsigned int keylen)
1045 return skcipher_setkey(skcipher, key, keylen, 0);
1049 const u8 *key, unsigned int keylen)
1051 return verify_skcipher_des_key(skcipher, key) ?:
1052 skcipher_setkey(skcipher, key, keylen, 0);
1056 const u8 *key, unsigned int keylen)
1058 return verify_skcipher_des3_key(skcipher, key) ?:
1059 skcipher_setkey(skcipher, key, keylen, 0);
1062 static int xts_skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key,
1072 err = xts_verify_key(skcipher, key, keylen);
1074 dev_dbg(dev, "key size mismatch\n");
1082 err = crypto_skcipher_setkey(ctx->fallback, key, keylen);
1088 ctx->cdata.key_virt = key;
1593 dev_err(ctx->dev, "unable to map key, shared descriptors\n");
3038 /* max hash key is max split key size */
3058 * @key: authentication key
3066 u8 key[CAAM_MAX_HASH_BLOCK_SIZE] ____cacheline_aligned;
3214 static int hash_digest_key(struct caam_hash_ctx *ctx, u32 *keylen, u8 *key,
3237 key_dma = dma_map_single(ctx->dev, key, *keylen, DMA_BIDIRECTIONAL);
3239 dev_err(ctx->dev, "unable to map key memory\n");
3272 DUMP_PREFIX_ADDRESS, 16, 4, key, *keylen, 1);
3291 print_hex_dump_debug("digested key@" __stringify(__LINE__)": ",
3292 DUMP_PREFIX_ADDRESS, 16, 4, key,
3310 static int ahash_setkey(struct crypto_ahash *ahash, const u8 *key,
3328 hashed_key = kmemdup(key, aligned_len, GFP_KERNEL);
3334 key = hashed_key;
3343 ctx->adata.key_virt = key;
3347 * In case |user key| > |derived key|, using DKP<imm,imm> would result
3348 * in invalid opcodes (last bytes of user key) in the resulting
3349 * descriptor. Use DKP<ptr,imm> instead => both virtual and dma key
3353 memcpy(ctx->key, key, keylen);
4575 ctx->adata.key_dma = dma_map_single_attrs(ctx->dev, ctx->key,
4576 ARRAY_SIZE(ctx->key),
4580 dev_err(ctx->dev, "unable to map key\n");
4592 ARRAY_SIZE(ctx->key),
4625 ARRAY_SIZE(ctx->key), DMA_TO_DEVICE,