Software kit contents

  • Folder linux-32 – all necessary files and source code for building the GetRND and EF download utilities and the tlrandom kernel module for 32-bit Linux distributions (kernel 2.6 and up). The folder also contains the C++ source code of the TL200 software API.
  • Folder linux-64 – all necessary files and source code for building the GetRND and EF download utilities and the tlrandom kernel module for 64-bit Linux distributions (kernel 2.6 and up). The folder also contains the C++ source code of the TL200 software API.
  • Folder OS X-64 – all necessary files and source code for building the GetRND download utility for macOS. The folder also contains the C++ source code of the TL200 software API.
  • Folder windows – all necessary files and source code for building the GetRND download utility for Windows XP SP3, Vista, 7, 8, 8.1, and 10 (32-bit or 64-bit). A prebuilt getrnd.exe executable is included in this folder. The utility can be built with Microsoft Visual C++ 2010 Express or newer. The folder also contains the C++ source code of the TL200 software API.
  • File TL200 – Technical Specifications.pdf – device operation and technical characteristics.
  • File TL200 device API.pdf – detailed API description.

Using with Windows

These steps apply to Windows XP, Vista, 7, 8, 8.1, and 10 (32-bit or 64-bit).

Connect the TL200 to the PC through an available USB 2.0 or 3.0 port using the supplied USB extension cable. The first time the TL200 is connected, Windows automatically looks for an appropriate device driver to install. If Windows cannot locate the driver, install it manually by running the CDM21224_Setup.exe installer supplied in the windows folder of the software kit.

The software kit contains the getrnd.exe utility in the folder windows\getrnd\Release, which can be used to verify that the device is installed. Alternatively, the folder windows\getrnd contains a Visual C++ 2010 Express project that builds getrnd.exe. The project also contains the software API source code and FTDI third-party files that can be included in other projects for communicating with the TL200.

To verify the TL200 installation status, run the following command:

windows\getrnd\Release\getrnd.exe -ld

When the TL200 is installed and ready, the output should look similar to this:

{DevNum=0 WinPort=COM1 ID=0x4037001 LocId=0x2111 UsbCfg=AMWU4OR5 DevModel=TL200 DevVer=1.7 DevS/N=789A04154435535948202020FF0801 DevPowerProfile=5}

Each time the TL200 is connected to a USB port, the monitoring logic flashes the LED and then runs the HCT, Repetition Count, and Adaptive Proportion tests on random bytes as a start-up test suite for about 10 seconds before the device can be used.

Using with Linux (32-bit)

Connect the TL200 to the PC through an available USB 2.0 or 3.0 port using the supplied USB extension cable. Linux kernel 2.6 and later already contains the USB drivers required by the TL200. All necessary files for 32-bit Linux, including the project for the GetRND and EF utilities, are located in the folder linux-32\getrnd.

The GetRND utility can be used to verify the TL200 installation status. Building the GetRND and EF utilities requires make, gcc, and g++.

On Ubuntu, use the following commands to install the required dependencies:

sudo apt-get update
sudo apt-get install make
sudo apt-get install g++

On CentOS or Red Hat, use the following commands to install the required dependencies:

yum update
yum install make
yum install gcc-c++

To build the GetRND and EF utilities, run the following commands:

cd linux-32\getrnd
make

Before using the TL200 with Linux, configure it once by running the configure utility, which is available in the same folder as getrnd:

sudo ./configure –slo –dn 0

To verify that the device was configured for Linux, run the following command:

sudo ./configure –ld

When the TL200 is installed and ready, the output should look similar to this (configured for Linux and macOS):

{DevNum=0 DevModel=TL200 DevVer=1.8 DevS/N=789A04154435535948202020FF0801}

A successful installation can also be verified with the following command (note the sudo prefix; GetRND requires elevated permissions):

sudo ./getrnd -ld

When the TL200 is installed and ready, the output should look similar to this:

{DevNum=0 ID=0x4037001 LocId=0x2111 UsbCfg=AMWU4OR5 DevModel=TL200 DevVer=1.7 DevS/N=789A04154435535948202020FF0801 DevPowerProfile=5}

Each time the TL200 is connected to a USB port, the monitoring logic flashes the LED and then runs the HCT, Repetition Count, and Adaptive Proportion tests on random bytes as a start-up test suite for about 10 seconds before the device can be used.

Using with Linux (64-bit)

