Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Vladis Dronov <vdronov@redhat.com>
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
	nstange@suse.de, elliott@hpe.com, linux-crypto@vger.kernel.org,
	linux-kernel@vger.kernel.org, smueller@chronox.de
Subject: Re: [PATCH 2/6] crypto: xts - drop xts_check_key()
Date: Wed, 21 Dec 2022 15:33:13 -0800	[thread overview]
Message-ID: <Y6OXuT95MlkNanSR@sol.localdomain> (raw)
In-Reply-To: <20221221224111.19254-3-vdronov@redhat.com>

On Wed, Dec 21, 2022 at 11:41:07PM +0100, Vladis Dronov wrote:
> xts_check_key() is obsoleted by xts_verify_key(). Over time XTS crypto
> drivers adopted the newer xts_verify_key() variant, but xts_check_key()
> is still used by a number of drivers. Switch drivers to use the newer
> xts_verify_key() and make a couple of cleanups. This allows us to drop
> xts_check_key() completely and avoid redundancy.
> 
> Signed-off-by: Vladis Dronov <vdronov@redhat.com>
> ---
>  arch/s390/crypto/paes_s390.c                  |  2 +-
>  drivers/crypto/atmel-aes.c                    |  2 +-
>  drivers/crypto/axis/artpec6_crypto.c          |  2 +-
>  drivers/crypto/cavium/cpt/cptvf_algs.c        |  8 +++----
>  .../crypto/cavium/nitrox/nitrox_skcipher.c    |  8 +++----
>  drivers/crypto/ccree/cc_cipher.c              |  2 +-
>  .../crypto/marvell/octeontx/otx_cptvf_algs.c  |  2 +-
>  .../marvell/octeontx2/otx2_cptvf_algs.c       |  2 +-
>  include/crypto/xts.h                          | 21 +++----------------
>  9 files changed, 15 insertions(+), 34 deletions(-)

Reviewed-by: Eric Biggers <ebiggers@google.com>

but one comment below:

>  static inline int xts_verify_key(struct crypto_skcipher *tfm,
>  				 const u8 *key, unsigned int keylen)
>  {
> @@ -42,7 +25,9 @@ static inline int xts_verify_key(struct crypto_skcipher *tfm,
>  	if (fips_enabled && keylen != 32 && keylen != 64)
>  		return -EINVAL;
>  
> -	/* ensure that the AES and tweak key are not identical */
> +	/* ensure that the AES and tweak key are not identical
> +	 * when in FIPS mode or the FORBID_WEAK_KEYS flag is set.
> +	 */
>  	if ((fips_enabled || (crypto_skcipher_get_flags(tfm) &
>  			      CRYPTO_TFM_REQ_FORBID_WEAK_KEYS)) &&
>  	    !crypto_memneq(key, key + (keylen / 2), keylen / 2))

Please use the kernel style for block comments:

	/*
	 * Ensure that the AES and tweak key are not identical when in FIPS mode
	 * or the FORBID_WEAK_KEYS flag is set.
	 */

- Eric

  reply	other threads:[~2022-12-21 23:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21 22:41 [PATCH 0/6] Trivial set of FIPS 140-3 related changes Vladis Dronov
2022-12-21 22:41 ` [PATCH 1/6] crypto: xts - restrict key lengths to approved values in FIPS mode Vladis Dronov
2022-12-21 22:41 ` [PATCH 2/6] crypto: xts - drop xts_check_key() Vladis Dronov
2022-12-21 23:33   ` Eric Biggers [this message]
2022-12-22 16:41     ` Vladis Dronov
2022-12-21 22:41 ` [PATCH 3/6] crypto: xts - drop redundant xts key check Vladis Dronov
2022-12-21 22:41 ` [PATCH 4/6] crypto: testmgr - disallow plain cbcmac(aes) in FIPS mode Vladis Dronov
2022-12-21 22:41 ` [PATCH 5/6] crypto: testmgr - disallow plain ghash " Vladis Dronov
2022-12-21 22:41 ` [PATCH 6/6] crypto: testmgr - allow ecdsa-nist-p256 and -p384 " Vladis Dronov

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=Y6OXuT95MlkNanSR@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=davem@davemloft.net \
    --cc=elliott@hpe.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nstange@suse.de \
    --cc=smueller@chronox.de \
    --cc=vdronov@redhat.com \
    /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