Giter VIP home page Giter VIP logo

rdrand-tester's Introduction

RDRAND-Tester

This is an application to test the functionality of the RDRAND instruction in x86 CPUs. It additionally shows the presence of the RDSEED instruction. This may be useful to test for the presence of buggy RDRAND implementations which are present on some CPUs that causes issues with certain software which depends on this instruction.

Pre-built Binaries

The pre-built binaries can be found in the releases section. The binaries were built as described below.

Windows

  1. Obtain MinGW/GCC from winlibs.
  2. Prepare manifest for UAC by executing windres win_manifest\resource.rc obj\manifest.o.
  3. Build the binary by executing gcc RDRAND_Tester.c obj\manifest.o -o release\RDRAND_Tester_Windows.exe -Wall -Wconversion -Wformat-security -std=c17 -O3 -static -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fPIE -fstack-clash-protection -fcf-protection -Wl,-pie,--no-copy-dt-needed-entries,--as-needed,--nxcompat,--dynamicbase,--high-entropy-va -s.

Linux

  1. Install GCC.
  2. Build the binary by executing gcc RDRAND_Tester.c -o release/RDRAND_Tester_Linux -Wall -Wconversion -Wformat-security -O3 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fPIE -fstack-clash-protection -fcf-protection -Wl,-z,relro,-z,now,-pie,--hash-style=gnu,--no-copy-dt-needed-entries,--as-needed -s.

Example Output

Below is an example of the output produced by this application on a CPU with a properly functioning RDRAND instruction.

================================================================================
RDRAND Tester v20210328 x86_64
--------------------------------------------------------------------------------
Compiled on Apr 16 2021
Compiled with GNU Compiler Collection (GCC) 10.3.0
================================================================================

Running on Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
This CPU supports the following instructions:
 RDRAND: Supported
 RDSEED: Supported

Testing RDRAND...

try:   1   success: 1   random number:  5012598193280705724 (0x4590537fb842e4bc)
try:   2   success: 1   random number: 13057969725578991747 (0xb5373a4804f0d883)
try:   3   success: 1   random number: 15258542471905877516 (0xd3c13b88f4291e0c)
try:   4   success: 1   random number:  2878339394249548515 (0x27f1ea6dd141e2e3)
try:   5   success: 1   random number:  5238856747007213768 (0x48b428746a8600c8)
try:   6   success: 1   random number: 12836524077560437497 (0xb2247ea341bd1af9)
try:   7   success: 1   random number: 15869268653934935726 (0xdc3af7c303087eae)
try:   8   success: 1   random number: 17374580931805302711 (0xf11ee94d9187cfb7)
try:   9   success: 1   random number:  2260023498090627146 (0x1f5d3765bbba404a)
try:  10   success: 1   random number:   380621888462874021 (0x05483d97479165a5)
try:  11   success: 1   random number: 17765201729153443702 (0xf68aacd93d58a776)
try:  12   success: 1   random number: 17666429294697117999 (0xf52bc3d7bff9f92f)
try:  13   success: 1   random number: 10586101450554073644 (0x92e9632e8485e22c)
try:  14   success: 1   random number:  3888766898547441689 (0x35f7ace40237c019)
try:  15   success: 1   random number:  5764275204437754665 (0x4ffed1c20c1ac329)
try:  16   success: 1   random number:  8845614113758411495 (0x7ac1ef2b9ec07ae7)
try:  17   success: 1   random number:  4829856922400078030 (0x43071947ff9e38ce)
try:  18   success: 1   random number:  6630984605313841605 (0x5c05fd5db6d0b9c5)
try:  19   success: 1   random number:  6917881360425400011 (0x60014071de73b6cb)
try:  20   success: 1   random number: 18115961797194281831 (0xfb68d345a64ff367)

The RDRAND instruction of this CPU appears to be working.
The numbers generated should be different and random.
If the numbers generated appears to be similar, the RDRAND instruction is
broken.

rdrand-tester's People

Contributors

cjee21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rdrand-tester's Issues

Missing "release/RDRAND_Tester_Linux" file/directory

OS: Linux, Fedora, edition 39. Code acquired with git clone.

Hello. Missing release/RDRAND_Tester_Linux file/directory.

$ gcc RDRAND_Tester.c -o release/RDRAND_Tester_Linux -Wall -Wconversion -Wformat-security -O3 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fPIE -fstack-clash-protection -fcf-protection -Wl,-z,relro,-z,now,-pie,--hash-style=gnu,--no-copy-dt-needed-entries,--as-needed -s
/usr/bin/ld: cannot open output file release/RDRAND_Tester_Linux: No such file or directory
collect2: error: ld returned 1 exit status

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.