Return-Path: Received: from mail.saout.de ([127.0.0.1]) by localhost (mail.saout.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aYjKVKY1UNVa for ; Sun, 10 Mar 2013 14:36:47 +0100 (CET) Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by mail.saout.de (Postfix) with ESMTP for ; Sun, 10 Mar 2013 14:36:47 +0100 (CET) Received: from a.earth.lavabit.com (a.earth.lavabit.com [192.168.111.10]) by karen.lavabit.com (Postfix) with ESMTP id E140D11B9A8 for ; Sun, 10 Mar 2013 08:19:32 -0500 (CDT) Received: from lavabit.com (nat.hhknet.dk [130.226.154.66]) by lavabit.com with ESMTP id BW2SSZC5NYB8 for ; Sun, 10 Mar 2013 08:19:32 -0500 Message-ID: <40727.130.226.154.66.1362921572.squirrel@lavabit.com> Date: Sun, 10 Mar 2013 09:19:32 -0400 (EDT) From: hephey@lavabit.com MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: [dm-crypt] Securely erase LUKS header List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: dm-crypt@saout.de I'm having trouble calculating the amount of data I need to erase in the header. The af-stripes appears to be hardcoded to 4000, according to the specification [1]. First I made an encrypted loop-device, using default options: cryptsetup luksFormat /dev/loop0 I then made a header backup, using cryptsetup luksHeaderBackup --header-backup-file /tmp/header.img /dev/loop0 The size of this backup (/tmp/header.img) is exactly 1.052.672 bytes, which fits with the number given in the FAQ (see 5.4) [2]. I'm asumming that cryptsetup's calculation is correct. In the FAQ it's also stated that to wipe the header, I need to use to formula: header size = (keyslots x stripes x keysize) + offset bytes I find the relevant values by issuing: cryptsetup luksDump /dev/loop0 The output of this command is on a pastebin here: http://pastebin.com/Nw6NJaQc It seems that my equation would be header size = (1 keyslot * 4000 stripes * 256 bits) + 4096 = 1.028.096 bytes This size is smaller than the size given in the FAQ and the size of my header backup - How come? However, if I set the amount of stripes to 4096 in the formula, I get the correct size: header size = (1 keyslot * 4096 stripes * 256 bits) + 4096 = 1.052.672 bytes What am I doing wrong here? Is luksDump showing the wrong amount of stripes? I would like to make a dynamic script that could quickly determin the correct values for the formula using luksDump and wipe whatever luks-encrypted device that is given as an argument. Please tell if you need more information. ------------------ REFERENCES 1: http://wiki.cryptsetup.googlecode.com/git/LUKS-standard/on-disk-format.pdf 2: https://code.google.com/p/cryptsetup/wiki/FrequentlyAskedQuestions#5._Security_Aspects