From owner-freebsd-bugs@FreeBSD.ORG Sun Jan 18 03:32:47 2015 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 53F30A2D for ; Sun, 18 Jan 2015 03:32:47 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 200FE12B for ; Sun, 18 Jan 2015 03:32:47 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.9/8.14.9) with ESMTP id t0I3WkuD075321 for ; Sun, 18 Jan 2015 03:32:46 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 196834] geli setkey -P doesn't reset md_iterations Date: Sun, 18 Jan 2015 03:32:47 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 10.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: madoka@nyanisore.net X-Bugzilla-Status: New X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jan 2015 03:32:47 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196834 Bug ID: 196834 Summary: geli setkey -P doesn't reset md_iterations Product: Base System Version: 10.1-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: freebsd-bugs@FreeBSD.org Reporter: madoka@nyanisore.net Overview: When removing passphrase from a geli device with both passphrase and keyfile, the iteration counter, md_iterations, isn't reset to the default value of -1. Steps to Reproduce: # geli init -b -B none -e AES-XTS -K /boot/encryption.key -l 128 -s 4096 ada1 Enter new passphrase: Reenter new passphrase: # geli dump ada1 | grep iterations iterations: 534226 # geli setkey -k /boot/encryption.key -K /boot/encryption.key -P ada1 Enter passphrase: Note, that the master key encrypted with old keys and/or passphrase may still exists in a metadata backup file. # geli dump ada1 | grep iterations iterations: 534226 Expected Results: iterations: -1 Additional Information: The stale md_iterations isn't a problem when manipulating the geli device from the command line, because it's effectively ignored with -p. However, some code, such as g_eli_taste(), checks md_iterations == -1 to determine whether a passphrase is set or not. Thus, even after removing the passphrase, it'll still prompt for one. I ran into that problem here: . I was able to work around the problem: # geli setkey -i $(echo '2^32-1' | bc) -k /boot/encryption.key -K /boot/encryption.key -p -P ada1 Note, that the master key encrypted with old keys and/or passphrase may still exists in a metadata backup file. # geli dump ada1 | grep iterations iterations: 4294967295 Note that "geli setkey -i -1" won't work. Also note that while md_iterations is a int32_t, eli_metadata_dump() casts it to a u_int. There are some other minor quirks with eli_metadata_dump(); should I file another PR or just tack it on to this one? -- You are receiving this mail because: You are the assignee for the bug.