Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YD5tv-0004qH-O8 for mharc-grub-devel@gnu.org; Mon, 19 Jan 2015 01:33:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YD5ts-0004q7-Ol for grub-devel@gnu.org; Mon, 19 Jan 2015 01:33:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YD5tr-0005Xt-Ke for grub-devel@gnu.org; Mon, 19 Jan 2015 01:33:24 -0500 Received: from linux-libre.fsfla.org ([208.118.235.54]:57209) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YD5tr-0005Xn-Gt for grub-devel@gnu.org; Mon, 19 Jan 2015 01:33:23 -0500 Received: from freie.home (home.lxoliva.fsfla.org [172.31.160.22]) by linux-libre.fsfla.org (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id t0J6XIV4002469; Mon, 19 Jan 2015 06:33:20 GMT Received: from livre.home (livre.home [172.31.160.2]) by freie.home (8.14.8/8.14.8) with ESMTP id t0J6XC2k031116; Mon, 19 Jan 2015 04:33:12 -0200 From: Alexandre Oliva To: Andrei Borzenkov Subject: Re: enable cryptomount to read passphrase from file Organization: Free thinker, not speaking for the GNU Project References: <20150118175719.5ddabee5@opensuse.site> Errors-To: aoliva@lxoliva.fsfla.org Date: Mon, 19 Jan 2015 04:33:12 -0200 In-Reply-To: <20150118175719.5ddabee5@opensuse.site> (Andrei Borzenkov's message of "Sun, 18 Jan 2015 17:57:19 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.54 Cc: grub-devel@gnu.org, John Lane X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jan 2015 06:33:26 -0000 On Jan 18, 2015, Andrei Borzenkov wrote: > I suggest you cooperate with John for this; he has a set of patches to > support it as well. See also http://grub.johnlane.ie/. Nice, for some reason I didn't find his patchset in my web searches. I ended up using his code to update the crypto modules in libreboot on my x60, and a slight variant of mine to update them for use along with BLAG 200k's grub on other machines that are not yet running a Free BIOS. If there's interest, I can post my updated patches here, but I'd be just as happy if John's patchset made it. > Just pass in passphrase+len. Do not expect anything about content of > passphrase file at all. Done. > You can always unlock encrypted filesystem manually, right? As long as grub isn't hosed ;-) In some of my attempts earlier today, it was. Fortunately I'd saved a working grub on a pen drive, and so bringing the machine back to a working condition wasn't too hard. > Hmm ... I'm not sure whether we should fallback to asking user. The whole > point of using keyfile is to avoid user interaction in the first place, > right? Well, sort of. My goal was to let the machine boot up with a pen drive or entering the key manually, so the fallback made sense. I can get this effect by just trying with --keyfile first, and without it afterwards. >> + else if ((grub_size_t)size >= sizeof (buf)) > Can it be larger than sizeof(buf)? No, but it doesn't hurt to play safe, does it? > Is it prohibited to have new line or carriage return in passphrase file? That was one bit I was uncertain about. Keyboard-entered ones certainly can't, but there's no reason I can think of to actually exclude them from files. I was concerned, however, about someone writing a passphrase normally entered by hand to a file with a trailing newline. That wouldn't work. The file should not have the trailing newline. -- Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer