|
Message-ID: <20120916032931.GB254@brightrain.aerifal.cx> Date: Sat, 15 Sep 2012 23:29:31 -0400 From: Rich Felker <dalias@...ifal.cx> To: musl@...ts.openwall.com Subject: Re: musl 0.9.5 release and new website On Sat, Sep 15, 2012 at 03:53:41PM +0200, Szabolcs Nagy wrote: > > Post-release priorities are adding the last of the missing Linux > > syscalls, md5 crypt, and the long-elusive scheduling priority > > i attached an md5 crypt implementation > > i set the key limit to 30000 but that > can be lowered > > i'm not sure about the copyright notice in the middle > as the code was rewritten from scratch so nothing > was actually copied > but the old bsd code is the specification itself > and it is copyrighted: The license is 2-clause BSD so it doesn't really matter. > static uint32_t rol(uint32_t n, int k) { return (n << k) | (n >> (32-k)); } > #define F(x,y,z) (z ^ (x & (y ^ z))) > #define G(x,y,z) (y ^ (z & (y ^ x))) > #define H(x,y,z) (x ^ y ^ z) > #define I(x,y,z) (y ^ (x | ~z)) > #define FF(a,b,c,d,w,s,t) a += F(b,c,d) + w + t; a = rol(a,s) + b > #define GG(a,b,c,d,w,s,t) a += G(b,c,d) + w + t; a = rol(a,s) + b > #define HH(a,b,c,d,w,s,t) a += H(b,c,d) + w + t; a = rol(a,s) + b > #define II(a,b,c,d,w,s,t) a += I(b,c,d) + w + t; a = rol(a,s) + b > > [...] > static void processblock(struct md5 *s, const uint8_t *buf) > { > uint32_t i, W[16], a, b, c, d; > > for (i = 0; i < 16; i++) { > W[i] = buf[4*i]; > W[i] |= (uint32_t)buf[4*i+1]<<8; > W[i] |= (uint32_t)buf[4*i+2]<<16; > W[i] |= (uint32_t)buf[4*i+3]<<24; > } > > a = s->h[0]; > b = s->h[1]; > c = s->h[2]; > d = s->h[3]; > > i = 0; > while (i < 16) { > FF(a,b,c,d, W[i], 7, tab[i]); i++; > FF(d,a,b,c, W[i], 12, tab[i]); i++; > FF(c,d,a,b, W[i], 17, tab[i]); i++; > FF(b,c,d,a, W[i], 22, tab[i]); i++; > } This is more of the same old ugly manual unrolling. The file is small as-is, but I think it could be a lot smaller with -Os (and same speed as now with -O3) if the manual unrolling were removed. I'm going to commit as-is though so I can include it in 0.9.6 (see the other message I'm about to post). Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.