On Fri, Aug 16, 2013 at 03:16:11PM +0200, Hauke Mehrtens wrote: > I tested this on an amd64 system, it could be that it works on some > other archs. Yeah, I was building this on arm. > Yes you should put it into backport/compat/backport-3.10.c. > I am still wondering if get_random_int() is needed for such an > algorithm at all. I'm not sure what you mean by this. This is get_random_int() in current kernels: (copied from 3.11-rc) /* * Get a random word for internal kernel use only. Similar to urandom but * with the goal of minimal entropy pool depletion. As a result, the random * value is not cryptographically secure but for several uses the cost of * depleting entropy is too high */ static DEFINE_PER_CPU(__u32 [MD5_DIGEST_WORDS], get_random_int_hash); unsigned int get_random_int(void) { __u32 *hash; unsigned int ret; if (arch_get_random_int(&ret)) return ret; hash = get_cpu_var(get_random_int_hash); hash[0] += current->pid + jiffies + get_cycles(); md5_transform(hash, random_int_secret); ret = hash[0]; put_cpu_var(get_random_int_hash); return ret; } The cw1200 driver calls get_random_int() on every tx paket when there is QoS/queue contention to determine random backoff intervals. The numbers don't need to be cryptographically secure, just "different" -- and there's really no point in sucking the kernel entropy pool dry to do this when it could happen on nearly every frame we transmit. IOW, this is the perfect situation for get_random_int() vs get_random_bytes(). I wonder if it's worth backporting this whole thing (possibly minus arch_get_random_int()) or just re-implementing it using get_random_bytes() instead: unsigned int get_random_int(void) { int r; get_random_bytes(&r, sizeof(r)); return r; } After all, this logic is what any modules would have had would have had to use prior to 3.10. Any thoughts on this? > I uploaded a logfile with some error messages: > http://hauke-m.de/files/compat-wireless/ckmake.log Thanks, I will look into this tonight. - Solomon -- Solomon Peachy pizza at shaftnet dot org Delray Beach, FL ^^ (email/xmpp) ^^ Quidquid latine dictum sit, altum viditur.
Attachment:
pgpVpUAhhMjlI.pgp
Description: PGP signature