From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13 Path: news.gmane.org!not-for-mail From: Solar Designer Newsgroups: gmane.linux.lib.musl.general Subject: Re: FreeSec DES-based crypt(3) Date: Mon, 23 May 2011 16:50:21 +0400 Message-ID: <20110523125021.GA10659@openwall.com> References: <20110502134333.GB18325@openwall.com> <20110502134952.GK277@brightrain.aerifal.cx> <20110502180336.GA20095@openwall.com> <20110502190135.GL277@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1306155033 32463 80.91.229.12 (23 May 2011 12:50:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 23 May 2011 12:50:33 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-96-gllmg-musl=m.gmane.org@lists.openwall.com Mon May 23 14:50:27 2011 Return-path: Envelope-to: gllmg-musl@lo.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1QOUaY-00070s-0p for gllmg-musl@lo.gmane.org; Mon, 23 May 2011 14:50:26 +0200 Original-Received: (qmail 7864 invoked by uid 550); 23 May 2011 12:50:25 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 7856 invoked from network); 23 May 2011 12:50:25 -0000 Content-Disposition: inline In-Reply-To: <20110502190135.GL277@brightrain.aerifal.cx> User-Agent: Mutt/1.4.2.3i Xref: news.gmane.org gmane.linux.lib.musl.general:13 Archived-At: Rich, I am sorry for not continuing this discussion for so long. On Mon, May 02, 2011 at 03:01:35PM -0400, Rich Felker wrote: > I wonder... is there any way to cut down on the size of this data > without affecting (or perhaps even improving) the performance of the > code? Yes, Eric Young's fcrypt() in OpenSSL uses 2 KB tables. However, it does not readily implement the extended BSDI-style hashes, and you would not be able to add them easily (they use 24-bit salts, whereas fcrypt's 2 KB is possible due to some clever bit rotates to apply the usual 12-bit salts only). Also, there may be licensing issues. The next step is 4 KB, and it lets you do 24-bit salts. This is what JtR uses when it somehow does not use a bitslice implementation (which it normally does) and when 128 KB tables turn out to be slower. I don't mind licensing this code under LGPL or whatever for use in musl. However, there's no crypt(3) interface, and some parts needed for it are not implemented (e.g., instead of doing DES final permutation on computed hashes, JtR's loader undoes it on hashes that it loads for cracking). Overall, you'd spend/waste lots of time on this until you get clean, portable, and reliable code with functionality that is the same as what the FreeSec code currently has. I briefly thought of this before I integrated FreeSec into the glibc package on Owl, but decided that I had better uses for my time. Of course, 35 KB is more of an issue for musl than it is for glibc... I vaguely recall that it was 20 KB, though (16 KB plus 4 KB). Oh, the 2 KB and 4 KB figures above include only the main tables (S-P or S-P-E). There are some additional ones for key setup. I think that in fcrypt() those are tiny, but in JtR they're large (optimized for speed only, not size). So you'd need to implement smaller key setup as well (or take it from elsewhere). It's not hard to do, but it's extra work. Maybe it'd be simpler to re-work FreeSec to make it use smaller tables. I hope this helps. Alexander