mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Stephan Müller" <smueller@chronox.de>
To: Srikanth Jampala <Jampala.Srikanth@cavium.com>
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
	linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	George.Cherian@cavium.com, Nidadavolu.Murthy@cavium.com,
	Sreerama.Gadam@cavium.com, Ram.Kumar@cavium.com
Subject: Re: [PATCH v1 3/3] crypto: cavium - Register the CNN55XX supported crypto algorithms.
Date: Wed, 10 May 2017 15:56:56 +0200	[thread overview]
Message-ID: <3575749.J6klBtBYWh@tauon.chronox.de> (raw)
In-Reply-To: <20170510130640.5838-4-Jampala.Srikanth@cavium.com>

Am Mittwoch, 10. Mai 2017, 15:06:40 CEST schrieb Srikanth Jampala:

Hi Srikanth,

In general: you are using the ablkcipher API. I think it is on its way out and 
being replaced with skcipher.

Maybe it makes sense to replace it here too. It could be as simple as s/
ablkcipher/skcipher/g

> +static inline int nitrox_ablkcipher_setkey(struct crypto_ablkcipher
> *cipher,
> +                                          int aes_keylen, const u8 *key,
> +                                          unsigned int keylen)
> +{
> +       struct crypto_tfm *tfm = crypto_ablkcipher_tfm(cipher);
> +       struct nitrox_crypto_instance *inst = crypto_tfm_ctx(tfm);
> +       struct flexi_crypto_context *fctx;
> +       enum flexi_cipher cipher_type;
> +       const char *name;
> +
> +       name = crypto_tfm_alg_name(tfm);
> +       cipher_type = flexi_cipher_type(name);
> +       if (cipher_type == CIPHER_INVALID) {
> +               pr_err("unsupported cipher: %s\n", name);
> +               return -EINVAL;
> +       }
> +
> +       /* fill crypto context */
> +       fctx = inst->u.fctx;
> +       fctx->flags = 0;
> +       fctx->w0.cipher_type = cipher_type;
> +       fctx->w0.aes_keylen = aes_keylen;
> +       fctx->w0.iv_source = IV_FROM_DPTR;
> +       fctx->flags = cpu_to_be64(*(u64 *)&fctx->w0);
> +       /* copy the key to context */
> +       memcpy(fctx->crypto.u.key, key, keylen);

Could you help me finding the location where this memory is zeroized upon 
release?
> +
> +       return 0;
> +}\0

> +
> +static int nitrox_3des_setkey(struct crypto_ablkcipher *cipher, const u8
> *key, +			      unsigned int keylen)
> +{
> +	if (keylen != DES3_EDE_KEY_SIZE) {
> +		crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN);
> +		return -EINVAL;
> +	}

Please import the check from __des3_ede_setkey (or better, extract that key 
check into a generic function like xts_check_key).

Ciao
Stephan

  reply	other threads:[~2017-05-10 13:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10 13:06 [PATCH v1 0/3] Add support for Cavium CNN55XX crypto adapters Srikanth Jampala
2017-05-10 13:06 ` [PATCH v1 1/3] crypto: cavium - Add support for CNN55XX adapters Srikanth Jampala
2017-05-10 14:38   ` kbuild test robot
2017-05-10 13:06 ` [PATCH v1 2/3] crypto: cavium - Add debugfs support in CNN55XX driver Srikanth Jampala
2017-05-10 13:06 ` [PATCH v1 3/3] crypto: cavium - Register the CNN55XX supported crypto algorithms Srikanth Jampala
2017-05-10 13:56   ` Stephan Müller [this message]
2017-05-11 12:18     ` srikanth jampala
2017-05-11 12:22       ` Stephan Müller
2017-05-11 12:40         ` srikanth jampala
2017-05-30 11:58     ` [PATCH v2 0/3] Add support for Cavium CNN55XX crypto adapters Srikanth Jampala
2017-05-30 11:58       ` [PATCH v2 1/3] crypto: cavium - Add support for CNN55XX adapters Srikanth Jampala
2017-05-30 11:58       ` [PATCH v2 2/3] crypto: cavium - Add debugfs support in CNN55XX driver Srikanth Jampala
2017-05-30 11:58       ` [PATCH v2 3/3] crypto: cavium - Register the CNN55XX supported crypto algorithms Srikanth Jampala
2017-06-10  4:18       ` [PATCH v2 0/3] Add support for Cavium CNN55XX crypto adapters Herbert Xu
2017-05-10 14:43   ` [PATCH v1 3/3] crypto: cavium - Register the CNN55XX supported crypto algorithms kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3575749.J6klBtBYWh@tauon.chronox.de \
    --to=smueller@chronox.de \
    --cc=George.Cherian@cavium.com \
    --cc=Jampala.Srikanth@cavium.com \
    --cc=Nidadavolu.Murthy@cavium.com \
    --cc=Ram.Kumar@cavium.com \
    --cc=Sreerama.Gadam@cavium.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®