Re: [PATCH] [1/4] /dev/random: Fix latency in rekeying sequence number

From: Jens Maurer
Date: Sun Aug 22 2004 - 16:32:41 EST



Lee Revell wrote:
This patch does not actually fix the problem, as 3-700usecs is still
spent in the spinlocked region, this just causes it to be done out of a
workqueue.

May I suggest that get_random_bytes() be called *outside* of the
spinlocked region on a temporary buffer, assuming that the SHA
algorithm is the problem here?

Something like this (untested):

u32 tmp[sizeof(keyptr->secret)/4]; /* on stack */
get_random_bytes(tmp, sizeof(tmp));
spin_lock_bh(&ip_lock);
memcpy(keyptr->secret, tmp, sizeof(keyptr->secret));
/* ... other housekeeping ... */
spin_unlock_bh(&ip_lock);

Jens Maurer

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/