Quantis-PCI Installation

Copyright (c) 2004, 2005, 2006, id Quantique

We thank you for choosing our product. For questions please contact: support@idquantique.com

This document explains how to install the Quantis-PCI driver and how to generate random numbers from various platforms.

Table of contents:

A. Windows Operating System

1. Installation procedure for Windows:

1) Turn off your computer

2) Plug the PCI card into an available PCI slot

3) Turn on your computer

4) Insert the CD-rom that came with this product. Make sure that your CD drive recognizes the CD-rom.

5) Windows may ask for an 'inf' file. In this case browse and locate the file on this CD-rom then click ok.

6) Follow the instructions to finish the installation.

7) The driver is now installed. Run setup.exe to install the program files and all the documention in your system.

2. Testing your PCI card:

2.1 Graphical application

A Windows-based graphical application to acquire random data in several formats is provided. It is installed by the setup program. You can access it in Start Menu -> Programs -> WinQuantis.

2.2 MS-DOS application

Another sample application, using the quantis library and running in MS-DOS mode is provided on the CD-ROM.

1) To view the parameters needed to run our sample application, run the file qrng.exe installed by the setup program (Start Menu -> Programs -> Quantis-PCI Console). The following parameters will be displayed:

qrng - Copyright (C) 2004 id Quantique SA
Usage: ./qrng -n bytes [-b|-u max] [-o output][-c] [-p cardnumber]
-n : amount of bytes
-b : dump in binary (default in ASCII hex)
-u : dump in unsigned decimal with max the max number (must be below 65535)
-o : output file (default to stdout)
-c : order data in one column
-p : PCI card number (default 0)

2) To generate a file of random numbers, edit the qrng.bat file or enter the corresponding command at the command-line prompt. For example, to generate a binary file of 1 million random bytes, type (you need to be in the right folder):

   qrng -n 1000000 -b -o filename.dat

2.3 Quantis library

A library to access the quantis device is provided in this package, both in source and in binary form (quantis.dll and quantis.lib). A documentation for the API of the library can be found in the file libquantis-api.pdf of the CD-rom's doc directory.

B. Linux Operating System

1. Installation procedure for Linux (2.4 and 2.6):

The driver needs to be installed as root.

There are different installation procedures depending on your kernel configuration. With DEVFS enabled in your kernel, the quantis device is directly available in /dev/ after the driver installation. Without DEVFS, you need to create the device files in /dev to access the quantis device after the driver installation.

Type this command to check if DEVFS is enabled in your system:

   grep devfs /proc/filesystems

If you get a line with "nodev devfs", DEVFS is installed.

1.1 Driver Installation procedure for kernel (2.4.x) with DEVFS enabled

1) Turn off your computer

2) Plug the PCI card into an available PCI slot

3) Turn on your computer

4) Insert the CD-rom that came with this product.

5) Copy the src/linux directory to your harddrive

6) Build the driver and the programs using the command:

   cd src/linux/
   make

If you kernel source directory is not /usr/src/linux, edit the file driver/Makefile and change the KERNELDIR variable to your correspondig kernel source directory

7) Install the driver module using the command:

   cd driver/
   insmod quantis.o

Check that the module has been installed correctly using the lsmod command.

The quantis device should now be available as /dev/qrandom/0.

1.2 Driver Installation procedure for kernel (2.4.x and 2.6.x) without DEVFS

1) Turn off your computer

2) Plug the PCI card into an available PCI slot

3) Turn on your computer

4) Insert the CD-rom that came with this product.

5) Copy the src/linux directory to your hard drive

6) Edit the file driver/Makefile and remove the -DUSE_DEVFS CFLAG

7) Build the driver and the programs using the command:

   cd src/linux/
   make

If you kernel source directory is not /usr/src/linux, edit the file driver/Makefile and change the KERNELDIR variable to your correspondig kernel source directory

7') For kernel 2.6.x, build the driver with the command:

   cd driver/
   mv Makefile Makefile.old
   mv Makefile-2.6 Makefile
   make

If you kernel source directory is not /usr/src/linux, edit the new Makefile and change the KERNELDIR variable to your correspondig kernel source directory

8) Install the driver module using the command:

   cd driver/
   insmod quantis.o

Check that the module has been installed correctly using the lsmod command.

8') For kernel 2.6.x, install the driver module using the command:

   insmod quantis.ko

Check that the module has been installed correctly using the lsmod command.

9) Create the device files under /dev/.

e.g.

   mkdir /dev/qrandom
   mknod /dev/qrandom/0 c 254 0
   mknod /dev/qrandom/1 c 254 1
   ...

