Return-Path: Received: from sonic308-46.consmr.mail.ir2.yahoo.com (sonic308-46.consmr.mail.ir2.yahoo.com [77.238.178.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.server123.net (Postfix) with ESMTPS for ; Thu, 20 Feb 2020 07:57:05 +0100 (CET) References: <7fc85398-a14e-bba1-c996-5d398fef8e7d@gmail.com> <9d9951e1-03a2-fcc5-8d2d-8b2276ab584c@yahoo.com> <0acf7f14-ae82-686a-bc13-847b01cd5aab@gmail.com> <20200220022335.GA29182@tansi.org> From: Quentin Lefebvre Message-ID: <6d606224-235f-2e1c-0c2b-dd7d93c696ee@yahoo.com> Date: Thu, 20 Feb 2020 07:55:03 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: quoted-printable Subject: Re: [dm-crypt] Bug in cryptsetup 2.3.0 (BitLocker key-file support) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Milan Broz , dm-crypt@saout.de Hi Milan, Arno, Thanks for your answers. Below, my humble point of view... Le 20/02/2020 =C3=A0 07:37, Milan Broz a =C3=A9crit=C2=A0: > On 20/02/2020 03:23, Arno Wagner wrote: >> On Wed, Feb 19, 2020 at 21:57:23 CET, Milan Broz wrote: >>> On 19/02/2020 21:13, Quentin Lefebvre wrote: >>>> The on-disk keyfile was the printed recovery passphrase provided by >>>> Windows... >>>> >>>> > So what is the exact content of your keyfile? Is there additiona= l EOL, >>>> > or it had some more characters there? >>>> >>>> ls -l >>>> showed a 56 bytes file and >>>> >>>> hexdump -C >>>> showed a trailing '\x0a' character added by my favorite editor. >>>> >>>> Removing it with dd(!) solved my problem... >>> >>> ok, thanks for the info. >>> >>> But I think we should perhaps process even this file (recovery >>> passphrase has a special format - if it is detected, we try to use it= , >>> otherwise we parse it as a normal passphrase). >>> I think we can do this even if it is has an additional EOL there. >> >> I would suggest giving a verbose warning in this case. >> Something like, "recovery passphrase detected, extra EOL chars strippe= d." >=20 > If it fails to open through a recovery passphrase slot, then code tries= it as a normal > one (key derivation is quite fast here, so it is just a small delay) - = so this > is really not necessary. I think it would be a bit surprising (and a bit dangerous maybe) not to=20 have a consistent behavior of cryptsetup between a bitlk recovery=20 passphrase and a bitlk "normal" passphrase. Although it is possible to add code to detect a bitlk recovery=20 passphrase, it may be confusing for the user if cryptsetup is not=20 consistent for all kinds of passphrases (bitlocker, luks, ...) But suggestions are always good and here is mine: When cryptsetup attemps to use a passphrase provided in a file: 1) try it, 2) only if the provided passphrase file fails, test whether there is a=20 trailing EOL (maybe Unix/Windows-like) and try again cutting it (here I=20 agree with Arno the user should be warned). IMHO, this solution may be easier to implement and it has the benefits=20 to be consistent for all kind of encrypted containers, and also to make=20 the user aware of the EOL problem in his file (and learn more about his=20 favorite text editor ;-). Have a nice day, Quentin