From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1336 Path: news.gmane.org!not-for-mail From: =?ISO-8859-2?Q?=A3ukasz_Sowa?= Newsgroups: gmane.linux.lib.musl.general Subject: Re: crypt* files in crypt directory Date: Sun, 22 Jul 2012 18:23:32 +0200 (CEST) Message-ID: References: <20120721171102.GA16724@openwall.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Trace: dough.gmane.org 1342974229 24815 80.91.229.3 (22 Jul 2012 16:23:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 22 Jul 2012 16:23:49 +0000 (UTC) Cc: Lukasz Sowa , musl@lists.openwall.com To: Solar Designer Original-X-From: musl-return-1337-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jul 22 18:23:49 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Ssywe-0002Y3-CI for gllmg-musl@plane.gmane.org; Sun, 22 Jul 2012 18:23:48 +0200 Original-Received: (qmail 31845 invoked by uid 550); 22 Jul 2012 16:23:46 -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 31812 invoked from network); 22 Jul 2012 16:23:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:x-x-sender:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version:content-type; bh=BHlDh2ru+mH0iR+7fWdJ0hub1XYMsD8Ol60ozRDCCgw=; b=qZNqwW82cD0eZKdIrehPQrmrCG7OYv3AXRDdvdr9u++LI/LM6kBZ3OJbekN+/ne7oy UVDcm36T0h9aPTg+o6BgNH6uMoLFtmguD/n8mDA7w/M93xhJntSM0i2i+qkgGuzG7OnD bF5WulbNCxKq6UuB6Cl7LrdZHbuZ1eEukyELLZFjiSXWC+Fzy+sChBzicuLx9cpAOd3Q OvGZd7iYNrEiX648MYBBN8cwINqbYWOLV9XklwTm5GojWWeMAl4/A6Du5wENkk3y6NAy +zv2c57ZnERRsfZqVi5uYSNaCE7u+njWAeVHbb9rw9yy/CCkUL0Cs663emR/8Xf71c13 yGJA== Original-Sender: =?UTF-8?B?xYF1a2FzeiBTb3dh?= X-X-Sender: luke@localhost.localdomain In-Reply-To: <20120721171102.GA16724@openwall.com> User-Agent: Alpine 2.02 (LNX 1266 2009-07-14) Xref: news.gmane.org gmane.linux.lib.musl.general:1336 Archived-At: Hi again, thanks for your reply. On Sat, 21 Jul 2012, Solar Designer wrote: > Hi, > > I suggest that you subscribe to the list, so that if someone does not CC > you on a message yet you want to reply, you don't happen to start a new > thread (again). Sorry about that, I've already subscribed to the list. >> However, there are some consts arrays used inside functions which may >> clutter >> stack like flags_by_subtype from BF_crypt(), test_key, test_setting, >> test_hash >> from _crypt_blowfish_rn(). I think that they can be pulled up to global >> static >> consts but we haven't done that yet. What do you think about this? > > I think that they are in .rodata as long as you have "const" on them, > and thus there's no reason to move them to global scope. They don't > clutter the stack. Yes, that's what I thought about at first, so we didn't moved the code to global but my fault I didn't simply checked it in generated code. Code looks nicer if they're function's static so we should leave it as is. > >> +++ b/include/crypt.h >> @@ -13,6 +13,19 @@ struct crypt_data { >> char *crypt(const char *, const char *); >> char *crypt_r(const char *, const char *, struct crypt_data *); >> >> +char *_crypt_gensalt_traditional_rn(const char *prefix, unsigned long count, >> + const char *input, int size, char *output, int output_size); >> +char *_crypt_gensalt_extended_rn(const char *prefix, unsigned long count, >> + const char *input, int size, char *output, int output_size); >> +char *_crypt_gensalt_md5_rn(const char *prefix, unsigned long count, >> + const char *input, int size, char *output, int output_size); >> + >> +int _crypt_output_magic(const char *setting, char *output, int size); >> +char *_crypt_blowfish_rn(const char *key, const char *setting, >> + char *output, int size); >> +char *_crypt_gensalt_blowfish_rn(const char *prefix, unsigned long count, >> + const char *input, int size, char *output, int output_size); >> + >> #ifdef __cplusplus >> } >> #endif > > None of the interfaces you've added above were supposed to be exported > by a libc. They're not in Owl's glibc, for example, although it does > include crypt_blowfish. > > Instead, you need to roll crypt_blowfish support into crypt() and > crypt_r() wrappers. You may also add similarly hash type agnostic > crypt_rn(), crypt_ra(), crypt_gensalt(), crypt_gensalt_rn(), and > crypt_gensalt_ra(). The crypt.3 man page included with crypt_blowfish > documents them - perhaps it can also become the man page for musl's. > > See crypt_blowfish's wrapper.c and modify it for use in musl or at least > reuse code from it. > I think it's up to Rich what to do with this code. We (Daniel and me) don't have clear idea about it. Best Regards, Lukasz Sowa