Re: use of RDRAND in $random_library
Joey Hess wrote:
> int cpu_has_rdrand()
> {
> uint32_t ax,bx,cx,dx,func=1;
> __asm__ volatile ("cpuid":\
> "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func));
> return (cx & 0x40000000);
> }
That's actually buggy on any platform building position-independent code
(common with hardened build flags). PIC uses ebx, and that would conflict with
this code, resulting in a compile failure. GCC provides a <cpuid.h>
with a __get_cpuid function that avoids that problem.
- Josh Triplett
Reply to: