caamalg.c (c10a53367901b36eec6208f1dbaf53da9fd358bb) caamalg.c (1ca1b917940c24ca3d1f490118c5474168622953)
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * caam - Freescale FSL CAAM support for crypto API
4 *
5 * Copyright 2008-2011 Freescale Semiconductor, Inc.
6 * Copyright 2016-2018 NXP
7 *
8 * Based on talitos crypto API driver.

--- 545 unchanged lines hidden (view full) ---

554
555static int chachapoly_setkey(struct crypto_aead *aead, const u8 *key,
556 unsigned int keylen)
557{
558 struct caam_ctx *ctx = crypto_aead_ctx(aead);
559 unsigned int ivsize = crypto_aead_ivsize(aead);
560 unsigned int saltlen = CHACHAPOLY_IV_SIZE - ivsize;
561
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * caam - Freescale FSL CAAM support for crypto API
4 *
5 * Copyright 2008-2011 Freescale Semiconductor, Inc.
6 * Copyright 2016-2018 NXP
7 *
8 * Based on talitos crypto API driver.

--- 545 unchanged lines hidden (view full) ---

554
555static int chachapoly_setkey(struct crypto_aead *aead, const u8 *key,
556 unsigned int keylen)
557{
558 struct caam_ctx *ctx = crypto_aead_ctx(aead);
559 unsigned int ivsize = crypto_aead_ivsize(aead);
560 unsigned int saltlen = CHACHAPOLY_IV_SIZE - ivsize;
561
562 if (keylen != CHACHA20_KEY_SIZE + saltlen) {
562 if (keylen != CHACHA_KEY_SIZE + saltlen) {
563 crypto_aead_set_flags(aead, CRYPTO_TFM_RES_BAD_KEY_LEN);
564 return -EINVAL;
565 }
566
567 ctx->cdata.key_virt = key;
568 ctx->cdata.keylen = keylen - saltlen;
569
570 return chachapoly_set_sh_desc(aead);

--- 2937 unchanged lines hidden ---
563 crypto_aead_set_flags(aead, CRYPTO_TFM_RES_BAD_KEY_LEN);
564 return -EINVAL;
565 }
566
567 ctx->cdata.key_virt = key;
568 ctx->cdata.keylen = keylen - saltlen;
569
570 return chachapoly_set_sh_desc(aead);

--- 2937 unchanged lines hidden ---