linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Harald Freudenberger <freude@linux.ibm.com>
Cc: linux-crypto@vger.kernel.org, ebiggers@kernel.org,
	heiko.carstens@de.ibm.com, gor@linux.ibm.com
Subject: Re: [PATCH 2/3] s390/crypto: Rework on paes implementation
Date: Fri, 22 Nov 2019 22:07:57 +0800	[thread overview]
Message-ID: <20191122140757.mbpnasimvnhke3k2@gondor.apana.org.au> (raw)
In-Reply-To: <bd21bf85-7bfc-afd6-270b-272bd0fa553a@linux.ibm.com>

On Fri, Nov 22, 2019 at 02:38:30PM +0100, Harald Freudenberger wrote:
>
> The pkey is in fact a encrypted key + a verification pattern for the
> encrypted key used. It gets invalid when this encryption key changes.
> The encryption key changes when the LPAR is re-activated so for
> example on suspend/resume or an Linux running as kvm guest
> gets relocated. So this happens very rarely.

I see.  Is there any way of you finding out that the key has been
invalidated apart from trying out the crypto and having it fail?

Ideally you'd have a global counter that gets incremented everytime
an invalidation occurs.  You can then regenerate your key if its
generation counter differs from the current global counter.

Also when the crypto fails due to an invalid key you're currently
calling skcipher_walk_done with zero.  This is wrong as the done
function must be called with a positive value or an error.  In
some cases this can cause a crash in scatterwalk.

IOW you should just repeat the crypto operation after regenerating
the key rather than looping around again.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2019-11-22 14:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13 10:55 [PATCH 0/3] provide paes selftests Harald Freudenberger
2019-11-13 10:55 ` [PATCH 1/3] s390/pkey: Add support for key blob with clear key value Harald Freudenberger
2019-11-13 10:55 ` [PATCH 2/3] s390/crypto: Rework on paes implementation Harald Freudenberger
2019-11-22  8:13   ` Herbert Xu
2019-11-22  9:54     ` Harald Freudenberger
2019-11-22 10:42       ` Herbert Xu
2019-11-22 13:38         ` Harald Freudenberger
2019-11-22 14:07           ` Herbert Xu [this message]
2019-11-22 14:45             ` Harald Freudenberger
2019-11-13 10:55 ` [PATCH 3/3] crypto/testmgr: add selftests for paes-s390 Harald Freudenberger
2019-11-22  8:16   ` Herbert Xu
2019-11-22  9:11     ` Harald Freudenberger
2019-11-26  8:59       ` Herbert Xu
2020-01-31 11:06     ` Harald Freudenberger
2020-02-10  7:19       ` Harald Freudenberger
2020-02-11  2:38         ` Herbert Xu
2020-02-13  7:40   ` [PATCH] " Harald Freudenberger
2020-02-13  8:39     ` Herbert Xu

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=20191122140757.mbpnasimvnhke3k2@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=ebiggers@kernel.org \
    --cc=freude@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-crypto@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;
as well as URLs for NNTP newsgroup(s).