waywardgeek / infnoise

The world's easiest TRNG to get right
Creative Commons Zero v1.0 Universal
723 stars 99 forks source link

How to build from source on CentOS 6 #62

Open gitcnd opened 6 years ago

gitcnd commented 6 years ago

You need to install these:

yum -y install libftdi-devel libusb-devel libusb1-devel libusb1-static libudev libudev-devel libusb-static

Then grab the latest source:

git clone https://github.com/manuel-domke/infnoise.git

You need to fix your systems usb.h as follows:

*** /home/cnd/keep/usb-180706.h 2010-08-22 18:44:27.000000000 +0000
--- /usr/include/usb.h  2018-07-06 15:35:09.953094618 +0000
***************
*** 12,15 ****
--- 12,16 ----
  #define __USB_H__

+ #include <sys/types.h>
  #include <unistd.h>
  #include <stdlib.h>
***************
*** 64,67 ****
--- 65,71 ----

  /* All standard descriptors have these 2 fields in common */
+ 
+ /* typedef    unsigned char u_int8_t; */
+ 
  struct usb_descriptor_header {
        u_int8_t  bLength;
***************
*** 239,242 ****
--- 243,249 ----
   * move members and only change types if you really know what you're doing.
   */
+ 
+ #   define PATH_MAX     1024
+ 
  struct usb_device {
    struct usb_device *next, *prev;

You need to fix the makefile like so:

*** infnoise/software/Makefile  2018-07-06 15:44:15.500740598 +0000
--- ../infnoise/software/Makefile       2018-07-06 15:36:29.278416280 +0000
***************
*** 1,9 ****
  GIT_VERSION := $(shell git --no-pager describe --tags --always)
  GIT_COMMIT  := $(shell git rev-parse --verify HEAD)
! GIT_DATE    := $(firstword $(shell git --no-pager show --date=iso-strict --format="%ad" --name-only))

  PREFIX = $(DESTDIR)/usr/local

! CFLAGS = -Wall -Wextra -Werror -std=c99 -O3 -fPIC -I Keccak -I /usr/include/libftdi1 \
   -DGIT_VERSION=\"$(GIT_VERSION)\"\
   -DGIT_COMMIT=\"$(GIT_COMMIT)\"\
--- 1,9 ----
  GIT_VERSION := $(shell git --no-pager describe --tags --always)
  GIT_COMMIT  := $(shell git rev-parse --verify HEAD)
! GIT_DATE    := $(firstword $(shell git --no-pager show --date=iso --format="%ad" --name-only))

  PREFIX = $(DESTDIR)/usr/local

! CFLAGS = -Wall -Wextra -Werror -std=c99 -O3 -fPIC -I Keccak -I /usr/include/libusb-1.0/ -I /usr/include -I /usr/include/libftdi1 \
   -DGIT_VERSION=\"$(GIT_VERSION)\"\
   -DGIT_COMMIT=\"$(GIT_COMMIT)\"\

After the above, just run "make"

Finally, you need to copy the .so file to the right place:

cp -a libinfnoise.so /usr/lib64/

Then it works:

# ./infnoise --help
Usage: infnoise [options]
Options are:
    --debug - turn on some debug output
    --dev-random - write entropy to /dev/random instead of stdout
    --raw - do not whiten the output
    --multiplier <value> - write 256 bits * value for each 512 bits written to
      the Keccak sponge.  Default of 0 means write all the entropy.
    --no-output - do not write random output data
    --pidfile <file> - write process ID to file
    --daemon - run in the background
    --serial <serial> - use specified device
    --list-devices - list available devices
    --version - show version information
    --help - this help output

# ./infnoise --list-devices
Manufacturer: 13-37.org, Description: Infinite Noise TRNG, Serial: 1337-***
gitcnd commented 6 years ago

(YOU MIGHT JUST LIKE TO THROW THIS INTO THE FILE: infnoise/software/README ?)

manuel-domke commented 6 years ago

Thanks for testing this. (especially libinfnoise)

I'll create a github wiki for the project soon.

There is too much info spread in the code and the readme's already. And its getting more and more :-)