From owner-cvs-all@FreeBSD.ORG Thu Apr 17 06:08:06 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0D16637B404; Thu, 17 Apr 2003 06:08:06 -0700 (PDT) Received: from gw.nectar.cc (gw.nectar.cc [208.42.49.153]) by mx1.FreeBSD.org (Postfix) with ESMTP id DB2E643FB1; Thu, 17 Apr 2003 06:08:04 -0700 (PDT) (envelope-from nectar@celabo.org) Received: from madman.celabo.org (madman.celabo.org [10.0.1.111]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (Client CN "madman.celabo.org", Issuer "celabo.org CA" (verified OK)) by gw.nectar.cc (Postfix) with ESMTP id 4E9ACD0; Thu, 17 Apr 2003 08:08:04 -0500 (CDT) Received: by madman.celabo.org (Postfix, from userid 1001) id A56A078C4A; Thu, 17 Apr 2003 08:08:03 -0500 (CDT) Date: Thu, 17 Apr 2003 08:08:03 -0500 From: "Jacques A. Vidrine" To: Munechika Sumikawa Message-ID: <20030417130803.GA99068@madman.celabo.org> References: <200304161121.h3GBLDhJ040405@repoman.freebsd.org> <20030416124657.GD72501@madman.celabo.org> <20030417.082357.81502723.sumikawa@ebina.hitachi.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030417.082357.81502723.sumikawa@ebina.hitachi.co.jp> X-Url: http://www.celabo.org/ User-Agent: Mutt/1.5.3i-ja.1 cc: cvs-src@FreeBSD.org cc: sumikawa@FreeBSD.org cc: cvs-all@FreeBSD.org cc: src-committers@FreeBSD.org Subject: Re: cvs commit: src/lib/libipsec pfkey_dump.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Apr 2003 13:08:06 -0000 On Thu, Apr 17, 2003 at 08:23:57AM +0000, Munechika Sumikawa wrote: > nectar> These sizes seem arbitrary. Previously, at 10 bytes, they were just a > nectar> bit too small to hold the representation of the largest 32-bit > nectar> unsigned integer. Now at 20 bytes, they are just a bit too small to > nectar> hold the representation of the largest 64-bit unsigned integer. This > nectar> seems sloppy. (As does using a 128 byte buffer to hold the result of > nectar> concatenating two 20 byte buffers.) > > You are right. I've changed to 128 bytes. Er, that wasn't quite my point :-) My point was that the buffer should be sized correctly (rather than fudged), such as char prefbuf[] = "/4294967296"; /* OR */ char prebuf[12]; or whatever you expect the maximum integer to be. [Isn't this a network prefix? Surely 3 digits is sufficient?] It just seems like a lot of wastage, but of course it isn't really important. > It can be used until we > support 512bit CPU :-) Actually 128 bytes is just big enough to hold a NUL-terminated string representation of a 421-bit unsigned integer. You need 156 bytes for 512 bits :-) Also, these two 128 byte buffers are still being concatenated into a single 128 byte buffer, so on average you have room for about 209 bits :-) Cheers, -- Jacques A. Vidrine http://www.celabo.org/ NTT/Verio SME . FreeBSD UNIX . Heimdal Kerberos jvidrine@verio.net . nectar@FreeBSD.org . nectar@kth.se