8 uint32_t ax,bx,cx,dx,func=1;
9 __asm__ volatile ("cpuid":\
10 "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func));
11 return (cx & 0x40000000);
14// Returns 1 on success
15inline int _rdrand64_step(uint64_t *therand)
18 asm volatile("rdrand %0 ; setc %1"
19 : "=r" (*therand), "=qm" (err));
23// Returns 0 on success, non-zero on failure.
24int get_rand_bytes(uint8_t *therand, size_t len)
29 uint8_t *end = therand + len;
30 if((uint64_t)p%8 != 0) {
32 fail |= !_rdrand64_step(&tmp);
33 while((uint64_t)p%8 != 0 && p != end) {
34 *p = (uint8_t)(tmp & 0xFF);
39 for(; p <= end - sizeof(uint64_t); p+=sizeof(uint64_t)) {
40 fail |= !_rdrand64_step((uint64_t *)p);
45 fail |= !_rdrand64_step(&tmp);
47 *p = (uint8_t)(tmp & 0xFF);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list