From owner-freebsd-stable@FreeBSD.ORG Mon Jan 31 13:58:26 2005 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6BB5316A4CE for ; Mon, 31 Jan 2005 13:58:26 +0000 (GMT) Received: from wrzx35.rz.uni-wuerzburg.de (wrzx35.rz.uni-wuerzburg.de [132.187.3.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id AFAC243D3F for ; Mon, 31 Jan 2005 13:58:25 +0000 (GMT) (envelope-from q@uni.de) Received: from wrzx30.rz.uni-wuerzburg.de (wrzx30.rz.uni-wuerzburg.de [132.187.1.30]) by wrzx35.rz.uni-wuerzburg.de (Postfix) with ESMTP id BFAB9E1037; Mon, 31 Jan 2005 14:58:24 +0100 (CET) Received: from virusscan (localhost [127.0.0.1]) by wrzx30.rz.uni-wuerzburg.de (Postfix) with ESMTP id A1A6593163; Mon, 31 Jan 2005 14:58:24 +0100 (CET) Received: from wrzx28.rz.uni-wuerzburg.de (wrzx28.rz.uni-wuerzburg.de [132.187.3.28]) by wrzx30.rz.uni-wuerzburg.de (Postfix) with ESMTP id 7B54193116; Mon, 31 Jan 2005 14:58:24 +0100 (CET) Received: from coyote.q.local (wwsx14.win-screen.uni-wuerzburg.de [132.187.253.14]) by wrzx28.rz.uni-wuerzburg.de (Postfix) with ESMTP id 5EF22D8433; Mon, 31 Jan 2005 14:58:24 +0100 (CET) Received: from roadrunner.q.local (roadrunner.q.local [192.168.0.148]) by coyote.q.local (8.13.1/8.13.1) with ESMTP id j0VDwOt3069409; Mon, 31 Jan 2005 14:58:24 +0100 (CET) (envelope-from q@uni.de) Received: from roadrunner.q.local (localhost [127.0.0.1]) by roadrunner.q.local (8.13.1/8.13.1) with ESMTP id j0VDwOgI004469; Mon, 31 Jan 2005 14:58:24 +0100 (CET) (envelope-from q@uni.de) Received: (from q@localhost) by roadrunner.q.local (8.13.1/8.13.1/Submit) id j0VDwNf1004468; Mon, 31 Jan 2005 14:58:23 +0100 (CET) (envelope-from q@uni.de) Date: Mon, 31 Jan 2005 14:58:23 +0100 From: Ulrich Spoerlein To: Poul-Henning Kamp Message-ID: <20050131135823.GD828@galgenberg.net> Mail-Followup-To: Poul-Henning Kamp , freebsd-stable@freebsd.org References: <20050130221803.GB2600@galgenberg.net> <76988.1107123877@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bGR76rFJjkSxVeRa" Content-Disposition: inline In-Reply-To: <76988.1107123877@critter.freebsd.dk> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new (Rechenzentrum Universitaet Wuerzburg) cc: freebsd-stable@freebsd.org Subject: Re: Size of metadata required for GBDE X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jan 2005 13:58:26 -0000 --bGR76rFJjkSxVeRa Content-Type: multipart/mixed; boundary="3O1VwFp74L81IIeR" Content-Disposition: inline --3O1VwFp74L81IIeR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, 30.01.2005 at 23:24:37 +0100, Poul-Henning Kamp wrote: > The amount of metadata in GBDE is pretty straight forward: >=20 > 1. If do not use off-line keyfiles: deduct one sector. >=20 > 2. Deduct the key sectors (1 to 4) >=20 > 3. Find zone size: >=20 > nsect =3D sectorsize / 16 > nzone =3D nsect + 1 >=20 > 4. Find number of zones: >=20 > z =3D remaining_sectors / nzone >=20 > 5. Find usable size: >=20 > size =3D z * nsect >=20 > 6. Find overhead/metadata as: >=20 > total_sectors - size This translates to: overhead =3D sectors - (sectors-4-1)/((sectorsize/16) + 1) * sectorsize/16 So, if I understand that correctly, I need one additional sector every 16 sectors and 5 sectors for the keys (using all the gbde init defaults). What's wrong with the attached program then? It gives wrong results :( % cc -Wall gbde.c -o gbde && ./gbde $((31744*512)) Wanted size: 16252928 bytes in 31744 sectors (blocksize 512) Needed size: 16763392 bytes in 32741 sectors (blocksize 512) This should be 32768 sectors, as can be seen from my earlier mail. Ulrich Spoerlein --=20 PGP Key ID: F0DB9F44 Encrypted mail welcome! Fingerprint: F1CE D062 0CA9 ADE3 349B 2FE8 980A C6B5 F0DB 9F44 Ok, which part of "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn." didn't you understand? --3O1VwFp74L81IIeR Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gbde.c" Content-Transfer-Encoding: quoted-printable #include #include int main(int argc, char **argv) { int okeysec =3D 1; int nkeysec =3D 4; int sectorsize =3D 512; long long size, wanted_sec, needed_sec; if (argc < 2) exit(1); =20 size =3D atoll(argv[1]); if (argc =3D=3D 3) sectorsize =3D atoi(argv[2]); =20 /* Round up to nearest multiple of sectorsize */ if (size % sectorsize) size +=3D sectorsize - size % sectorsize; wanted_sec =3D size / sectorsize; printf("Wanted size: %lld bytes in %lld sectors (blocksize %d)\n", wanted_sec*sectorsize, wanted_sec, sectorsize); needed_sec =3D wanted_sec + (wanted_sec*16)/sectorsize + okeysec + nkeyse= c; printf("Needed size: %lld bytes in %lld sectors (blocksize %d)\n", needed_sec*sectorsize, needed_sec, sectorsize); return (0); } --3O1VwFp74L81IIeR-- --bGR76rFJjkSxVeRa Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQFB/jl/mArGtfDbn0QRAsqDAKDRgFtkiZbS1y4GCDXDXqoAxL1/QgCfZ0mE mh1E2CR9aYgwqVJlulowsWk= =Kq+Z -----END PGP SIGNATURE----- --bGR76rFJjkSxVeRa--