From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2686 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Add support for mkostemp, mkstemps and mkostemps Date: Mon, 28 Jan 2013 18:33:48 +0100 Message-ID: <20130128173348.GA6181@port70.net> References: <1359349583-3643-1-git-send-email-basile@opensource.dyc.edu> <20130128093755.GI10600@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1359394445 25369 80.91.229.3 (28 Jan 2013 17:34:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 28 Jan 2013 17:34:05 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2687-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jan 28 18:34:20 2013 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 1Tzsb5-0005Uk-Ek for gllmg-musl@plane.gmane.org; Mon, 28 Jan 2013 18:34:19 +0100 Original-Received: (qmail 24563 invoked by uid 550); 28 Jan 2013 17:34:00 -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 24552 invoked from network); 28 Jan 2013 17:34:00 -0000 Content-Disposition: inline In-Reply-To: <20130128093755.GI10600@port70.net> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2686 Archived-At: * Szabolcs Nagy [2013-01-28 10:37:55 +0100]: > * Anthony G. Basile [2013-01-28 00:06:23 -0500]: > > + unsigned long r; > > can be unsigned char r; > > > + r = ts.tv_nsec + (uintptr_t)&ts / 16 + (uintptr_t)template; > > + for (i=1; i<=6; i++, r>>=4) > > + template[l-i] = 'A'+(r&15); > > it seems to use only 4bit entropy based on clock (and fixed addresses) > these comments were wrong, i did not notice r>>=4 > > + int l = strlen(template)-len; > > int vs size_t problem > this is a bug > i'd do __randname(template, length-suffix) > i think __randname(char *p) api suggestion of john spencer is good (where p points to the XXXXXX part)