On Tue, Oct 1, 2013 at 1:46 PM, H. Peter Anvin <h...@zytor.com> wrote:
> On 10/01/2013 12:37 PM, Kees Cook wrote:
>> +
>> +#include <asm/archrandom.h>
>> +static inline int rdrand(unsigned long *v)
>> +{
>> +     int ok;
>> +     asm volatile("1: " RDRAND_LONG "\n\t"
>> +                  "jc 2f\n\t"
>> +                  "decl %0\n\t"
>> +                  "jnz 1b\n\t"
>> +                  "2:"
>> +                  : "=r" (ok), "=a" (*v)
>> +                  : "0" (RDRAND_RETRY_LOOPS));
>> +     return ok;
>> +}
>> +
>
> This looks just like rdrand_long() in arch/x86/kernel/cpu/rdrand.c and
> could move into the header file, no?

Yes, good idea. I'll move it into archrandom.h instead of this copy/paste.

-Kees

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

Reply via email to