Installing the TL200 on 64-bit Linux follows the same steps as for 32-bit Linux above, except that all files for 64-bit Linux are located in the linux-64\getrnd folder.

To build the GetRND and EF utilities, run the following commands:

cd linux-64\getrnd
make

Building and loading the tlrandom kernel module on Linux

The TL200 can be used with the tlrandom kernel module included in the TL200 software kit. The module has been tested with Ubuntu 14.04 LTS (server and desktop), CentOS 7, and CentOS 6 (32-bit and 64-bit), and should also work with other Linux-based x86/x64 systems.

Configure the TL200 for use with Linux/macOS before using it with the tlrandom module (see “Using with Linux” above for configuration details).

The tlrandom make project is available in the following kit locations:

linux-32\tlrandom
linux-64\tlrandom

We strongly recommend running the following commands before building the tlrandom module on Ubuntu:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get reboot
sudo apt-get install make
sudo apt-get install gcc

We strongly recommend running the following commands, with system administration permissions, before building the tlrandom module on CentOS:

yum install make
yum install gcc
yum install kernel-devel
reboot

Build the tlrandom module with make. You will need to rebuild the module each time a new version of the kernel is installed.

Once the module is built, load it into the kernel by running the ins-tlrandom.sh script with system administration permissions:

./ins-tlrandom.sh

After the kernel loads the tlrandom module, random bytes are available from the following device:

/dev/tlrandom

The module allows the entropy available from /dev/tlrandom to be shared concurrently by multiple applications. The device can feed the rngd daemon with random data from the TL200 using the following command (on Ubuntu, install rngd with sudo apt-get install rng-tools):

sudo rngd -r /dev/tlrandom

Alternatively, you can download random bytes to a file using the following command:

dd if=/dev/tlrandom of=download.bin bs=100 count=120000

The tlrandom module automatically detects when a TL200 is plugged into or unplugged from any USB port.

Note that the getrnd utility cannot be used while the TL200 is in use by the tlrandom module.

To verify that the tlrandom module has detected the TL200, check the kernel system log for an entry similar to this:

--------------------------------------
-- TL200 device connected and ready --
--------------------------------------

Currently the tlrandom module can use only one TL200 at a time.

To unload the tlrandom module from the kernel, run the following command with system administration privileges:

rmmod tlrandom

Using with macOS

Connect the TL200 through an available USB 2.0 or 3.0 port using the supplied USB extension cable. macOS 10.6 and later already contain the USB drivers required by the TL200. All necessary files for macOS, including the project for the GetRND utility, are located in the OS X-64 \getrnd folder.

The GetRND utility can be used to verify the TL200 installation status. Building it requires make, gcc, and a C++ compiler.

To build the GetRND utility, run the following commands:

cd “OS X-64 \getrnd”
make

Before using the TL200 with macOS, configure it once by running the configure utility, which is available in the same folder as getrnd:

sudo ./configure –slo –dn 0

To verify that the device was configured for macOS, run the following command:

sudo ./configure –ld

When the TL200 is installed and ready, the output should look similar to this (configured for Linux and macOS):

{DevNum=0 DevModel=TL200 DevVer=1.8 DevS/N=789A04154435535948202020FF0801}

A successful installation can also be verified with the following command:

./getrnd -ld

When the TL200 is installed and ready, the output should look similar to this:

{DevNum=0 ID=0x4037001 LocId=0x2111 UsbCfg=AMWU4OR5 DevModel=TL200 DevVer=1.6 DevS/N=789A04154435535948202020FF0801 DevPowerProfile=5}

Using the GetRND utility

The GetRND utility discovers TL200 devices connected to the host computer and downloads random bytes from them. On Linux, run getrnd with the sudo prefix.

Use the following command to scan for all connected TL200 devices (on Windows, replace sudo ./getrnd with getrnd.exe). It reports only TL200 devices that are not currently in use:

sudo ./getrnd -ld

The output looks like this (one line per attached device):

{DevNum=0 ID=0x4037001 LocId=0x2111 UsbCfg=AMWU4OR5 DevModel=TL200 DevVer=1.6 DevS/N=789A04154435535948202020FF0801 DevPowerProfile=5}

Where:

  • DevNum – logical device number, starting with 0
  • ID – FTDI USB internal ID
  • LocId – FTDI location ID
  • UsbCfg – FTDI USB configuration version
  • DevModel – TL device model
  • DevVer – TL200 device version
  • DevS/N – TL200 unique serial number
  • DevPowerProfile – TL200 power profile (5 is the fastest)

