2016-11-21 06:56:41

by Patrick Steinhardt

[permalink] [raw]
Subject: PROBLEM: unable to decrypt LUKS partition since v4.9-rc6 (bisected)

Hi,

I'm using cryptsetup 1.7.2 via the kernel's crypto API. Since
version v4.9-rc6, I'm unable to decrypt my LUKS partitions
(aes-xts-plain64, sha512). cryptsetup simply aborts with the
message "No such passphrase available" after inputting the
passphrase.

After bisecting the issue, this points to commit a8348bc (crypto:
algif_hash - Fix NULL hash crash with shash, 2016-11-17). After
reverting this particular commit, everything works correctly
again.

Please let me know if you need additional information.

Regards
Patrick


Attachments:
(No filename) (530.00 B)
signature.asc (801.00 B)
Download all attachments

2016-11-21 07:34:17

by Herbert Xu

[permalink] [raw]
Subject: Re: PROBLEM: unable to decrypt LUKS partition since v4.9-rc6 (bisected)

On Mon, Nov 21, 2016 at 07:56:38AM +0100, Patrick Steinhardt wrote:
>
> I'm using cryptsetup 1.7.2 via the kernel's crypto API. Since
> version v4.9-rc6, I'm unable to decrypt my LUKS partitions
> (aes-xts-plain64, sha512). cryptsetup simply aborts with the
> message "No such passphrase available" after inputting the
> passphrase.
>
> After bisecting the issue, this points to commit a8348bc (crypto:
> algif_hash - Fix NULL hash crash with shash, 2016-11-17). After
> reverting this particular commit, everything works correctly
> again.

Sorry, I screwed up that patch. Please try the following fix.
Thanks!

---8<---
crypto: algif_hash - Fix result clobbering in recvmsg

Recently an init call was added to hash_recvmsg so as to reset
the hash state in case a sendmsg call was never made.

Unfortunately this ended up clobbering the result if the previous
sendmsg was done with a MSG_MORE flag. This patch fixes it by
excluding that case when we make the init call.

Fixes: a8348bca2944 ("algif_hash - Fix NULL hash crash with shash")
Reported-by: Patrick Steinhardt <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>

diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index 05e21b4..d19b09c 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -214,7 +214,7 @@ static int hash_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,

ahash_request_set_crypt(&ctx->req, NULL, ctx->result, 0);

- if (!result) {
+ if (!result && !ctx->more) {
err = af_alg_wait_for_completion(
crypto_ahash_init(&ctx->req),
&ctx->completion);
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

2016-11-21 07:43:51

by Patrick Steinhardt

[permalink] [raw]
Subject: Re: PROBLEM: unable to decrypt LUKS partition since v4.9-rc6 (bisected)

On Mon, Nov 21, 2016 at 03:34:00PM +0800, Herbert Xu wrote:
> On Mon, Nov 21, 2016 at 07:56:38AM +0100, Patrick Steinhardt wrote:
> >
> > I'm using cryptsetup 1.7.2 via the kernel's crypto API. Since
> > version v4.9-rc6, I'm unable to decrypt my LUKS partitions
> > (aes-xts-plain64, sha512). cryptsetup simply aborts with the
> > message "No such passphrase available" after inputting the
> > passphrase.
> >
> > After bisecting the issue, this points to commit a8348bc (crypto:
> > algif_hash - Fix NULL hash crash with shash, 2016-11-17). After
> > reverting this particular commit, everything works correctly
> > again.
>
> Sorry, I screwed up that patch. Please try the following fix.
> Thanks!
[snip]

Thanks for the fast response. Your patch fixes the problem.

Regards
Patrick


Attachments:
(No filename) (790.00 B)
signature.asc (801.00 B)
Download all attachments