(0 for the first card, 1 for the second, ...)

You need the major device number of quantis (254 below) to perform the operation. This information can be retrieved in /proc/qrandom or /proc/devices file or in the output of the dmesg command.

e.g.

 cat /proc/qrandom
 PCI-Quantis driver
 version 0.1 with support for 10 cards
 driver 'qrandom', device major 254
 found 3 card(s)
 card 0 version:0x04060100
 card 1 version:0x04060100
 card 2 version:0x04060101

The major device number can also be set at driver installation:

   insmod quantis.o quantisMajor=233

2. Testing your PCI card:

2.1 Direct access via the device file

Random numbers can be dumped via the device file, for example with the following command:

   dd if=/dev/qrandom/0 of=data.bin count=1 bs=1k

This command copies 1024 random bytes from the quantis device to the file data.bin.

You can also read random numbers directly from the device file in the programming language of your choice. For example, in C, you can read random data from the device file by using the functions fopen(3) and fread(3).

2.2 Sample application

A sample console application using the quantis library is provided on the CD-ROM. Compile it by using the make command in the program's directory.

1) Run the qrng programm without arguments and the following parameters will be displayed.

qrng - Copyrigth (C) 2004 id Quantique SA
Usage: ./qrng -n bytes [-b|-u max] [-o output][-c] [-p cardnumber]
-n : amount of bytes
-b : dump in binary (default in ASCII hex)
-u : dump in unsigned decimal with max the max number (must be below 65535)
-o : output file (default to stdout)
-c : order data in one column
-p : PCI card number (default 0)

2) To generate a file of random numbers, enter the corresponding command at the command line prompt. For example, to generate a binary file of 1 million random bytes, type:

   ./qrng -n 1000000 -b -o filename.dat

2.3 Quantis library

A library to access the quantis device is provided in this package, both in source and in binary form (libquantis.a).

A documentation for the API of the library can be found in the file libquantis-api.pdf.

NB: A developper can also access the device directly by using IOCTL calls. Example of IOCTL calls can be found in libquantis.c

C. FreeBSD Operating System

1. Driver Installation procedure for FreeBSD (4.x, 5.x and 6.x):

The driver needs to be installed as root.

1) Turn off your computer

2) Plug the PCI card into an available PCI slot

3) Turn on your computer

4) Insert the CD-rom that came with this product.

5) Copy the src/freebsd directory to your harddrive

6) Build the driver with the command:

   cd src/freebsd/
   make

7) Install the driver module using the command:

   cd driver/
   make install && kldload quantis

Check that module has been installed correctly using the kldstat command.

8) The devices files are automatically created by the Makefile. To manually recreate the dev file (FreeBSD 4.x and 5.x), type the commands:

   mkdir /dev/qrandom
   mknod /dev/qrandom/0 c 32 0

The default major device number in quantis is 32. It can be changed in quantis.c with the CDEV_MAJOR constant.

2. Testing your PCI card:

Please refer to B.2.

D. Solaris Operating System

1. Driver Installation procedure for Solaris (SPARC, x86, x64 - v8, 9, 10):

The driver needs to be installed as root.

1) Turn off your computer

2) Plug the PCI card into an available PCI slot

3) Turn on your computer

4) Insert the CD-rom that came with this product.

5) Copy the src/solaris directory to your harddrive

6) For x86 or SPARC, if you want to build the driver yourself (there are precompiled drivers for SPARC Version 8, SPARC Version 9 and i386), use the commands:

   cd src/solaris/
   cd driver/
   make clean
   cd ..
   make

6') For x64 architecture (AMD64 or Xeon EM64T), build the driver with the commands:

   cd src/solaris/
   mv driver/Makefile driver/Makefile.old
   mv driver/Makefile-x64 driver/Makefile
   make
For 6) and 6') If you use the gcc compiler, please edit the Makefiles to make sure the correct switches are used. If you use the sunCC compiler, make sure the CC and CXX environment variables are set correctly:
   export CC=cc CXX=CC

7) Install the driver module using the command:

   cd driver/
   make install && make load
You may need to refresh the dynamic links in the /dev directory using the command:
devlinks

Check that module has been installed correctly using the prtconf command:

prtconf -D | grep quantis

2. Testing your PCI card:

Please refer to B.2.


*********************************************************************
Information in this document is subject to change without notice.
Copyright (c) 2004, 2005, 2006, id Quantique SA. All rights reserved.

id Quantique and Quantis are trademarks of id Quantique SA.