To download 12 MB of true random numbers from the TL200 device and store them in a file named rnd.bin:

sudo ./getrnd -dd -fn rnd.bin -nb 12000000

To download 12 MB of true random numbers from the TL200 device and send them to standard output (do not use this on Windows, because the OS adds extra bytes to the standard output stream):

sudo ./getrnd -dd -nb 12000000 -wtso

To download an unlimited amount of true random numbers from the TL200 device and store them in a file named rnd.bin:

sudo ./getrnd -dd -fn rnd.bin

To download 12 MB of raw random numbers from the TL200 device and store them in a file named rnd.bin (use this mode only when applying external bias-removal logic; raw bytes are not expected to pass statistical tests):

sudo ./getrnd -dd -fn rnd.bin -nb 12000000 -gm r

To generate a random sequence of non-repeatable numbers 1 through 10 in a random order:

sudo ./getrnd -grs 1 10

To generate a random sequence of non-repeatable numbers (including negative numbers) -10 through 5 in a random order:

sudo ./getrnd -grs -10 5

You can also limit the count of numbers generated to fewer than the range. For example, to generate only the first five numbers of a random sequence from 1 through 10,000,000:

sudo ./getrnd -grs 1 10000000 5

To list all command-line options of the GetRND utility:

./getrnd

Using the EF (Entropy Feeder) utility

The EF utility, currently available only for Linux, downloads random bytes from the TL200 and feeds them into the Linux /dev/random entropy pool. Connect the TL200 to an available USB port before running it.

To start continuously feeding the kernel entropy pool /dev/random from the TL200, run this command:

sudo ./ef

The EF utility can be started with the -crm option, which keeps the utility running if the TL200 is disconnected from and reconnected to the host computer. Use this option when running EF in the background, for example with the following command:

sudo nohup ./ef -crm > ./ef.log 2>&1 &

To list all options of the EF utility:

./ef -?

Example C++ code for downloading random data

The TL200 software kit contains a C++ class that can be included in any C++ program to download true random bytes.

The sample code below downloads 100000 true random bytes from the connected TL200 using the software API:

#include "TL200.h"
//
// Main entry
//
int main(int argc, char **argv) {
    TL200 tl;

    // Reserve 100000 bytes plus one additional byte for random data
    // and for the status byte
    uint8_t rnd[100001];

    int resp = tl.open(0); // Open the first TL200 device available
    if (resp) {
        // Couldn't open TL200 device
        return (resp);
    }
    // Download 100000 true random bytes from the TL200 device
    // using default (recommended) mode (SHA256)
    int status = tl.getBytes(rnd, 100000);

    if (status) {
        // Couldn't retrieve random bytes from the TL200 device
        // Retrieve last error message
        char *errMessage = tl.getLastErrMsg();
        tl.close();
        return status;
    }
    // Successfully retrieved 100000 true random bytes
    tl.close();
    return status;
}

User interactive mode (Windows)

User interactive mode is activated by sending the single-character command u to the TL200 using the GetRND utility.

In this mode, you can:

  • Set a different power profile (five power profiles trade speed against power consumption)
  • Enable or disable specific statistical start-up tests
  • Run statistical tests
  • Generate frequency data reports for the random sources
  • Generate a new user passcode
  • Retrieve the unique device serial number

When entering this mode, you are prompted for a valid passcode. For security reasons, this unique passcode is sent by regular mail in a separate envelope.

To activate user interactive mode on Windows:

  1. Connect the TL200 to the PC through an available USB 2.0 or 3.0 port using the supplied USB extension cable.
  2. Open a Command Prompt window and change to the directory that contains getrnd.exe (the windows\getrnd\Release folder).
  3. Run getrnd.exe -uis to activate user interactive mode.
  4. Press the u key. You are prompted for the access passcode; enter it promptly, within the limited time allowed.
  5. After successful authentication, the interactive menu is displayed.
  6. Select menu items by pressing the letter assigned to each.
  7. When finished, exit the user session back to command mode and press the . key to exit the utility (or disconnect the TL200 from the USB port and reconnect it).

Using /dev/tlrandom as a non-root user on Linux

To allow a non-root user to access the /dev/tlrandom device, copy the supplied 80-tl-device-access.rules file to /etc/udev/rules.d/.