Home

Quantis User Guide

image

Contents

1. QuantisGetSerialNumber char QuantisGetSerialNumber QuantisDeviceType deviceType unsigned int deviceNumber Returns a pointer to the serial number string of the Quantis device Currently only the USB version supports serial number retrieval On PCI and PCI Express the string S N not available is returned The string S N not available is returned on failure as well Parameters deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 QuantisRead int QuantisRead QuantisDeviceType deviceType unsigned int deviceNumber void buffer size_t size Reads random data from the Quantis device This function perform an open a read of the requested data and close the device Returns QUANTIS_SUCCES on success or a QUANTIS_ERROR code on failure Parameters deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 buffer a pointer to the destination buffer The buffer MUST already be allocated Its size must be at least size bytes size the number of bytes to read cannot be larger than QUANTIS_MAX_READ_SIZE 51 D Q QuantisRead If bu fer is not allocated or the allocated size of memory is insufficient to store the data the library will deliver unexpected results and may even cause a crash of the en closing app
2. 5 4 5 QuantisGetModulesPower sssssssesesseseseneee e mene enses nens 57 5 4 6 QuantisGetModulesStatus ooccoccoconccoconccnconccnconccnconocnconacnconocnconacnconconos 58 5 4 7 QuantisModulesDisable oocoocococccnncncconncononcnnnncncnnconcnoncnnnnconnncncnnnnnnns 58 5 4 8 QuantisModulesEnable sessssssssssessssesese n emen eee 58 5 4 9 QuantisModulesReset orennnnnennvnnennennennennennennennennennennennennennennennennenee 59 5 5 Recompiling the Quantis Library esses Hm 59 5 5 1 Windows compilation with Visual Studio 2008 esses 59 5 5 2 Windows Compilation with Visual Studio 2010 sees 61 3 53 Linux Debian based iuris iii 63 5 5 4 Linux RedHat CentOS eee eee eere terere ee ve e Eve gv rb ener 63 5 3 3 E Te E OS MEE 64 5 5 6 Solaris OpenSolaris ravrnnnnnnnnnnvnnnvnnvvnnevnnernnernnerensvnnvrnnvennennvennvennvenee 64 33 1 d IDE 65 6 Quantis Library Wrappers sie iere i reete qe ine tee Dues oe dies ree eee e redes ee obe 67 6 1 The C 11 random device interface esses e ee emen 67 6 1 1 About the interface and our implementation esee 67 6 1 2 Library Compilation for C 11 osrernnnrnnnrnnnnerrrnvnnnnerennverrnevnnnnerernvenreern 68 6 1 3 C 11 Sample compilation 20 0 0 cece ence cee ca ceca ee ae een eeneeeeeeeeees 69 7 The QuantisExtensions Library
3. 93 94
4. a Quantis PCI or Quantis PCIe card a Quick Install Guide a USB Flash Drive with Manual Drivers and Samples If any item is found to be missing or damaged please contact your local reseller for replacement 2 1 2 Installing the Card 1 Shut down the computer unplug its power cord and remove the chassis cover 2 Locate the PCI 32 bits slot for Quantis PCI or the PCI Express x1 slot for Quantis PCIe If necessary remove the metal cover from this slot then align your Quantis card with the PCI or PCIe slot respectively and press it in firmly until the card is fully inserted Do Quantis USB Installation 3 Install the bracket screw and secure the card to the computer chassis 4 Cover the computer s chassis 5 Switch the computer power on 6 Install the driver see next Chapter 2 2 Quantis USB Installation 2 2 1 Unpacking Open the shipping carton and carefully remove all items and ascertain that you have aQuantis USB a USB cable e a Quick Install Guide a USB Flash Drive with Manual Drivers and Samples If any item is found to be missing or damaged please contact your local reseller for replacement 2 2 2 Installing the Device 1 Connect the Quantis device to a USB 2 0 port on your PC using the cable that came with the Quantis device 2 Install the driver see next Chapter Chapter 3 Driver Installation To be able to access your Quantis device you need to install a driv
5. 5 3 8 QuantisOpen int QuantisOpen QuantisDeviceType deviceType unsigned int deviceNumber QuantisDeviceHandle deviceHandle Open the Quantis device Returns QUANTIS SUCCI ERROR code on failure ES on success or a QUANTIS Parameters deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 deviceHandle a pointer to a pointer to a handle the device o QuantisClose This function has been implemented in the Quantis library version 2 10 5 3 9 void QuantisClose QuantisDeviceHandle deviceHandle Close the Quantis device Parameter deviceHandle Q a pointer to a handle the device This function has been implemented in the Quantis library version 2 10 5 3 10 QuantisReadHandled int QuantisReadHandled QuantisDeviceHandle deviceHandle void buffer size_t size Read data from Quantis This function expect QuantisOpen function has been called before 55 QuantisStrError Returns QUANTIS_SUCCES on success or a QUANTIS ERROR code on failure Parameter deviceHandle a pointer to a handle the device buffer a pointer to the destination buffer The buffer MUST already be allocated Its size must be at least size bytes size the number of bytes to read cannot be larger than QUANTIS_MAX_READ_SIZE o9 This function has been implemented in
6. Found New Hardware Wizard Completed When the wizard has finished installing the Quantis driver click the Finish button to exit the instal lation Reboot the computer if asked Windows Vista Do Found New Hardware Wizard Completing the Found New Hardware Wizard The wizard has finished installing the software for c Quantis LISB Click Finish to close the wizard lt Back Your Quantis device is now installed You can go to the next Chapter and install the application software 3 1 2 Windows Vista When the Quantis RNG is inserted into your computer for the first time the operating system will detect the device automatically and display a New Hardware Found message The following are step by step installation instructions o One or more intermediate dialog boxes may appear during the process stating Windows needs your permission to continue Click Continue to proceed User Account Control Es Windows needs your permission to continue Tf you started this action continue e 1 Device driver software installation Microsoft Windows V Details Continue User Account Control helps stop unauthorized changes to your computer 3 1 2 1 Found New Hardware Wizard Welcome Windows will search for a driver on your computer on removable media e g CD ROM and on the Windows Update Web site Let Windows try to locate the driver by clicking on Locate and install driver software CDa
7. UIC device registered at dev qrandom0 quantis_pci Driver loaded Found 1 card s If you update your kernel you must recompile and reinstall the driver 3 2 1 3 Auto load the Driver on Boot up Instead of using the modprobe command each time you want to load the driver you can let the system load the driver automatically on boot up 27 Do Quantis PCI and Quantis PCI Ex press Some distributions already load the driver on boot for each detected device if available To check if your system does this for you reboot your computer and run the command dmesg as explained in previous section If the driver has been loaded and all Quantis devices have been detected you can skip this section 3 2 1 3 1 Debian based Distributions To automatically load the driver on boot simply add the driver s name at the end of et c modules You can type the following command as root to add the entry L echo quantis pci etc modules 3 2 1 3 2 Red Hat Enterprise Linux and CentOS Distributions Red Hat Enterprise Linux checks for the existence of the etc rc modules file at boot time which contains various commands to load modules The following commands configure the loading of the quantis pci module at boot time as root echo modprobe quantis pci gt gt etc rc modules chmod x etc rc modules 3 2 1 3 3 Other Distribution Please consult your distribution s guide to know how to aut
8. Use this option to generate large amounts of random data or to generate data for later use On some systems Mac OS X Windows the temporary default directory is not very convenient and should probably changed to a better suited one This will ease the manipulation of the produced file from outside the EasyQuantis program 7 Select the amount of data to generate File size is limited to 2 GBytes 2147483647 bytes 8 Click the Generate button and wait while the application generates the random data 4 3 2 File extraction The File extraction tab allows to extract the randomness from a file File Help Quantis PCI 0 gt sl ol Acquisition Fie Extraction Extraction Matrix Size and filename of the extraction matrix Matrix Browse to select sue 1024x 768bis y a matrix file Matrix filename C Program Files ID Quantique SA EasyQuantis default ida matrix dat Raw data filename exu Browse to select Input file Extracted data filename a raw random file Output file Browse to define a file to save the extracted data Start randomness extraction processing Figure 4 2 EasyQuantis2 File extraction tab 42 Extraction matrix To extract randomness from a raw random file using EasyQuantis 1 Select a matrix size 2 Select a matrix file The file size must be greater or equal to the matrix size 3 Select the input file to process 4 Define an output file to save the extracte
9. iso image Once you ve mounted that image execute the program kit exe making sure that the kit is installed in the directory C WinDDK Installing the Boost C libraries From the website http www boostpro com download download the file boost 1 43 setup exe and run it to install Boost You should explicitly en able the libraries program options and filesystem libraries along with the standard distribution Installing Java Please refer to the Sample Code chapter section Java Installing QT As of April 2013 the precompiled Qt libraries cannot be used in VS2010 so they need to be build and configured from scratch To do this download the zipped Qt source package from the Qt download website as of April 2013 that is http download qt project org archive qt 61 Do Windows Compilation with Visual Studio 2010 62 Once it is unzipped go to the root directory of the unzipped folder In the Visual Studio 2010 command shell Start Programs Visual Studio 2010 then under Tools execute the command configure exe debug and release no webkit no phonon no phonon backend no script no scripttools no qt3support no multimedia no lteg to configure the Qt build It is important that you execute it in the VS2010 shell since itis configured in a particular way The options of the configure command make sure that some advanced features don t get built which would make the process take much longer
10. java net and http www oracle com technetwork java javase overview index html re spectively In addition to Java Apache Ant should be installed The Apache Ant website contains a user manual that explains how to install it on your system at the time of writing http ant apache org From here go to the section describing your OS Linux In order to be able to work with Java and Ant you need to add their binaries to the PATH system variable if they aren t there yet Additionally Java needs you to set the JAVA HOME variable You can set these variables as follows Open the file bashrc on some systems this may be called bash profile This is a script that will run automatically and set the variables in it for you so you won t need to set them by hand every time you open a new terminal In the file add the following entry on a separate line export PATH S PATH path to java bin directory lt path to ant bin directory gt To find out where your Java bin directory is type in your terminal which java which will result in something like usr bin java Your lt path to java bin directory gt is therefore usr bin The same procedure applies to finding your ant directory To apply the changes execute the command source bashrc To compile the Java samples the easiest solution is to Change to the directory where the Java samples are located cd lt path to quan
11. Since the Quantis device is kept open until the Quantis class is destroyed it is highly recommended to reduce the scope of the Quantis variable as much as possible In par ticular it is discouraged to make the Quantis variable global 6 1 The C 11 random_device interface 6 1 1 About the interface and our implementation The standard C 11 random_device interface allows to access true random number generators in a standarised manner It is derived from the boost random_device class so if your application uses either the C 11 or the boost version of the random_device class you can switch to Quantis very easily by including the Quantis implementation i e the file Quantis_random_device h in your code and commenting your previous include and making a very small number of changes described in the following At the time of releasing this interface C 11 is a very new standard Many compilers have already implemented parts of it but which parts are supported varies widely In order to avoid compile time issues the C 11 specific keywords have been commented and you should uncomment those that your compiler supports in order to be as compatible as possible Note that our implementation is a little different from the standard one in that the standard interface accesses a device mounted on the file system while we must create a Quantis C object and access 67 GB B Library Compilation for C 11 it to get to Quantis For t
12. Windows Vista Windows needs to install driver software for your Quantis USB Locate and install driver software recommended Windows will guide you through the process of installing driver software for your device gt Ask me again later Windows will ask again the next time you plug in your device or log on 9 Don t show this message again for this device Your device will not function until you install driver software 3 1 2 2 Found New Hardware Wizard Insert Disc When the wizard asks you to insert the disc that came with your Quantis USB choose don t have the disc Show me other options This allows you to specify the location of the driver available on the USB flash drive Insert the disc that came with your Quantis USB If you have the disc that came with your device insert it now Windows will automatically search the disc for driver software gt I don t have the disc Show me other options 3 1 2 3 Found New Hardware Wizard Search Location Select Browse my computer for driver software 10 Windows Vista Bo Windows couldn t find driver software for your device gt Check for a solution Windows will check to see if there are steps you can take to get your device working gt Browse my computer for driver software advanced Locate and install driver software manually On the next dialog click the Browse button and select the directory D Drivers Wi
13. You can now plug your Quantis USB device into your computer You can now check if your device works correctly with the Isusb command as following not as root 31 D Q Quantis USB s lsusb d 0aba 0102 v It is important not to run the Isusb command as root but as the standard user who will use the Quantis USB device Otherwise you won t be verifying that permission has been granted to you to access the device o If above command returns the message lsusb command not found then the command Isusb is not installed Install the usbutils package to fix the problem The output of above command should be similar to the following Bus 002 Device 035 ID 0aba 0102 Ellisys Device Descriptor bLength 18 bDescriptorType 38 bcdUSB 2 00 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor Ox0aba Ellisys idProduct 0x0102 bcdDevice 2 00 iManufacturer 1 id Quantique iProduct 2 Quantis USB iSerial 3 070001A410 bNumConfigurations TL Configuration Descriptor bLength bDescriptorType wTotalLength 2 bNumInterfaces bConfigurationValue iConfiguration bmAttributes 0x8 Bus Powered MaxPower 300mA Interface Descriptor bLength bDescriptorType bInterfaceNumber bAlternateSetting bNumEndpoints bInterfaceClass bInterfaceSubClass bInterfaceProtocol ilnterface Endpoint Descriptor bLength 7 bDescriptorType 5 bEndpointAddress 0x86 EP 6 IN bmAt
14. You may remove them if you need these features with the exception of the debug and release flag which must be set otherwise you cannot work in both Debug and Release mode in VS2010 with Qt With these flags compilation takes in the rough order of 10 15 minutes Once configure exe has finished run nmake setx DIDIB lt your Ut root directory and add your Qt root directory bin to your PATH environmental variable This can be done under Control Panel gt System Advanced gt Environment variables Choose or create the PATH variable in system variables and add the above mentioned path to it making sure that all entries are separated by a semicolon The nmake command is likely to take very long up to 20 minutes Now install the Qt Visual Studio Addin as described in Windows Computer Visual Studio 2008 Nokia QT Reboot and you re done If youre lucky you may be able to read all this up on the webpage http stackoverflow com questions 5601950 how to build qt for visual studio 2010 or from http doc qt nokia com 4 7 in stall win html from where it was copied and which provides snapshots of the entire procedure for easier reading It was available as of December 2011 Configuring Visual Studio The library and include file paths are the same as those for VS 2008 see the section above However since VS2010 does not support solution specific VC Directories you need to set these for each sin gle
15. click on Change settings The drivers for this device are not installed Code 28 To find a driver for this device click Update Driver Update Driver or Cama This will enable the Update Driver button Click on it 21 CDa Windows 8 H Quantis USB Device type Other devices Manufacturer Unknown Location Port_ 0002 Hub_ 0005 Device status The drivers for this device are not installed Code 28 To find a driver for this device click Update Driver 3 1 4 3 Quantis PCI device In the Control Panel click Hardware and Sound P 5 Control Panel Hardware and Sound C6 Search Control Panel Control Panel Home Devices and Printers System and Security as Adda Menor Advanced printer ima Mouse Device Manager Change Windows To Go start up options Network and Internet Hardware and Sound AutoPlay Change default settings for media or devices Play CDs or other media automatically Programs User Accounts and Family Sound E Safety Adjust system volume Change system sounds Manage audio devices Appearance and Power Options Personalisation Change power saving settings Change what the power buttons do Require a password when the computer wakes Change when the computer sleeps Ease of Access Choose a power plan Clock Language and Region Display Make text and other items larger or smaller Adjust screen resolu
16. dest directory install This will install all the Quantis libraries in your destination directory FreeBSD For FreeBSD the library is created and managed by the FreeBSD developers not by ID Quantique We can therefore not provide a recompilation procedure 65 66 Chapter 6 Quantis Library Wrappers IDQ provides several wrappers to allow you to use the Quantis device with your preferred program ming language Currently wrappers for the following languages are available e C CF Java VB NET The wrappers are for Object oriented programming languages and they all have the same structure e The class is named Quant is e On class instantiation you must provide the deviceType and the deviceNumber The names of public functions in the Wrappers are the same as those in the Quantis C library but without the prefix Quantis for instance Quant isCount is named Count in the wrapper Func tions other than the constructors do not require providing values for deviceType and devi ceNumber since these are defined globally within the class The only exception to this rule are static functions which have the same definition in both the C and the Wrapper code Please refer to the sample available with each wrapper for further details Furthermore Quantis can be accessed via the C 11 random_device interface which standardises true random number generator access Usage of this interface is described below
17. image Once you ve mounted that image execute the program kit exe making sure that the kit is installed in the directory C WinDDK Installing the Boost C libraries From the website http www boostpro com download download the file boost_1_43_setup exe and run it to install Boost You should explicitly en able the libraries program_options and filesystem libraries along with the standard distribution Installing Java Please refer to the Sample Code chapter section Java Installing Nokia QT 4 7 From the website http qt nokia com downloads Download the QT online installer you will need the Qt SDK Complete Development Environment Quantis has been tested with QT 4 7 3 and 4 7 4 ideally you should install one of these versions If your version is too new or too old and you find that you have problems with compiling or executing Quantis samples or applications you might have to update it or to roll back as appropriate From the same webpage install the QT Visual Studio Add in Configuring Visual Studio 59 Windows compilation with Visual Studio 2008 60 In the Menu Tools Options Select Projests and Solutions VC Directories Platform Win32 and Show Directories for Include files Add the next entries at the end of the list WinDDK 7600 16385 0 inc ddk WinDDK 7600 16385 0 inc api Program Files Java jdk1 6 0_25 include Program Files Java jdk1 6 0_25 include win32 Program Files boost B
18. install libboost threadl 42 dev sudo apt get install default jdk openjdk 6 jdk Xr 990909 4 Ur Now you can compile the library by executing the following commands cd lt path to Quantis gt Libs Apps mkdir build cd build cmake 5 5 4 Linux RedHat CentOS Prerequisites To compile the Quantis library you will need a certain number of packages Unless you have already installed them please execute the following commands yum install libusb 1 0 0 dev yum install cmake yum install libboost filesysteml 42 dev yum install libboost date timel 42 dev yum install libboost program options1 42 dev yum install libboost threadl 42 dev yum install default jdk openjdk 6 jdk Now you can compile the library by executing the following commands cd lt path to Quantis gt Libs Apps mkdir build ed build 63 Do Mac OSX 5 5 5 5 5 6 cmake m Mac OSX This procedure is extracted from the file lt path to Quantis gt Distribution MacOS Readme Prerequisites Apple Developer Kit Nokia QT libraries Boost version 1 42 C libraries e libusb 1 0 0 library To install it execute as superuser port install libusb At the time of writing this installs the correct version of the library but you should verify that it is indeed the 1 0 version that has been installed the version is usually shown on the command line during the installation process The
19. module assistant mod ule assistant aims to facilitate the process of building kernel modules from source Type following command as root to install module assistant L apt get install module assistant To download the headers corresponding to the current kernel and other mandatory tools simply run as root L m a prepare This command determines the name of the required kernel headers package installs it if needed and creates the usr src linuxsymlink if needed Also installs the build essential package to ensure that the same compiler environment is established All required software has been installed You can skip to Section 3 2 1 2 Compile and Install Driver 3 2 1 1 2 Red Hat Enterprise Linux and CentOS Distributions 26 To build kernel modules on Red Hat Enterprise Linux and CentOS distributions it is not necessary to download the entire kernel To build a module for the currently running kernel only the matching kernel devel package is required Run the following command to install the kernel devel package using yum yum install kernel devel Quantis PCI and Quantis PCI Ex Do e The previous command installs the kernel headers for the latest kernel available in the repository If your system is not up to date you need first to update the kernel and then boot the new kernel before installing the kernel devel package yum update kernel reboot yum install kernel deve
20. name Generates a file of floating point numbers arg designates the filename Sets the separator string for non binary files The default format is one entry per line Specify the minimal value for integers and floats If specified requires max to be specified as well Specify the maximal value for integers and floats If specified requires min to be specified as well Extraction capabilities in command line mode require at least EasyQuantis version 2 1 m matrix file arg I matrix size in arg O matrix size out arg 46 Set the path and the filename of the matrix file If not defined the extraction processing is disabled Set the input size in bits of the matrix 1024 per default Set the output size in bits of the matrix 768 per default Usage Examples D Q extraction from file If defined perform extraction processing from extraction in put file and save to extraction output file extraction input file Set the path and filename of a binary input file as the source arg for the extraction Must be defined if extraction from file is de fined extraction output file Setthe path and filename of a binary output file as source for the arg extraction Must be defined if extraction from file is defined 4 5 2 Usage Examples In this section you will find some usage examples of the EasyQuantis command line 4 5 2 1 List connected Quantis devices EasyQuan
21. point numbers Generates numbers between 0 0 inclusive and 1 0 exclusive 3 Select a data separator Comma separated values CSV CSV is a type of delimited text data which uses a comma to separate subsequent values The benefit of CSV is that they allow for the transfer of data across different applications The following is an example of CSV Valuel Value2 Value3 ValueN One entry per line Each value is on a separate line Valuel Value2 Value3 ValueN o 4 Optionally you can scale the random values to be within a smaller range When generating binary data you cannot select a data separator 41 File extraction For more details about the scaling algorithms please refer to section 5 3 7 2 1 Inte gral Values The Scaling Algorithm 5 Optionally you can enable the randomness extraction post processing Size Select the size of the matrix Matrix filename Select a matrix filename The size of the file must be greater or equal to the matrix size IDQuantique provide a default matrix located here Libs Apps Quantisi tensions default idq matrix dat Ex 6 Select the data destination Display Data is displayed on screen You can copy paste the data to your application Use this option for small amounts of random data that you want to use it right away This option is not available for binary data Save to file The data is written to a file
22. project To do that right click on each project choose Properties gt Configuration Properties gt VC Directories and enter the directories as above You need to update the path to the Qt libraries for the EasyQuantis Setup project if they don t point to the Qt libraries you ve built for VS2010 To do this you can either open the file EasyQuan tis Setup vdproj and edit the line pointing to QtCore4 dll QtGui4 dll manually or remove the files from the project in VS2010 by right clicking on them and choosing Remove and adding the correct versions by right clicking on the project and choosing Add File and choosing the correct version of the DLL Compilation Start Visual Studio and open the Quantis library solution file located in path to Quan tis NLibs Apps NQuantis Libs Apps sln In the build configuration select your architecture either Win32 or x64 Win32 architecture If are on a 32b machine you can directly perform build solution If the building of QuantisPci QuantisUsb Compat projects fails make sure that the Quantis project is listed as a prerequisite To do that right click on the solution then choose Properties gt Common Properties Project Depenencies Choose the project from the drop down list and add Quantis as a prerequisite Linux Debian based Ciba If you want to work on the Quantis wrapper samples don t forget to add the full path to Quantis lib to Properties gt Configuration Properties gt
23. serovenrvnerenrennvvvenvensennvennvenvenensrnevanevansvnesennvvnssnnuvennenr 71 TE el SEE EE O ii 71 TA Lo Baste Functions tinta 71 7 1 2 Advanced Functions eee eene nee nenne rhet ne n 73 8 Sample Go P 79 8 1 Windows Compilation Execution rernvnnnvnnnrnnernnerrnernnernnvrnnvnnnennvennvnnuennvennesnee 79 8 1 1 Visual Studio 2008 vs 2010 eiecit eroe cnn donaron sunno Proton seta Erneut 79 8 2 Linux Solaris OpenSolaris FreeBSD compilation and execution 79 3 Zal Mac OSA QE 80 825 AA de O 80 ol Sat pl EEE ti tail 81 815 Jaya Sample 2d An 82 A Troubleshootmp versan iia orita 85 Als BasyQuantis suser A aars dere ded 85 A 2 Quants Samples SEE 85 B Frequently Asked Questions FAQ sss eee ee mener 87 Ia mspruntal cse rS 87 B 2 EasyQuantis eher brit tete ida en ae 87 C Migrating to the New APL is oodscsssoseeesesevevetporceecteosises ied ai 89 C1 Compatibility Wrapper eee eet taken ee 90 D Notes M 91 DJs SIM AS CS ER 91 Bibliography cere ened deci io 93 List of Figures 4 1 EasyQuantis2 Acquisition tab s ccsscscsssssevovsrecsecoscsssosesscovenssessressesrensvsnesssenenes 41 4 2 EasyQuantis2 File extraction tab sess nennen men mener nee 42 4 3 EasyQuantis2 Extraction matrix tab ooooccnnccnnconnconccnnccnnononcnnnc
24. to a char array representing the path and the filename of the input file to process outputFilePath a pointer to a char array representing the path and the filename of the output file to save the data after extraction Advanced Functions Do extractorMatrix a pointer where the matrix is stored in memory 7 1 1 6 QuantisExtractorGetDataFromBuffer void QuantisExtractorGetDataFromBuffer const uinte t inputBuffer Pace OUEpUEBUr EST const uint64_t extractorMatrix uint32_t nbrBytesAfterExtraction Apply randomness extraction to data stored in an input buffer in the memory and put the result in an output buffer in memory Parameters inputBuffer a pointer to an allocated input buffer outputBuffer a pointer to an allocated output buffer extractorMatrix a pointer where the matrix is stored in memory nbrBytesAfterExtraction the number of processed bytes which should be produced 7 1 1 7 QuantisExtractorStrError 7 1 2 7 1 2 1 char QuantisExtractorStrError QuantisExtractorError errorNumber Reads the extractor matrix from the specified file and store in memory This function allocate the required memory space Use QuantisExtractorUnitializeMatrix to free memory Return a pointer to an array representing an human readable error message Parameters errorNumber The error number Advanced Functions This section introduces advanced functions that allow more control more finely If yo
25. 1 1 What You Need To use your Quantis you need e A PC with a supported operating system installed see Table 1 1 Supported operating systems and one of the following slots ports available A PCI 32 bit slot for Quantis PCI A PCI Express x1 slot for Quantis PCI Express e A USB 2 0 port for Quantis USB A USB 2 0 port for the USB Flash drive 50MB hard drive space Operating System Quantis PCI PCIe Quantis USB Microsoft Windows XP 32 bit Microsoft Windows XP 64 bit Y Y Microsoft Windows Server 2003 e Microsoft Windows Vista 32 bit and 64 bit Microsoft Windows Server 2008 32 bit and 64 bit Microsoft Windows 7 32 bit and 64 bit Microsoft Windows 8 32 bit and 64 bit Linux 2 6 3 32 bit and 64 bit Solaris OpenSolaris X FreeBSD Do Additional Requirements Operating System Quantis PCI PCIe Quantis USB Mac OS X o 2 Table 1 1 Supported operating systems 1 1 1 Additional Requirements 1 1 1 1 Linux On Linux systems you additionally need Xorg 1 0 or higher only required to use the EasyQuantis application Chapter 2 Hardware Installation This chapter provides unpacking and installation information for Quantis 2 1 Quantis PCI and PCI Express Installation O Under ordinary circumstances the Quantis PCI and Quantis PCI Express PCIe cards will n
26. 32 t inputBufferSize PENE e Oti aver The function initializes an output buffer in order to contain the result of the extraction of an input buffer of inputBufferLength bytes Use QuantisExtractorUninitializeOutputBuffer to free memory Return the number of bytes that should be obtained after the extraction a QUANTIS_EXT_ERROR otherwise Parameters inputBufferSize the number of bytes contained in the input buffer outputBuffer a pointer to a pointer where the output buffer is stored in mem ory 7 1 2 5 QuantisExtractorUninitializeOutputBuffer void QuantisExtractorUninitializeOutputBuffer uint8 t outputBuffer This function free the memory allocated by QuantisExtractorInitializeOutputBuffer Parameters outputBuffer a pointer to a pointer where the output buffer is stored in mem ory 7 1 2 6 QuantisExtractorProcessBlock 74 void QuantisExtractorProcessBlock const uint64 t inputBuffer uint64 t outputBuffer const vints _t extractorMatrix Apply extraction processing function to a block of matrixSizeIn bits and produce matrixSizeOut processed bits Parameters inputBuffer a pointer to the input of the extractor Advanced Functions outputBuffer extractorMatrix a pointer to the output of the extractor a pointer where the matrix is stored in memory 7 1 2 7 QuantisExtractorMatrixCreate int32_t QuantisExtractorMatrixCreate uint32 t nbrElementaryMatrices uint32 t nb
27. 7 1 2 14 QuantisExtractorStorageBufferSet Set the first bytesToCopy bytes of the storage buffer to the bytesToCopy bytes pointed by bufferToCopy Any data previously written in the storage buffer will be overwritten If the buffer to copy is bigger than MAX STORAGE BUFFER SIZE extra data will be dropped int32 t QuantisExtractorStorageBufferSet uint8 t bufferToCopy uint32 t bytesToCopy Returns always QUANTIS SUCCESS Parameters bufferToCopy pointer to the buffer which should be copied into the storage buffer bytesToCopy number of bytes in buf fer ToCopy to be copied into the stor age buffer 7 1 2 15 QuantisExtractorStorageBufferAppend Append bytesToAppend bytes of the buf ferToCopy to the storage buffer Existing data in the storage buffer will be preserved Please note that appendable bytes are limited by MAX STORAGE BUFFER SIZE ie bytes are appended as long as the storage buffer is not full int32 t QuantisExtractorStorageBufferAppend uint8 t bufferToCopy Unies 2D yes lo Copy Return the number of actually appended bytes Parameters bufferToCopy pointer to the buffer which should be copied into the storage buffer bytesToCopy number of bytes in buf ferToCopy to be copied into the stor age buffer 7 1 2 16 QuantisExtractorStorageBufferRead Read numberOfBytesRequested bytes from the storage buffer int32 t QuantisExtractorStorageBufferRead uint8 t outputBuffer
28. Ciba Quantis User Guide Version 2 10 Quantis User Guide Version 2 10 Information in this document is subject to change without notice Copyright O ID Quantique SA 2004 2013 No part of this publication may be reproduced stored in a retrieval system or transmitted in any form or by any means electronic mechanical photocopying recording or otherwise without the written permission of ID Quantique SA Trademarks used in this text Intel Intel Inside logos MMX and Pentium are O trademarks of Intel Corporation in the United States and other countries Java and all Java based trademarks are trademarks of Oracle Inc in the United States and other countries Linux is a O trademark of Linus Torvalds in the United States and other countries Mac Mac OS and Macintosh are trademarks of Apple Computer Inc registered in the U S and other countries Microsoft Windows Windows NT XP Visual Studio and the Windows logo are O trademarks of Microsoft Corporation in the United States and other countries UNIX is a registered trademark of The Open Group in the United States and other countries Other trademarks and trade names may be used in this document to refer to either the entities claiming the marks and names or their products ID Quantique SA disclaims any proprietary interest in trademarks and trade names other than its own The use of the word partner does not imply a partnership relationship between ID Qua
29. Cocoa application To bypass this problem a small Cocoa program has been written to load the actual EasyQuantis program Since all the Cocoa applications are Mac OS X bundles the actual program is located inside the subdirectory 1ibexec of the application bundle with the name EasyQuantis the Cocoa wrapper is located in the subdirectory MacOS with the name EasyQuantis By using this trick the EasyQuantis has the standard behaviour of a Cocoa application It would have perhaps been possible to modify the main source of the EasyQuantis application but this solution would have make the portability across platforms more complicated and the wrapper solution has been preferred It is generally not possible to link statically all the libraries on Mac OS X since most of the standard system libraries are provided only as dynamic libraries To achieve a static linking as complete as possible one has to do e add explicitly the name of the library i e opt 1ocal lib libusb 1 0 2 to the list of objects otherwise the Mac linker when static and dynamic libraries are available prefers dynamic libraries 34 bundle is a directory with a specific organisation containing all what is needed to run the application icons resources menu documentation and naturally the program itself 34 Known problems D Q add the correct parameters to the linker which otherwise do not link with the system dynamic li braries For instance the following par
30. EO eno EID 49 2 1 Library location pei tt rrt dete EE Pa Ere Ere OO Te RUE Eve EU d rerit 49 3 2 Device Type i ione eS intet eter re dere bree hie bis 49 25 9 Basic Functions coe Non error ERE TER RAPERE PRESE ERR EUR an RET 50 5 31 QuantisCo nt EDIDI eii e I tee E qe E es 50 5 3 2 QuantisGetDriverVersion sess eene eee eene 50 5 3 3 QuantisGetLib Version essan r a e e aa a A ES 50 3 3 4 QuantisGetManUfactUTe crias 50 5 3 5 QuantisGetModulesDataRate sss eme eene 51 5 3 6 QuantisGetSerialNumber sss eene 51 5 37 Quants Re d e r r E eres eI P Ve PETERS 51 5 3 8 QuantisOpen essei terere regere Hore eie er p dets 55 Do vi 5 3 9 QuantisClose sesssssssssssesssssssseeeeee esee eese emere sese hern e eren ene 55 5 3 10 QuantisReadHandled 0 cc ccc ccc cence cee eene cece en eens eseeeeeeeneaeeneneenens 55 5 3 11 QuantisStrError 2 0 0 cece ccc cece cece eee e cence eee emen eene sense eee senes 56 5 4 Advanced Functions eese esteem rta e ese rene cove eee nea e 56 5 4 1 QuantisBoardReset ssssssssssssssesssseesse enne enemies seen 56 5 4 2 QuantisGetBoard Version rernvnnernvnnennvnrernennennennennennennenrennennennennennenner 56 5 4 3 QuantisGetModulesCount ocococcnccocncononcnnoncncnncononcncnnoncnnnncnroncnnnnonannonnns 57 5 4 4 QuantisGetModulesMask ccccceceececeecee nese cee eeeee mee eee eene 57
31. For the C and C samples type cd lt path to quantis gt Samples lt chosen language gt make qrng lt device type gt lt device number gt Wow device type is u if you re using a Quantis USB and p if you re using a PCI PCIe device 79 Mac OSX For the Java sample see the section Java Sample below The C 11 sample can in principle be executed similarly to the C sample but if you use it with the library provided it will be executed as normal C code To use the actual C 11 features you would need to recompile the Quantis library Further details on how to do this can be found under the section The C random_device interface 8 2 1 Mac OSX The VB Net and Cft samples can of course not be compiled on Mac OSX systems For the C and C samples type cd lt path to quantis gt Samples lt chosen language gt make OS Darwin qrng lt device type gt lt device number gt device type is u if you re using a Quantis USB and p if you re using a PCI PCle device For the Java sample see the relevant section below The C 11 sample can in principle be executed similarly to the C sample but if you use it with the library provided it will be executed as normal C code To use the actual C 11 features you would need to recompile the Quantis library Further details on how to do this can be found under the section The C random_device interface 8 3 C Sample The fol
32. Linker gt Input gt Additional Dependencies x64 architecture If you are on a 64b machine you must make sure that not all projects of the solution are selected because not all projects can compile in this case It is easiest if you proceed as follows In the solution explorer select the next project Quantis Quantis NoHw QuantisP ci compat QuantisUSB compat with your mouse and then click build The EasyQuantis can not be compiled in 64 bits due to Qt is only 32 bits If the building of QuantisPci QuantisUsb Compat projects fails make sure that the Quantis project is listed as a Project dependency To do that in Visual Studio 2008 right click on the solution then choose Properties gt Common Properties gt Project Depenencies Choose the project from the drop down list and add Quantis as a prerequisite If you want to work on the Quantis wrapper samples don t forget to add the full path to Quantis lib to Properties gt Configuration Properties gt Linker gt Input gt Additional Dependencies 5 5 3 Linux Debian based Prerequisites To compile the Quantis library you will need a certain number of packages Unless you have already installed them please execute the following commands sudo apt get install libusb 1 0 0 dev sudo apt get install cmake sudo apt get install libboost filesysteml 42 dev sudo apt get install libboost date timel 42 dev sudo apt get install libboost program optionsl 42 dev sudo apt get
33. Search Location First select Search for the best driver in these locations Then activate the option Include this location in the search Click the Browse button and select the directory containing the right driver for your device For the Quantis PCI and Quantis PCIe select D Drivers Windows QuantisPci For the Quantis USB select D Drivers Windows NQuantisUsb Click the Next button to validate Do Windows XP Found New Hardware Wizard Please choose your search and installation options SS Y Search for the best driver in these locations Use the check boxes below to limit or expand the default search which includes local paths and removable media The best driver found will be installed Search removable media floppy CD ROM IV Include this location in the search D Drivers Windows QuantisUsb Browse C Don t search will choose the driver to install Choose this option to select the device driver from a list Windows does not guarantee that the driver you choose will be the best match for your hardware lt Back Cancel 3 1 1 4 Found New Hardware Wizard Installation Wait while the wizard installs the Quantis driver Found New Hardware Wizard Please wait while the wizard installs the software Da y Quantis USB Ld Ll Setting a system restore point and backing up old files in case your system needs to be restored in the future Cancel 3 1 1 5
34. To easily access the Quantis device from your application IDQ provides an abstraction library for all supported operating systems The library allows you to easily write your multi platform application without knowing how the Quantis devices internally works API changed with Quantis library version 2 0 If your application uses a previous Quantis library version please read the Appendix C Migrating to the New API Each time you request an operation the Quantis library 1 Opens the Quantis device 2 Performs the requested operation 3 Closes the Quantis device The C library wrapper has been optimized to open the Quantis device in the class constructor and close it in the class destructor thereby leaving the connection to the device open throughout the entire execution If your application is written in C it is suggested to use the C wrapper rather than the C wrapper Please read Chapter 6 Quantis Library Wrappers for further information 5 1 Library location You can find the library files Quantis so Quantis dll Quantis lib in the following path lt path to quantis gt Packages Windows lib lt your system arch gt for Windows users or for Linux users after decompressing lt path to quantis gt Packages QuantisRNG lt version gt Linux lt your system arch gt tar gz under QuantisRNG lt version gt Linux lt your system arch lib If you recompile your libraries yourself as described in
35. Update Web site The Quantis driver is not available on the Windows Update Web site If asked deny access to the Windows Update Web site and click the Next button D Q Windows XP Found New Hardware Wizard Welcome to the Found New Hardware Wizard Windows will search for current and updated software by looking on your computer on the hardware installation CD or on the Windows Update Web site with your permission Read our privacy policy Can Windows connect to Windows Update to search for software Yes this time only Yes now and every time connect a device No not this time Click Next to continue Back Cancel It is harmless to allow the wizard to connect to the Windows Update Web site The only effect is that the installation process will take a little longer 3 1 1 2 Found New Hardware Wizard Quantis When the wizard asks you what to do to install Quantis software select Install from a list or specific location and click the Next button Windows XP D Q Found New Hardware Wizard This wizard helps you install software for Quantis USB If your hardware came with an installation CD I or floppy disk insert it now What do you want the wizard to do C Install the software automatically Recommended Install from a list or specific location Advanced Click Next to continue lt Back Cancel 3 1 1 3 Found New Hardware Wizard
36. a block of matrixSizeIn bits and produce matrixSizeOut processed bits Return the number of bytes at the output of the Von Neumann processing Parameters inputBuffer outputBuffer inputBufferSize a pointer to the input buffer to process a pointer to the output buffer The buffer should be already ini tialized by the function which invokes this method please note that the number of bytes that will be output by the Von Neu mann processing is not deterministic as it depends on the input sequence but it can never exceed 1 2 of the input buffer size the size of the input buffer 7 1 2 11 QuantisExtractorStorageBufferEnable T Enable the storage buffer and allocate MAX STORAGE BUFFER SIZE bytes for it int32_t QuantisExtractorStorageBufferEnable Returns QUANTIS SUCCESS if enabling is successful QUANTIS EXT ERROR otherwise 7 1 2 12 QuantisExtractorStorageBufferDisable 76 Disable the storage buffer if it was previously activated and free the allocated memory int32 t QuantisExtractorStorageBufferDisable Returns QUANTIS SUCCESS if enabling is successful QUANTIS EXT ERROR otherwise Advanced Functions Do 7 1 2 13 QuantisExtractorStorageBufferClear Reset the storage buffer free and reallocate memory int32_t QuantisExtractorStorageBufferClear Returns QUANTIS SUCCESS if enabling is successful QUANTIS EXT ERROR otherwise
37. aforementioned libraries should ideally be compiled statically but if this is not possible you can still proceed with the Quantis library compilation Compilation The compiler to use E g to use clang set export CC Developer usr bin clang export CXX Developer usr bin clang The path to the QT libraries should be added to the PATH environment variable export PATH PATH lt path to QT gt gtx y z bin PATH Now you can create the package Create the build directory as follows Make sure the following variables are configured cd lt path to Quantis gt Libs Apps mkdir build cd build If the libraries listed above under Prerequisites have been compiled statically execute the following commands cmake make Otherwise execute cmake DUSE DYNAMIC LIBS 1 make Solaris OpenSolaris Prerequisites In order to be able to compile the Quantis libraries you need the following packages libusb 1 0 0 FreeBSD 5 95 7 CMake e libboost filesystem1 42 dev e libboost date time1 42 dev e libboost program options1 42 dev e libboost program options1 42 dev Java JDK Compilation To compile the Quantis libraries choose your library destination directory e g opt quantis and execute cd usr local Quantis mkdir build cd build cmake DDISABLE QUANTIS USB 1 DDISABLE EASYQUANTIS GUI 1 mkdir tmp quantis make DESTDIR your
38. allation procedure description under Linux Revision 2 1 26 04 2010 Added an EasyQuantis command line section Added answers in the FAQ Revision 2 0 09 04 2010 nitial version Table of Contents T Introduction sa rutet dekar irrita amt eras ici nie 1 1 1 What Yow Need A PA ONE oP EATS 1 1 1 1 Additional Requirements ere Naa ains 2 2 Hardware Install EL PARURE ERE e asustes 3 2 1 Quantis PCI and PCI Express Installation ooocococcnoconccnnccnnocnnccnoronccnnccnnconnccnncono 3 2 1 1 Unpacking sosser iii e iS 3 2 12 Installing the Card cios esp esse sveangsveosiess ssossesheesesedssvetesdseveibesssepteageoed eons 3 2 2 Quantis USB Installation 2 0 00 0 ccc cece cnc ec ee ce cece E eee ee mee e mener 4 2 2 I1 Unpackimng sen oerte ether et pibe eter 4 2 2 2 Installing the Device vesens Geeks 4 3 Driver Installationz 5e oe ers 5 3 1 Windows Operating Systems rrrvrnnnrnnernnvrnnvnnnvnnnvnnvennvnnnvnnevnreraneranevanevnnsnnnsenver 5 Sel Le Windows XP tri adn plat ve ERE uaa En 5 3 1 2 Windows Vista eiie A ederet edo deser eter OUR Eos 9 3 1 3 WindOWSs esses rtr Gre DOKNR 13 314 unu Em 18 32 Linux Operating System iet Rp Ee detener re e Exe et Ree Petes 25 3 2 1 Quantis PCI and Quantis PCI Express eee 26 32 2 00 ntus USB cs con e eer eer ES 30 3 3 Mac OS X Operating System oooconoconoconocnnocnnocnncnnnronoro
39. ame of the package your code resides in is used to define the name of func tions in that package So if you change the package name say to random quantis the function names will change in the Java code but not match the native code function names anymore and thus produce errors The best solution is to keep the original name com idquantique quantis for the package If you absolutely need the Java code in another package change the two files Libs Apps Quantis Quantis_Java h and Libs Apps Quantis Quantis_Java cpp to reflect the new package name in function names After the modification the dynamic Quan tis library has to be recompiled and reinstalled B 2 EasyQuantis B 2 1 On Microsoft Windows when I launch EasyQuantis I have the error The application has failed to start because WINUSB DLL was not found Re installing the application may fix this problem What should I do This problem occurs with EasyQuantis 1 0 when the Quantis USB driver is not installed This issue has been fixed in EasyQuantis 1 1 Please update EasyQuantis to the latest available version 87 Do EasyQuantis B 2 2 When I launch EasyQuantis on Microsoft Windows a console appears for a few seconds and disappears when the GUI window comes up Why does this happen EasyQuantis integrates a command line interface and a graphical interface However on Mi crosoft Windows it is not possible to build an hybrid Windows Console application EasyQuan t
40. ameters have been added when invoking the compiler on command line in order to link the Quantis library framework IOKit framework CoreFoundation lSystem 3 3 5 Known problems The following problems have been noticed the progress bar do not work while the application EasyQuantis acquires random data from the Quantis device the actual EasyQuantis command located in opt IDQQuantis bin do not work correctly in graphical mode This problem arise only when the qt library is statically linked in the program It is caused while some additional files for displaying graphic widgets are not found The problem do not exist when the application is used inside an application bundle or if a framework containing the necessary resources for the qt library is installed in the system 3 4 Solaris OpenSolaris Install the package containing the drivers by typing the command after uncompressing the package pkgaad d path to quantis Psckages Solaris Sparc IDOpcidrv 2 1 solil0 sparc 3 5 FreeBSD On FreeBSD first install the Ports package Then execute cd usr ports security quantis kmod make make install to execute the provided makefile A framework on Mac OS X is a bundle containing a dynamic library and all its resources header files static and dynamic libraries docu mentation etc 35 36 Chapter 4 The EasyQuantis application Quantis is delivered with the EasyQuantis applicat
41. andom Number Generator Windows has successfully updated your driver software Windows has finished installing the driver software for this device H Quantis USB Random Number Generator Your Quantis device is now installed You can go to the next Chapter and install the application software 3 1 4 Windows 8 When the Quantis RNG is inserted into your computer for the first time the operating system will detect the device automatically and search the Windows Update Web site for a driver Installing device Please wait while Setup installs necessary files on your system This may take several minutes Since the driver for your Quantis device is not available on this site this search will fail and you will have to manually point Windows to the driver The Device Setup windows may appears for a short time and will close automatically 3 1 4 1 Open Windows settings Point the mouse to the upper right corner of the screen A side menu will appears click Settings 18 Windows 8 Do REE y fa D Tuesday 8 3 April 16 Ba O Then click Control Panel pen Settings Control Panel Personalisation PC info Help 100 Unavailable 0 ENG Power SF Change PC settings Quantis PCI may not be listed here In this case click Hardware and Sound then click on Device Manager An unknown PCI device must be listed 3 1 4 2 Quantis USB device In Hardware and Sound select View de
42. ary within a 32 bit application on 64 bit systems Note however that you can neither use the 32 bit Quantis library within a 64 bit application nor the 64 bit Quantis library within a 32 bit application 2 On Microsoft Windows is it necessary to copy the Quantis d11 library to the system di rectory C Windows System32 No this is not mandatory IDQ recommends to install the Quant is d11 library in the di rectory in which your application resides On Microsoft Windows when I use Quant is d11 within my application I get the error The application has failed to start because WINUSB DLL was not found Re installing the application may fix this problem What should I do This problem occurs with Quantis dll v2 1 and older when the Quantis USB dri ver is not installed This issue has been fixed in Quantis dll v2 2 Please update your Quantis dll to the latest available version I have changed the name of the Java package Java for Quantis from com idquantique quantis to something else I have moved the Java code to another directory Now I can load the dynamic library Quantis dll butI get the error message Exception in thread main java lang UnsatisfiedLinkError random utils Quantis QuantisCount DI The Java classes use mainly native functions by using the JNI interface A native function has to obey to strict rules and if you don t abide by them your application may not execute or compile properly For instance the n
43. ave at least 2 elementary matrix file To create an extraction matrix 43 Do Using EasyQuantis 1 x other OS 1 Select a list of the elementary files with the and buttons 2 Define an output matrix filename 3 Click create matrix 4 4 Using EasyQuantis 1 x other OS Figure 4 4 EasyQuantis main window shows the main window of the EasyQuantis application On some systems when the application has been downloaded from Internet one may have to acknowledge that fact on first use List of Quantis devices Update the list Display information about found on the system of Quantis devices selected Quantis device S EasyQuaritis File Help edidi Quantis USB 0 S N 070001A410 2 random data Data format amp Create binary data Create integer numbers Data separator for O Create floating point numbers non binary data OMA Minimal and maximal value for non binary data Scale data between 0 and 1 Data destination 9 Save to file tmp random dat Lm Amount of random data in bytes to read 1024 al 1 0Kbyte Generate Quantity of random data to generate Launches random data generation Figure 4 4 EasyQuantis main window To generate random data using EasyQuantis 1 Select a Quantis device from the list 2 Select a data format Binary data Data is read from the Quantis and returned as bytes Integer numbers Generates 32 bit random n
44. b 1 0 If the package is not available please refer to Section 3 2 2 1 4 Manually Compile libusb 1 0 3 2 2 1 4 Manually Compile libusb 1 0 If library libusb 1 0 can not is not available on the list of packages in the package manager of your distribution you can easily compile it by hand First you need to download the library s sources Go to the address http sourceforge net projects libusb files libusb 1 0 and download the latest version Open the Terminal application and change the working directory to the one containing the down loaded libusb 1 0 archive Unpack the archive and compile the library replace x with your version number Sotarcxvgt libusb 1 04 Lab bza amp eel istiomsiosi 0 x configure prefix usr make When the library has been compiled install 1t with the following command as root make install 3 2 2 2 Modify the Device s Permissions By default the Quantis USB device is accessible only to user root UDEV the device manager for the Linux 2 6 kernel series must be instructed to allow other users to access the Quantis Please follow instructions on Section 3 2 1 4 Modify the Device s Permissions y If the Quantis USB device was already plugged in before the reloading of the udev rules please unplug and replug the Quantis device otherwise it will have the wrong permis sions 3 2 2 3 Check Your Device All requirements have been installed
45. ble max Reads a random floating point value between 0 0 inclusive and 1 0 exclusive The scaled ver sions read a random floating point value between min inclusive and max exclusive Returns QUANTIS_SUCCES on success or a QUANTIS_ERROR code on failure Parameters deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 value a pointer to the destination value min the minimal value that the returned numbers can take max the maximal value that the returned number can take Floating point values are computed by dividing a random integral value 32 bit for pet respectively floats and 64 bit for doub1e by the integral s value range 2 and pe In certain conditions the distribution of numbers produced by the floating point scal ing algorithm has a small bias that favours numbers at the lower end of the output range If you need unbiased random numbers please consider to use Quant isRead ScaledShort or QuantisReadInt instead Example how to generate a random number between 1 001 and 75 5 inclusive Xu QuantisOpen float min ESO float max 75598 float multiplier 1000 0 Gesner if QuantisReadScaledInt deviceType deviceNumber amp rndInt boue ba 9 squliEstsE sues Ene mass 79 mpubeso lis 0 Handle error j float randomValue float rndInt multiplier
46. both include file configurations Then again in both the include file configs arrange the headers in the following order C WinDDK 7600 16385 0 inc ddk VCInstallDir include VCInstallDir atlmfc include C WinDDK 7600 16385 0 inc api Ci WinDDK 7600 16365 0 ine crt C Program Files Java jdk1 6 0_25 include C Program Files Java jdk1 6 0_25 include win32 C Program Files boost Boost_1_43 WindowsSdkDir include FrameworkSDKDir include The ordering of header files is important since they are read sequentially It s important to make sure that the right ones are read first in the cases where different directories contain duplicates If the C sample crashes and you get an Access Violation error restart VS2008 in administrator mode since there is some memory that cannot be accessed by a normal user To do that right click on the VS2008 icon and choose Run in administrator mode Windows Compilation with Visual Studio 2010 Gio 5 5 2 Compilation Start Visual Studio and open the Quantis library solution file located in lt path to Quan tis NLibs Apps NQuantis Libs Apps sln In the build configuration select your architecture either Win32 or x64 Win32 architecture If are on a 32b machine you can directly perform build solution If the building of QuantisPci QuantisUsb Compat projects fails make sure that the Quantis project is listed as a prerequisite To do that right click on the solution t
47. ck on the Quantis device with the right mouse button Select Properties on the menu boa GU ES Hard Devices and Pri v 64 Search Devices and Printers L Add a device Add a printer Troubleshoot 4 Unspecified 1 Create shortcut ntis L Troubleshoot Properties Status Needs troubleshooting 3 1 3 2 Quantis Properties Hardware In the Quantis Properties dialog click on the Hardware tab and then on the Properties button 14 Windows 7 Device Function Summary Manufacturer Unknown Location Port_ 0001 Hub_ 0002 Device status The drivers for this device are not installed Code 28 3 1 3 3 Quantis Properties Update Driver First click on the button Change settings Port_ 0001 Hub_ 0002 Device status The drivers for this device are not installed Code 28 There is no driver selected for the device information set or element To find a driver for this device click Update Driver Update Driver This will enable the Update Driver button Click on it 15 CDa Windows 7 The drivers for this device are not installed Code 28 There is no driver selected for the device information set or element To find a driver for this device click Update Driver 3 1 3 4 Update Driver Software Search Driver Driver is available on the USB flash drive provided Select Browse my computer for dri
48. d data 5 Click the Process button and wait while the application generates the random data Randomness extraction algorithm is based on 64 bits integers Using a 64 bits platform allows significant higher speed processing 4 3 3 Extraction matrix The Extraction matrix tab allows to create your own extraction matrix file List of Quantis devices found on the system List of Quantis devices found on the system List of Quantis devices found on the system Browse to define file to save the random data 2 0 The size of the matrix Acquisition Fie Extraction Extraction Matrix Elementary Matrix Browse to define The filename of the Under sampling period 13 7 bytes elementary matrix Create Elementary Matrix Start elementary matrix file creation Input Elementary matrix fies List of elementary matrix filenames to use to create the matrix The filename of the matrix to create Start matrix file creation Figure 4 3 EasyQuantis2 Extraction matrix tab To create an elementary matrix 1 Select a Quantis device from the list 2 Select the matrix size 3 Select the the under sampling period Recommended value is 13 bytes 4 Define an elementary matrix filename 5 Click Create elementary matrix an elementary matrix filename Add or remove files to the list Browse to define a file to save the matrix Repeat this operation in order to h
49. device has been found on the system cout lt lt No Quantis device ound lt lt endl return ils Creates a quantis object Quantis quantis deviceType 0 Read random data from the Quantis string buffer quantis Read NUM BYTES if buffer length NUM_BYTES Quantis did not return the number of bytes asked cerr lt lt Asked to read lt lt NUM_BYTES lt lt byts but received lt lt buffer length lt lt bytes lt lt endl return 112 Display buffer in HEX format cout lt lt Displaying lt lt NUM BYTES lt lt random bytes in HEX format lt lt endl string iterator it buffer begin while it buffer end cout lt lt setw 2 lt lt setfill 0 lt lt hex Za Statie Cast Gmie stat ucmocasit lt unsmonecdmehiais FEN lt lt n cout lt lt endl return 0 catch runtime error amp ex cerr lt lt Error while accessing Quantis device lt lt ex what lt lt endl return 13 8 5 Java Sample 82 Install Java and Apache Ant All OS Java Sample D Q To use the Java wrapper install the Java Standard Edition JSE JDK matching your OS For in stance the Java SE 64 bits JDK should be installed with a Windows 64 bits You will find the JSE JDK in all available versions and a detailed installation instruction on the website of OpenJDK or on the webpage of Oracle at the time of writing this guide http openjdk
50. e PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 QuantisGetModulesCount int QuantisGetModulesCount QuantisDeviceType deviceType unsigned int deviceNumber Returns the number of modules that have been detected on a Quantis device or a QUANTIS_ERROR code on failure Parameters deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 QuantisGetModulesMask int QuantisGetModulesMask QuantisDeviceType deviceType unsigned int deviceNumber Returns a bitmask of the modules that have been detected on a Quantis device or a QUANTIS_ERROR code on failure Bit n is set in the bitmask if module n is present For instance 5 1101 in binary is returned when modules 0 2 and 3 have been detected Parameters deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 QuantisGetModulesPower int QuantisGetModulesPower QuantisDeviceType deviceType unsigned int deviceNumber Returns the power status of the modules on a device Returns 1 if the modules are powered 0 if the modules are not powered and a QUANTIS_ERROR code on failure o This function is useful only for Quantis USB devices Modules of Quantis PCI devices are always powered thu
51. eType deviceType void buffer unsigned int deviceNumber unsigned int size WOO burter 89 Compatibility Wrapper API 1 x functions API 2 0 functions size Blue Table C 1 API 1 x and 2 0 functions equivalences C 1 Compatibility Wrapper IDQ provides a compatibility wrapper that allows you to use the old API with the new library This is meant to facilitate the migration of your application to the new API It is highly recommended to update your application to the new API as soon as possible To use the compatibility wrapper define QUANTIS DEVICE TYPE and then include Quan tis Compat h instead of quantis h and recompile your application Define Quantis type set QUANTIS DEVICE TYPE to 1 for Quantis PCI PCIe set QUANTIS_ DEVICE TYPE t 2 for Quantis USB A define QUANTIS DEVICE TYPE 1 Includes compatibility wrapper include Quantis Compat h O On Microsoft Windows systems you can try to rename QuantisPci Compat dll to Quantis dll or Quant isUsb Compat dl1l to Quantis Usb d11 and re place your old library with the renamed one This way you normally do not need to re compile your application 90 Appendix D Notes D 1 Images Some images used in this manual and in the Quantis software are from VistaICO com 91 92 Bibliography Websites USB Official USB website http www usb org
52. er short value short min short max int QuantisReadInt QuantisDeviceType deviceType unsigned int deviceNumber 52 QuantisRead D Q int value int QuantisReadScaledInt QuantisDeviceType deviceType unsigned int deviceNumber int value THE LA int max Reads a random 16 bit or 32 bit integral value Returns QUANTIS_SUCCES on success or a QUANTIS_ERROR code on failure Parameters deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 value a pointer to the destination value min the minimal value that the returned numbers can take max the maximal value that the returned numbers can take 5 3 7 2 1 1 Integral Values The Scaling Algorithm Random numters required by an application are very often in a range much smaller than the fixed range of the random number produced by Quantis To perform the scaling the largest permitted multiple of the output range is selected Random values equal or higher this limit are discarded Below you will find a simplified version of the C code im plementing QuantisReadScaledInt which produces an unbiased number between minValue and maxValue inclusive Erro Output range unsigned long long range maxValue minValue 1 Range of the rnd value unsigned long long maxRange 9327 Largest multiple of the output range unsigned long long li
53. er This chapter contains instructions on how to install the driver on your operating system Quantis PCI Express is software compatible with Quantis PCI This means that any soft ware capable of communicating with a Quantis PCI device e g driver is also able to communicate with the Quantis PCI Express More specifically Quantis PCIe uses the Quantis PCI driver Quantis PCIe is considered by the software driver application as a Quantis PCI device 3 1 Windows Operating Systems This section contains instructions on how to install a Quantis device on Windows Operating Systems Insert the USB flash drive into an available USB port This drive contains the Quantis drivers as well as software for your device The documentation show how install USB device Quantis PCI PCIe installation procedure is identical In this section we assume that the letter of the USB flash drive provided by IDQ is drive D If this is different on your machine substitute your corresponding drive name for D in the appropriate places in this instruction 3 1 1 Windows XP When a Quantis RNG is inserted into your computer for the first time the operating system will detect the device automatically and display a New Hardware Found message The following are step by step installation instructions 3 1 1 1 Found New Hardware Wizard Welcome Windows will search for a driver on your computer on removable media e g CD ROM and on the Windows
54. er is ready to install EasyQuantis on your computer Click Next to start the installation The installation starts For security reasons you will be asked to allow the installation Click yes au E Installing EasyQuantis EasyQuantis is being installed Please wait E ls Installation Complete EasyQuantis has been successfully installed Click Close to exit To launch the application click on the EasyQuantis icon in Start gt Program or if you run Windows8 the EasyQuantis icon will appear in the start screen 4 1 2 Linux Operating Systems 4 1 2 1 Install Requirements EasyQuantis requires the 1ibusb 1 and Qt4 libraries qt 4 core and qt 4 gui to work If you have a Quantis PCI card please follow instructions in Section 3 2 2 1 libusb 1 0 Installation If you have a Quantis USB device 1ibusb 1 has already been installed on your system 38 Linux Operating Systems Do Qt libraries are available on all major Linux distributions and they can be installed using the package manager of the distribution 4 1 2 1 1 Debian based Distributions Open a terminal and install 1ibqt4 core and libqt4 gui using the following command as root L apt get install libqt4 core libqt4 gui 4 1 2 1 2 Other Distributions Install 1ibqt 4 core and libqt4 gui using the package manager of your distribution 4 1 2 2 Install the Application The EasyQuantis and Quantis libraries a
55. gdev a LOGIN 3 2 1 4 3 UDEV rules In the directory Drivers Unix on the USB flash there are two files with UDEV rules idq quantis rhel rules for Red Hat Enterprise Linux and CentOS distributions idq quantis rules for all other distributions Copy as root the right file into etc udev rules d directory On Red Hat Enterprise Linux and CentOS distributions cp media USB FLASH Drivers Unix idq quantis rhel rules etc udev rules d On all other distributions etc udev rules d i cp media USB FLASH Drivers Unix idq quantis rules The files idq quantis rhel rules and idq quantis rules UDEV rules for both Quantis PCI and Quantis USB devices The udev daemon must now reload the rules Type following command as root to reload the rules udevadm control reload rules On Red Hat Enterprise Linux and CentOS distributions the udevadm command does not exists User following command to reload the rules instead udevcontrol reload rules The udev daemon only apply rules when creating the device s node when the drivers loads If the Quantis PCI driver is already loaded you need thus to unload and reload it to have the right permissions on the device rmmod quantis pci modprobe quantis pci 3 2 1 5 Check Your Device The driver has been installed and the system configured You can now check if your device works correctly by reading some
56. hen choose Properties gt Common Properties gt Project Depenencies Choose the project from the drop down list and add Quantis as a prerequisite If you want to work on the Quantis wrapper samples don t forget to add the full path to Quantis lib to Properties gt Configuration Properties Linker Input Additional Dependencies X64 architecture If you are on a 64b machine you must make sure that not all projects of the solution are selected because not all projects can compile in this case It is easiest if you proceed as follows In the solution explorer select the next project Quantis Quantis NoHw QuantisP ci compat QuantisUSB compat with your mouse and then click build The EasyQuantis can not be compiled in 64 bits due to Qt is only 32 bits If the building of QuantisPci QuantisUsb Compat projects fails make sure that the Quantis project is listed as a Project dependency To do that in Visual Studio 2008 right click on the solution then choose Properties gt Common Properties gt Project Depenencies Choose the project from the drop down list and add Quantis as a prerequisite If you want to work on the Quantis wrapper samples don t forget to add the full path to Quantis lib to Properties gt Configuration Properties Linker Input Additional Dependencies Windows Compilation with Visual Studio 2010 Installing the Windows Driver Kit 7 0 Download the Windows Driver Kit version 7 0 0 It comes as an
57. his reason we have included a destructor in our interface that you should call when you no longer need Quantis A sample executable in your code shows how to use this interface 6 1 2 Library Compilation for C 11 It is important to not to compile EasyQuantis when compiling with C 11 If you want to compile both do two separate compilations If you want to test the interface without C 11 support i e with the keywords suppressed simply compile it as usual with no options given to cmake The sample will work either way For this feature to work your compiler must support the C 11 standard Many com pilers support parts of it but not all keywords needed in the random device interface It may thus happen that even though your compiler has a C 0x C 11 option the full feature version will still not be run In this case you can still use the random device interface but the C 11 specific keywords are automatically suppressed to pass com pilation in C 98 In most applications using random device it should still be easy to replace your old implementation with Quantis even if you don t have C 11 supported The full version of this feature is only supported on Linux and MacOSX systems On the other supported OSs the interface of the class will be available along with the Sample code for C 11 but the C 11 specific keywords will be automatically suppressed Again this means that you can use the class but it is not compatible w
58. ibrary section Library Location E g if you have decompressed the Ant folder in the location C Program FileslAntlapache ant x y z your Java JDK is under C Program FilesNJavaNjdk xxx and your Quantis libraries are under lt path to Quantis Packages Windows lib Win32 you should add the following line C Program Files Ant apache ant x y z C Program Files Java jdk xxx lt path to Quantis Packages Windows lib Win32 y On some 64b Windows systems you may have to recompile the Quantis libraries before executing the Java sample in order to avoid JNI related errors For how to do this refer to chapter The Quantis Library section Recompiling the Quantis Library When you have done that you will need to update the entry in the PATH variable pointing to the Quantis libraries The section Library Location tells you where you can find your recompiled Quantis libraries Now you can execute the Java Sample cd lt path to Quantis gt Samples Java ant ant run Instead of ant run you can also execute java jar dist Quantis jar 84 Appendix A Troubleshooting A 1 EasyQuantis A 1 1 EasyQuantis crashes on Linux with one of the following errors Segmentation fault symbol lookup error EasyQuantis undefined symbol ZNI4QPlainTextEditC 1 EP7QWidget Such errors are generally caused by an incompatible Qt library binary The binary of EasyQuantis provided by ID Quantique has been linked against Qt
59. ing starts at 0 the number of bits which are input to the extractor the number of bits which are output to the extractor number of bytes to down sampled should gt 13 a pointer to a char array representing the path and the filename of the output file to save the data after extraction 7 1 2 9 QuantisExtractorMatrixUnderSamplingRead int32_t QuantisExtractorMatrixUnderSamplingRead QuantisDeviceType deviceType unsigned int deviceNumber 75 Advanced Functions uint32 t nbrOfBytesRequested uintl6 t underSamplingPeriod uint8 t sampledBuffer Sample the QuantisRead output according to underSamplingPeriod and save the output stream in sampledBuffer Return the number of read sampled bytes if success QUANTIS EXT ERROR otherwise Parameters deviceType deviceNumber nbrOfBytesRequested underSamplingPeriod sampledBuffer the type PCI or USB of the Quantis device the number of the Quantis device Note that device numbering starts at 0 number of bytes which should be output to the user after the sampling of the data read from the Quantis number of bytes to down sampled should gt 13 a pointer to a buffer where to store the sampled sequence 7 1 2 10 QuantisExtractorMatrixProcessBufferVonNeumann uint32_t QuantisExtractorMatrixProcessBufferVonNeumann uint8 t inputBuffer uint8_t outputBuffer uint32 t inputBufferSize Apply extraction processing function to
60. ion This application allows you to quickly and easily generate random data Quantis PCI Express is software compatible with Quantis PCI EasyQuantis considers Quantis PCIe devices as Quantis PCI devices 4 1 Installation 4 1 1 Windows Operating Systems EasyQuantis is provided as a Microsoft Installer MSI package for easy installation Just double click on EasyQuantis msi file and follow on screen instructions T Welcome to the EasyQuantis Setup Wizard The installer will guide you through the steps required to install E asyQuantis on your computer WARNING This computer program is protected by copyright law and international treaties Unauthorized duplication or distribution of this program or any portion of it may result in severe civil or criminal penalties and will be prosecuted to the maximum extent possible under the law Cancel Then you may select a directory to install EasyQuantis y Select Installation Folder The installer will install EasyQuantis to the following folder To install in this folder click Next To install to a different folder enter it below or click Browse Eolder C Program Files ID Quantique SANE asyQuantis Browse Disk Cost Install EasyQuantis for yourself or for anyone who uses this computer Everyone Just me Then confirm you are ready to install 37 Do Linux Operating Systems qul 17 Confirm Installation The install
61. ion number Returns a QUANTIS_ERROR code cast to float on failure Parameters deviceType the type PCI or USB of the Quantis device QuantisGetLibVersion float QuantisGetLibVersion Returns the version of the library as a number composed of a major and a minor version number The value before the point represents the major version number while the value after the point represents the minor version number QuantisGetManufacturer char QuantisGetManufacturer QuantisDeviceType deviceType unsigned int deviceNumber Returns a pointer to the manufacturer name string of the Quantis device Currently only the USB version supports manufacturer name retrieval On PCI and PCI Express the string Not available is returned The string Not available is returned on failure as well Parameters QuantisGetModulesDataRate D Q 5 3 5 5 3 6 9 3 7 deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 QuantisGetModulesDataRate int QuantisGetModulesDataRate QuantisDeviceType deviceType unsigned int deviceNumber Returns the data rate in bytes per second provided by the Quantis device or a QUANTIS_ERROR code on failure Parameters deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0
62. is has been built as a Console application When launched the system automatically creates a console window If no argument has been provided to the application giving arguments would invoke the console version the console window is hidden and the graphical interface is dis played Avoiding this issue is very difficult 88 Appendix C Migrating to the New API The Quantis library version 2 0 has a slightly different API than its predecessors This is mainly due to the merge of the old Quantis library used to access Quantis PCI devices and Quantis USB library used to access Quantis USB devices into a single library The main difference between versions 1 x and 2 0 is the addition of the parameter deviceType which allows you to specify the type of device to use PCI PCIe or USB Additionally functions names have been modified when ambiguous See Table C 1 API 1 x and 2 0 functions equivalences for equivalences between API 1 x and 2 0 API 1 x functions API 2 0 functions int quantisBoardReset int QuantisBoardReset int cardNumber QuantisDeviceType deviceType unsigned int deviceNumber int quantisBoardVersion int QuantisGetBoardVersion int cardNumber QuantisDeviceType deviceType unsigned int deviceNumber int quantisCount int QuantisCount QuantisDeviceType deviceType int quantisDriverVersion float QuantisGetDriverVersion QuantisDeviceType de
63. ith the C 11 standard in the strict sense In most applications using random device it should still be easy to replace your old implementation with Quantis even if you don t have C 11 supported If you use cmake and the gnu C C compiler version 4 6 or newer it is possible that the features will work for you even on other systems than Linux and MacOSx 6 1 2 1 Windows The Windows Visual Studio 2008 2010 compilers do not support all the necessary C 11 features so if you want to user C 11 under Windows you must revert to a compilation as under Linux using CMake and GCC 4 6 see below 6 1 2 2 Linux The distribution available by default uses C 98 so you need to recompile the library to use C 11 You will need to have installed CMake and GCC 4 6 or higher Proceed as follows cd lt your path to Quantis gt Libs Apps mkdir build cd build cmake DUSE CXX11 1 DDISABLE EASYQUANTIS 1 make 6 1 2 3 Mac OSX On Solaris you should use the clang clang compiler Define the two environment variables CC and CXX in the following way before you call CMake export CC clang export CXX clang cd lt your path to Quantis gt Libs Apps 68 C 11 Sample compilation D Q mkdir build ed build cmake DUSE CXX11 1 DDISABLE EASYQUANTIS 1 make 6 1 2 4 Solaris OpenSolaris On Solaris you may choose whether to compile using GCC or using SunStudio On a typical system with both options instal
64. ition tab allows to generate random numbers from a Quantis device 40 Acquisition List of Quantis devices List of Quantis devices List of Quantis devices found on the system found on the system found on the system Format of the File Help random data Quantis PCI 0 356 Acquisition Fie Extraction Extraction Matrix Data format le Data separator for OA c ba non binary data Sis Create floating point numbers Comma separated values CSV Minimal and maximal value for non binary data Scale data between fo ie IV Enable randomness extraction Size and filename Size 1024x 768 bs v of the extraction matrix Matrix filename C Program Files ID Quantique SA EasyQuantis default jdq matrix dat Data destination MS Save to fle C JUsersidqlAppDatalLocallTempYandom dat Quantity of random numbers to read 1024 Xj 10 0 Kbytes a Quantity of random data to generate Lauch random data acquisition Figure 4 1 EasyQuantis2 Acquisition tab To generate random data from a Quantis device using EasyQuantis 1 Select a Quantis device from the list 2 Select a data format Binary data Data is read from the Quantis and returned as bytes Browse to select a matrix file Browse to define a file to save the random data Integer numbers Generates 32 bit random numbers ranging between 2 147 483 648 and 2 147 483 647 inclusive Floating
65. l To compile the kernel driver you also need to install the developer tools such as GNU GCC C C compilers make and others You can install them with the following command as root L yum groupinstall Development Tools All required software has been installed You can skip to Section 3 2 1 2 Compile and Install Driver 3 2 1 1 3 Other Distributions Install the GNU GCC compiler and the header corresponding to the current kernel or the whole source kernel Please refer to the guide of your distribution for help on installing packages 3 2 1 2 Compile and Install Driver Now that all pre requirements have been installed you can compile and install the driver First copy the source code of the driver to tmp cp R media USB FLASH Drivers Unix tmp Change to the directory which contains the driver and compile the driver cd tmp Unix QuantisPci make When compilation finish install and load the driver with following commands as root make install 4 modprobe quantis pci You can verify that the driver has been successfully loaded and all your Quantis PCI and PCIe cards have been detected with the command dmesg dmesg grep quantis pci guane ou Masias duene sS JE OR NOR PS Ave RS JONER cuele Spek driver build Febi 2 20 OR Aa quantis pci support enabled up to 10 PCI card s quantis pci Found card 0 CMAINE epen core version 0x040a1201
66. later chapters you will find the Windows libraries under lt path to filename gt Libs Apps Quantis lt your system arch gt and the Linux libraries under lt path to quantis gt Libs Apps build Quantis 5 2 Device Type Almost all Quantis library functions require the device type to be specified Currently there are two types e QUANTIS_DEVICE_PCI to specify a Quantis PCI or a Quantis PCI Express 49 Basic Functions QUANTIS DEVICE USB to specify a Quantis USB Quantis PCI Express is software compatible with Quantis PCI There is no distinction between Quantis PCI and Quantis PCIe devices within the library and they are both considered as PCI devices 5 3 Basic Functions 5 3 1 5 3 2 5 3 3 5 3 4 50 This section introduces a minimal set functions you need to use to read random data from within your application QuantisCount int QuantisCount QuantisDeviceType deviceType Returns the number of devices that have been detected It returns O when no card is installed and on error Parameters deviceType the type PCI or USB of the Quantis device QuantisGetDriverVersion float QuantisGetDriverVersion QuantisDeviceType deviceType Returns the version of the driver as a number composed of a major and a minor version number The value before the point represents the major version number while the value after the point represents the minor vers
67. led GCC is the default To use SunStudio define the two environment vari ables CC and CXX in the following way before you call CMake export CC cc export CXX CC cd lt your path to Quantis gt Libs Apps mkdir build ed build cmake DUSE CXX11 1 DDISABLE EASYQUANTIS 1 make 6 1 2 5 FreeBSD On FreeBSD use CMake and make to compile in the following way cd lt your path to Quantis gt Libs Apps mkdir build cd build cmake DUSE CXX11 1 DDISABLE EASYQUANTIS 1 make 6 1 3 C 11 Sample compilation For how to compile the C 11 Sample see the relevant section in the chapter Sample Code below 69 70 Chapter 7 The QuantisExtensions Library The QuantisExtensions library is a set of functions to add extra processing to the random data For the moment it can provide randomness extraction IDO provides an abstraction library written in C language to ensure support over various operating systems For the moment only Windows and Linux operating system are supported The library also comes with a C wrapper Other languages wrappers are not available for the moment 7 1 Extractor The extraction processing allow to improve the randomness of the data The Samples directory show how to use the QuantisExtractor functions IDQuantique provide a default matrix file located under Libs Apps QuantisExten sions default_idq_matrix dat Randomness extraction algorithm use 64 bi
68. lication In some situation it could be useful to control the Open and Close of a device In this case use the QuantisOpen QuantisReadHandled and QuantisClose functions described later 5 3 7 1 Reading Large Amounts of Data QuantisRead is not meant to read large amount of data The maximal size of a request is defined by QUANTIS MAX READ SIZE If you try reading a larger amount Quant isRead will return an error To read large amount of data you have to use a loop as in following example Chunk size Recommended values are 2048 or 4096 chunkSize CHUNK SIZE remaining SIZE while remaining gt Ou Chunk size if remaining lt chunkSize chunkSize remaining Read data result QuantisRead deviceType 0 buffer NUM BYTES TODOS 1 Check result see example at the end of the chapter 2 Handle buffer e g store data in a file buf Update info remaining chunkSize 5 3 7 2 Reading Basic Data Types The function Quant iRead is useful to read a high quantity of raw random data Depending on the application it can be useful to be able to directly read basic data types This section introduces func tions designed for this purpose 5 3 7 2 1 Integral Values int QuantisReadShort QuantisDeviceType deviceType unsigned int deviceNumber short value int QuantisReadScaledShort QuantisDeviceType deviceType unsigned int deviceNumb
69. ll the package containing the library by typing the command after uncompressing the package pkgadd d lt path to quantis gt Packages Solaris Sparc IDQLibs Apps sparc 2 9 4 1 5 FreeBSD To install the Quantis code and application execute cd usr ports security quantis make config make make install Y Running make config above allows you to choose a number of options Unless you are sure to need it disallow the Quantis GUI since permitting it will require the instal lation configuration of a large number of large packages Qt Perl Ruby boost and will take very very long 4 2 EasyQuantis In the Quantis software package two versions are provided EasyQuantis 1 Allows to get random numbers from a Quantis device EasyQuantis 2 Allows to get random numbers from a Quantis device and provide randomness extraction capabilities only available on Windows and Linux at the moment Randomness extraction principle is explained in a dedicated white paper Please re fer to the Randomness Extraction for the Quantis True Random Number Generator document for details This document may be found on IDQ website 4 3 EasyQuantis2 Windows Linux EasyQuantis2 is made of 3 tabs Acquisition Make acquisition of random data from a Quantis device File extraction Process randomness extraction form a file Extraction matrix Create your own matrix file 4 3 1 Acquisition The Acquis
70. lowing is a simple example of usage of the Quantis library Global includes nous lt sieelio Ioco acuse rene usos los Includes Quantis library s header include Quantis h Define the number of bytes that should be read define NUM_BYTES 100 A QuantisDeviceType deviceType unsigned char buffer SS p ote Lp Select device type if QuantisCount QUANTIS_DEVICE_PCI gt 0 There is one ore more Quantis PCI device deviceType QUANTIS_DEVICE_PCI else if QuantisCount QUANTIS_DEVICE_USB gt 0 There is one ore more Quantis USB device deviceType QUANTIS_DEVICE_USB else No Quantis device has been found on the system printf No Quantis device found n teturn p Allocate buffer s memory buffer unsigned char malloc NUM BYTES 80 C Sample if buffer fprintf stderr Unable to allocate memoryln return 1 Read random data from the Quantis result QuantisRead deviceType 0 buffer NUM_BYTES Check 1f there are some errors ie SS 9 An error occured Print the error message moria cit Siecleieie An error occured when reading random bytes s n QuantisstrError mes sul goto cleanup else if result NUM_BYTES Quantis did not return the number of bytes asked fprintf stderr Asked to read d byts but received d bytes n NUM_BYTES result g
71. mit maxRange maxRange range Read raw random number until it is lower the limit do QuantisReadInt deviceType deviceNumber amp rnd while rnd gt limit Scale value 9 value rnd range minValue o This scaling algorithm wastes data when Quantis generates random values equalling or exceeding the limit In the worst case when range maxRange 2 1 the probability to drop a generated value is roughly 5096 5 Raw random values are often scaled using the modulus operator using something like 53 QuantisRead minValue rawRndValue maxValue minValue 1 where represents the modulus operator This formula produces a number between minValue and maxValue inclusive but in certain conditions when their range is not a multiple of the output range the distribution of these numbers has a small bias that favours numbers at the lower end of the output range 5 3 7 2 2 Floating Point Values 54 int QuantisReadFloat_01 QuantisDeviceType deviceType unsigned int deviceNumber float value int QuantisReadScaledFloat QuantisDeviceType deviceType unsigned int deviceNumber float value ileewe la float mas p int QuantisReadDouble_01 QuantisDeviceType deviceType unsigned int deviceNumber double value int QuantisReadScaledDouble QuantisDeviceType deviceType unsigned int deviceNumber double value double min dou
72. ndows This directory contains all drivers for Windows Activate the option Include subfolders and validate your choices by clicking the Next button Browse for driver software on your computer Search for driver software in this location 7 Include subfolders 3 1 2 4 Found New Hardware Wizard Installation Wait while the wizard installs the Quantis driver 11 CDa Windows Vista Installing driver software A 3 1 2 5 Found New Hardware Wizard Install If asked validate the installation by clicking the Install button You can select Always trust software from ID Quantique SA to avoid this question in future All software with a valid digital signature from ID Quantique will be automatically accepted and will be installed without prompting Would you like to install this device software Name ID Quantique SA id Quantique Instruments SI Publisher ID Quantique SA You should only install driver software from publishers you trust How can I decide which device software is safe to install 3 1 2 6 Found New Hardware Wizard Completed When the wizard has finished installing the Quantis driver click the Close button to exit the installa tion Reboot the computer if asked 12 Windows 7 GB Q Ww jj Found New Hardware Quantis USB The software for this device has been successfully installed Windows has finished installing the driver software for this device Qua
73. nnconnconnccnnccnnconnconiciniss 43 4 4 EasyQuantis main window rovnrernnnrernnnnernnenernnenernnenernnnnevnnenevnnnnevnnnnevnnenevnnenevnneneener 44 vil viii List of Tables 1 1 Supported operating systems o eet Ft Ee gevinsten ori 1 C 1 API 1 x and 2 0 functions equivalences sese HH mere 89 1X Chapter 1 Introduction Thank you for purchasing a Quantis Random Number Generator A random number generator is a device that produces sequences of numbers whose outcome is un predictable and which cannot subsequently be reliably reproduced There exist two main classes of random number generators software and physical generators In general software generators produce so called pseudo random numbers Although they may be useful in some applications they should not be used in most applications where true randomness is required Quantis is a physical random number generator exploiting an elementary quantum optics process Photons light particles are sent one by one onto a semi transparent mirror and detected The exclu sive events reflection transmission are associated to 0 1 bit values The operation of Quantis is continuously monitored If a failure is detected the random bit stream is immediately stopped Quantum random number generators have the advantage over conventional randomness sources of being invulnerable to environmental perturbations and of allowing live status verification
74. nocnnconnronncrnnccnncnnncnnnccnnios 33 3 3 1 QuantisPCI and QuantisPCI Express eeeeeeeee 33 3 3 2 Quants USB 255 A E E dd 33 3 3 3 Installation 2e eot etr seas doves sand ea par GR dere TE 33 3 3 4 Implementation details esses 34 3 3 5 Known problems reet ten ttr Poe e EET sev E E RR Pn 35 3 4 Solaris OpenSolaris ee Bess 35 3 5 FreeBSD ase D Ga ra 35 4 The EasyQuantis application ssssssssse I e mem meme He emen rene 37 4 1 Installation sinnsvakt seeks ERR URS POI Ee eden 37 4 1 1 Windows Operating Systems 0 0 0 0 cece cece eee He 37 4 1 2 Linux Operating Systems secet ERR EE nees aih 38 4 13 Mac OS X uite RERO IPIE 40 41 4 Solaris 7 OpenSolaris eto o rerit eter Ere e e PU e SERT UR 40 4 1 5 FreeBSD bo ieee yrs PS A in Bess 40 4 2 BasyQ antis ou ig oS dese arken ete p Demo nete P Er MERE 40 4 3 EasyQuantis2 Windows Linux orernvnrernvnrernvnrernenrennenrennennennenrennennennennennenner 40 4 3 1 ACqUISIHOD sengs snertne 40 43 2 File extraction sarissa aS tere e Govt POS e E YE EE EUR eue du 42 473 3 Extraction Thatrix on de eer FER ERR ERE exta eo Sud ASer 43 4 4 Using EasyQuantis 1 x other OS ervrnonnvrnonnernennennennennennennennennennennennennennenner 44 4 5 The EasyQuantis Command Line sese heme 45 4 5 T Options tet suverene ee 46 4 5 2 Usage Examples 5 em n er ERROR RR E ERR ERR 47 2 The Quantis Library ii
75. ntique SA and any other company Revision History 26 04 2013 Add Microsoft Windows 8 32 and 64 bit support for Quantis USB and Quantis PCI PCIe Improvement of the EasyQuantis installation documentation Add EasyQuantis 2 1 new command line extraction options documentation Revision 2 9 03 09 2012 Add QuantisExtension library documentation Add Quantis library new Open Close functions Add EasyQuantis extraction operations Add how to recompile Quantis libraries Added an entry in the FAQ Revision 2 8 19 12 2011 Added information concerning the C 11 user interface and installation under FreeBSD and Solaris Corrected bug in the usage sample and provided detailed info about the sample code compilation and execution Revision 2 7 16 05 2011 Added information related to the port of Quantis USB on Mac OS X Revision 2 6 10 03 2011 Corrected minor mistakes and rephrased a few sentences for ease of understanding Revision 2 5 12 01 2011 Added details on the QuantisGetManufacturer method Revision 2 4 16 09 2010 Added instructions to install Quantis on Red Hat Enterprise Linux and CentOS Revision 2 3 25 06 2010 Added details on the scaling algorithms Improved the EasyQuantis installation description on Linux Added Troubleshooting appendix Revision 2 2 30 04 2010 n the Quantis PCI Linux driver installation section fixed a wrong path and added two sub sections Updated the EasyQuantis inst
76. ntis USB e The hardware you installed will not work until you restart your computer Your Quantis device is now installed You can go to the next Chapter and install the application software 3 1 3 Windows 7 When the Quantis RNG is inserted into your computer for the first time the operating system will detect the device automatically and search the Windows Update Web site for a driver o One or more intermediate dialog boxes may appear during the process stating Windows needs your permission to continue Click Continue to proceed User Account Control y Windows needs your permission to continue If you started this action continue y Device driver software installation Microsoft Windows Y Details Continue Cancel User Account Control helps stop unauthorized changes to your computer Since the driver for your Quantis device is not available on this site this search will fail and you will have to manually point Windows to the driver 13 CDa Windows 7 Device driver software was not successfully installed Quantis USB x No driver found You can change your setting to automatically search Windows Update for drivers What can I do if my device did not install pr Close the dialog and read the following for the step by step installation instructions 3 1 3 1 Devices and Printers Open the Start Menu and select Devices and Printers Scroll down until the Quantis device appears Cli
77. ntis devices on Mac OS X Oper ating Systems The binaries are only supported from Mac OS X 10 6 Snow Leopard In order to use the driver with earlier versions of the OS the sources should be recompiled QuantisPCI and QuantisPCI Express The Quantis PCI is not yet supported on Mac OS X Quantis USB The binary distribution is contained in the file EasyQuantis dmg and is composed of the EasyQuantis application which allow the immediate use of the Quantis e the Quant isRNG 2 7 0 Darwin i386 pkg which is a standard package for the Mac OS X installer and which contain all the SDK to use the Quantis from the C C programming language the Readme describing briefly how to install the software Installation To access the content of the file EasyQuantis dmg simply double click on its icon in the Finder Once the disk opened simply drag the icon of the EasyQuantis application in the Applications folder or in any other convenient folder 33 Do Implementation details 3 3 4 To install the SDK double click on its icon and follow the instructions of the package manager Once the license is accepted the different files headers library and binaries will be available in the directory opt IDQQuantis This directory is deliberately chosen in order to avoid interferences with the standard system The di rectory name should normally only be used to add search paths for headers files opt IDQQuan tis include
78. o install Quantis devices on Linux Operating Systems O In this section we assume that the USB flash drive with the software is mounted on media USB_FLASH If this is different on your machine substitute your correspond ing drive name in the appropriate places in this instruction 25 Do Quantis PCI and Quantis PCI Ex press Ubuntu does not include the root user Instead administrative access is given to indi vidual users who may use the sudo application to perform administrative tasks To use sudo on the command line preface your command with sudo sudo my command requiring administrative access In this document when a command must be executed as root on Ubuntu preface the command with sudo Please refer to the Ubuntu guide for more details about the command sudo 3 2 1 Quantis PCI and Quantis PCI Express The Quantis PCI and Quantis PCIe cards require a kernel module to be compiled and installed to work correctly The following are step by step installation instructions 3 2 1 1 Install Pre Requirements Before being able to compile a Quantis PCI kernel module you must install a compiler and the Linux kernel sources Generally you do not need the full source tree in order to build a module against the running kernel Most of the time you just need the kernel headers 3 2 1 1 1 Debian based Distributions Debian based distributions have a powerful tool for building kernel modules
79. o load a driver on boot up 3 2 1 4 Modify the Device s Permissions Depending on the distribution the Quantis PCI device might be accessible only to user root UDEV the device manager for the Linux 2 6 kernel series must be instructed to allow other users to access the Quantis 3 2 1 4 1 The plugdev group IDO provides a rule for UDEV that allows all users in group plugdev to access the Quantis device The group plugdev is generally created on all modern distributions First check if your system already has the group plugdev s grep plugdev etc group If the previous command displays a line beginning with plugdev x then your system has the group plugdev When the grep command does not display any message then the plugdev group doesn t exists on your system Type following command as root to create the plugdev group groupadd gid 46 plugdev 3 2 1 4 2 Adding users to the plugdev group Every user who is a member of the plugdev group can access hot pluggable devices digital cameras USB drives etc You can use the command groups to display the groups your user is in s groups 28 Quantis PCI and Quantis PCI Ex Do press users adm dialout cdrom plugdev lpadmin admin sambashare If your user is not in the group plugdev use the usermod command as root to add the user LOGIN to the group plugdev substitute your own login name for LOGIN L usermod G plu
80. oices by clicking the Next 23 Ciba Windows 8 Browse for driver software on your computer Search for driver software in this location Include subfolders gt Let me pick from a list of device drivers on my computer This list will show installed driver software compatible with the device and all driver software in the same category as the device 3 1 4 6 Update Driver Software Installation Wait while Windows installs the driver Installing driver software 3 1 4 7 Windows security check Windows ask you to confirm the installation Click the install 24 Linux Operating System Ciba Would you like to install this device software Name ID Quantique SA Publisher ID Quantique SA Always trust software from ID Quantique SA L Y You should only install driver software from publishers you trust How can decide which device software is safe to install 3 1 4 8 Update Driver Software Completed When the wizard has finished installing the Quantis driver click the Close button to exit the installa tion Reboot the computer if asked Windows has successfully updated your driver software Windows has finished installing the driver software for this device p Quantis USB Random Number Generator Your Quantis device is now installed You can go to the next Chapter and install the application software 3 2 Linux Operating System This section contains instructions on how t
81. oost_1_43 GE GONE GE DE A Plateform Win32 and Show directories for Librairies files Add the next entries at the end of the list C WinDDK 7600 16385 0 lib wxp i386 C Program Files boost boost_1_43 lib Platform x64 and Show Directories for Include files Add the next entries at the end of the list WinDDK 7600 16385 0 inc ddk WinDDK 7600 16385 0 inc api Program Files Java jdk1 6 0_25 include Program Files Java jdk1 6 0_25 include win32 Program Files boost Boost_1_43 EGGE EO Plateform x64 and Show directories for Librairies files Add the next entries at the end of the list C AWinDDKA7600 16385 011ibWwlhlama64 C Program Files boost boost_1_43 lib Now define the Qt version Menu Qt Qt Options Click Add and browse to the next path C Ot SDK Desktop Ot 4 7 3 msvc2008 Visual Studio requires an Environement variable for QTDIR In Windows Control Panel System Advanced system settings click Environement variables and add the variable OTDIR with the value C Qt SDK Desktop QOt 4 7 3 msvc2008 This configuration has worked for a long time on older compilers since includes were managed more automatically but recent changes mean that the above instruction might generate errors In case you get errors with a number of standard headers such as stddef h and certain I O headers try the following First add the include directory C WinDDK 7600 16385 0 inc crt to
82. or libraries opt IDQQuantis 1ib to the compiler command line or to the XCode projects The directory opt IDQQuant is is a perfectly standard Unix path and is accessible without problem from the Terminal Since it is not a standard Mac OS X path it is not available directly in the Finder It is however possible to reach it by choosing the menu Go to Folder Shift Command g Implementation details Like on Linux see the paragraph Section 3 2 2 1 libusb 1 0 Installation the Quantis USB is avail able by using the 1ibusb 1 0 This software is not included in Mac OS X and should be installed manually The two projects 1 MacPorts http www macports org 2 Fink http www finkproject org provide an easy solution for installing additional Unix software on Mac OS X The MacPorts 1ibusb 1 0 package has been chosen for the use with the distributed driver To facilitate the distribution of the software the library 1ibusb 1 0 has been statically linked inside the library Quant is The application EasyQuantis needs the libraries qt boost and png All these libraries are statically linked inside the application Unfortunately none of the qt provided by the two projects has static libraries The qt library has then been compiled statically directly from the sources provided on the official site http qt nokia com products Even if the EasyQuantis use graphical Mac OS X widgets it is not fully recognized by the system as a
83. ot be affected by static charge as may be received through your body during han dling of the unit However there are special circumstances where you may carry an ex traordinarily high static charge and possibly damage the card and or your computer To avoid any damage from static electricity you should follow some precautions whenever you work on your computer 1 Turn off your computer and unplug power supply 2 Use a grounded wrist strap before handling computer components If you don t have one touch with both of your hands a safely grounded object or a metal object such as the power supply case Place components on a grounded anti static pad or on the bag that came with the components whenever the components are separated from the system The card contains sensitive electric components which can be easily damaged by static electricity so the card should be left in its original packing until it is installed Unpacking and installation should be done on a grounded anti static mat The operator should be wearing an anti static wristband grounded at the same point as the anti static mat Inspect the card carton for obvious damage Shipping and handling may cause damage to your card Be sure there are no shipping and handling damages on the card before proceeding DO NOT POWER YOUR SYSTEM IF THE QUANTIS CARD IS DAMAGED 2 1 1 Unpacking Open the shipping carton and carefully remove all items and ascertain that you have
84. oto cleanup f Dngjolley love sisi Bla somrer printf Displaying d random bytes in HEX format n NUM_BYTES for i 0 i lt NUM_BYTES i pensel outra a YR joue stage ae Mai f Cleanup cleanup if buffer free buffer return 0 A more detailed example is available on the USB flash drive in the Samples directory 8 4 C Sample Here is the example presented in the previous chapter modified to use the C Wrapper Compile like this if Quantis software is installed under Whope oOOuantd ss pese Sk use do r oat DO Meine na lado I opt IDQQuantis include 1 Quantis o quantis osx quantis osx wrapper cpp A Global includes include lt iomanip gt include lt iostream gt include lt cstdlib gt include lt string gt Includes Quantis library s header 81 Java Sample Note the hpp extension include Quantis hpp Define the number of bytes that should be read define NUM BYTES 100 using namespace std using namespace idQ int metia QuantisDeviceType deviceType ins sul Select device type Die QUAN Coun OUAN TIE SEDE VACA GI 25 0 There is one ore more Quantis PCI device deviceType QUANTIS_DEVICE_PCI else if Quantis Count QUANTIS_DEVICE_USB gt 0 There is one ore more Quantis USB device deviceType QUANTIS_DEVICE_USB else No Quantis
85. rBytesToXor char elementaryMatrixFilenames char extractorMatrixFilename XOR the bitstreams contained in the nbrElementaryMatrices files specified in elementaryMatrices Filenames Returns QUANTIS_SUCCES on success or a QUANTIS_EXT_ERROR code on failure Parameters nbrElementaryMatrices nbrBytesToXor elementaryMatrixFile names extractorMatrixFilename number of elementary matrices that should be XORed number of bytes that should be XORed a pointer to a char array containing the name of the files where the different elementary matrices are stored a pointer to a char array representing the path and the filename of the output file to save the matrix 7 1 2 8 QuantisExtractorMatrixCreateElementary int32 t QuantisExtractorMatrixCreateElementary QuantisDeviceType deviceType unsigned int deviceNumber uintle t matrikxSizein uintl6 t matrixSizeOut uintl6 t underSamplingPeriod char elementaryMatrixFilename Write to file an elementary matrix created by applying QuantisExtractorMatrixUnderSamplingRead to the buffer produced by QuantisExtractorMatrixUnderSamplingRead Returns QUANTIS SUCCES onsuccess ora QUANTIS EXT ERROR code on failure Parameters deviceType deviceNumber matrixSizeIn matrixSizeOut underSamplingPeriod elementaryMatrixFilename the type PCI or USB of the Quantis device the number of the Quantis device Note that device number
86. ractorMatrix Free the allocated memory from QuantisExtractroInitializeMatrix function Parameters extractorMatrix a pointer to a pointer where the matrix is stored in memory 7 1 1 4 QuantisExtractorGetDataFromQuantis int32_t QuantisExtractorGetDataFromQuantis QuantisDeviceType deviceType unsigned int deviceNumber uint8_t outputBuffer uint32_t numberOfBytesRequested c nst iblaisoue 6 atx aC Ore Maite x ne Reads the random data from the specified Quantis device and apply randomness extraction processing Returns QUANTIS_SUCCES on success or a QUANTIS_EXT_ERROR code on failure Parameters deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 outputBuffer a pointer to the destination buffer The buffer MUST already be allocated Its size must be at least numberOfBytesRe quested bytes numberOfBytesRequested the number of bytes to read extractorMatrix a pointer where the matrix is stored in memory 7 1 1 5 QuantisExtractorGetDataFromFile 72 int32_t QuantisExtractorGetDataFromFile char inputFilePath char outputFilePath const WOME ies extract rMatrixi Apply randomness extraction to data coming from an input file and save the result to an output file Returns QUANTIS_SUCCES on success or a QUANTIS_EXT_ERROR code on failure Parameters inputFilePath a pointer
87. random bytes from the device The following command reads 100 bytes from the first Quantis PCI device found on the system not as root 29 D Q Quantis USB E head c 100 dev qrandom0 It is important not to run the head command as root but as the standard user who will use the Quantis PCI device Otherwise you won t be verifying that permission has been granted to you to access the device The above command will display some random characters on the console If you get one or more Operation not permitted messages you don t have the right per missions to access the Quantis device In such a case Verify that etc udev rules d idq quantis rules exists and has the same content as the one provided on the USB flash drive Verify that your user is in the plugdev group Reboot the system to ensure that the new rules are loaded by the udev daemon You Quantis device is now installed You can go to the next Chapter to install the application software 3 2 2 Quantis USB Quantis USB only requires USB support enabled in the kernel The Quantis USB device is accessed through the open source library libusb 1 0 The following are step by step installation instructions 3 2 2 1 libusb 1 0 Installation Quantis USB device is accessed through the library libusb 1 0 This library is available on all recent distributions and can be installed using the package manager of the distribution Do not confuse libusb 0 1
88. re provided in a bz2 archive On 32 bit systems you can install the application using the following commands as root replace x y With your version number cd mnt USB FLASH tar xvjf QuantisRNG 2 x y Linux 1386 tar bz2 C tmp cd tmp QuantisRNG 2 x y Linux i386 mv bin EasyQuantis bin mv lib libQuantis lib Se sb sb db Se On 64 bit systems use the following commands as root instead cd mnt USB FLASH tar xvjf QuantisRNG 2 x y Linux amd642 tar bz2 C tmp cd tmp QuantisRNG 2 x y Linux amd64 mv bin EasyQuantis bin Se dE nb dE On some distributions you need to copy the 64 bits libraries to 11564 mv lib64 libQuantis lib64 On other distributions you need to copy to 1ib x86 64 linux gnu mv lib64 libQuantis lib x86 64 linux gnu You can run the EasyQuantis application by typing EasyQuantis on a terminal s EasyQuantis 4 1 2 3 Uninstall the Application To uninstall manually remove installed files as follows as root For 32 bits system rm Rf bin EasyQuantis rm RE lib libQuantis For 64 bits system rm Rf bin EasyQuantis rm RE lib64 libQuantis or rm Rf bin EasyQuantis 39 CDa Mac OSX rm Rf lib x86 64 linux gnu libQuantis 4 1 3 Mac OSX For Mac there is a dmg package Simply install it to get the EasyQuantis application 4 1 4 Solaris OpenSolaris Insta
89. s the function always returns 1 on such devices Parameters 57 QuantisGetModulesStatus 5 4 6 5 4 7 5 4 8 58 deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 QuantisGetModulesStatus int QuantisGetModulesStatus QuantisDeviceType deviceType unsigned int deviceNumber Returns the status of the modules on the given device as a bitmask or a QUANTIS_ERROR code on failure Bit n is set in the bitmask if module n is enabled and functional For instance 5 1101 in binary is returned when modules 0 2 and 3 are enabled and functional Parameters deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 QuantisModulesDisable int QuantisModulesDisable QuantisDeviceType deviceType unsigned int deviceNumber int modulesMask Disable one or more modules Returns QUANTIS SUCCES on success or a QUANTIS ERROR code on failure Parameters deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 modulesMask a bitmask of the modules as specified in the QUantisGet ModulesMask function that are to be disabled QuantisModulesEnable int QuantisModulesEnable QuantisDeviceType deviceType unsigned int deviceN
90. the Quantis library version 2 10 5 3 11 QuantisStrError char QuantisStrError QuantisError errorNumber Get a pointer to the error message string This function interprets the value of errorNumber and generates a string describing the error The returned pointer points to a statically allocated string which may not be modified by the enclosing application Further calls to this function will overwrite its content Parameters errorNumber the number assigned to a particular type of error 5 4 Advanced Functions This section introduces advanced functions that allow more control over the Quantis device Most users don t need to use these functions 5 4 1 QuantisBoardReset int QuantisBoardReset QuantisDeviceType deviceType unsigned int deviceNumber Resets the Quantis board Returns QUANTIS SUCCESS on success or a QUANTIS ERROR code on failure Parameters deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at O o9 You generally don t need to reset Quantis devices the Quantis library already resets the device when needed 5 4 2 QuantisGetBoardVersion int QuantisGetBoardVersion QuantisDeviceType deviceType 56 QuantisGetModulesCount GB Q 5 4 3 5 4 4 5 4 5 unsigned int deviceNumber Returns the internal version of the board Parameters deviceType the typ
91. the manipulation of the produced file from outside the EasyQuantis program 6 Select the amount of data to generate File size is limited to 2 GBytes 2 147 483 647 bytes 7 Click the Generate button and wait while the application generates the random data 4 5 The EasyQuantis Command Line EasyQuantis v1 1 and newer includes a command line parser allowing you to use the application Tom the console or in a script UT Do Options Extraction functionalities are not available in command line for the moment 4 5 1 Options 4 5 1 1 Generic Options h help v version 4 5 1 2 Quantis Options l list p pci arg u usb arg 4 5 1 3 Acquisition Options n size arg b binary arg i integers arg f floats arg separator arg min arg max arg 4 5 1 4 Extraction Options Display a summary of available options Return the version of EasyQuantis available since EasyQuan tis 2 1 List all devices available on the system Select the given Quantis PCI device as input device arg is the number of the Quantis PCI device to use Select the given Quantis USB device as input device arg is the number of the Quantis USB device to use Set the number of bytes or values that should be read If nothing is specified 1024 is used Generates a binary file arg designates the filename Generates a file of integers numbers arg designates the file
92. tion How to correct monitor flicker refresh rate Location Settings Change location settings Then click on Device Manager 22 Windows 8 Bo File Action View Help es Ol sym RE 4 QuantisTest32b gt Y Audio inputs and outputs gt pill Computer gt a Disk drives Display adapters gt Biz Human Interface Devices gt Gg IDE ATA ATAPI controllers gt 5 IDQ devices gt IEEE 1394 host controllers gt amp Keyboards gt A Mice and other pointing devices gt Ki Monitors gt EY Network adapters 4 p Other devices Under Other devices an undefined PCI Device must be listed Right click and select Update Driver Software 3 1 4 4 Update Driver Software Search Driver The driver is available on the USB memory drive provided Select Browse my computer for driver software How do you want to search for driver software Search automatically for updated driver software Windows will search your computer and the Internet for the latest driver software for your device unless you ve disabled this feature in your device installation E settings Browse my computer for driver software Locate and install driver software manually 3 1 4 5 Update Driver Software Search Location Click the button Browse an select the directory D Quantis vYY MM DD Drivers Win dows This directory contains all drivers for Windows Activate the option Include subfolders and validate your ch
93. tis List all USB and PCI PCIe devices found on the system Using this command allows to get the device number required for acquisition 4 5 2 2 Generate Binary Data EasyQuantis p 0 b random dat n 1073741824 Generates a file named random dat containing 1GByte of binary random numbers using the Quan tis PCI device number 0 4 5 2 3 Generate Numbers EasyQuant is u 0 1 integers dat n 1000 Generates a file named integers dat with 1000 integer numbers using Quantis USB device num ber 0 4 5 2 4 Generate Scaled Numbers East n0 i integers dat n 1000 nn 1 mes 5 Generates a file named integers dat with 1000 integer numbers whose values are between 1 and 6 4 5 2 5 Generate Extracted Numbers from Quantis device EasyQuantis O 0 i dimtacaics year ma 10 m eRfatle ele Wnsupacsbs elena n 2008 0 1702 Generates with Quantis USB device number 0 a file named integers dat with 10 integer numbers using extraction processing using default_idq_matrix dat matrix file using 2048 x 1972 bits 4 5 2 6 Generate Extracted Numbers from binary file EasyQuantis m default idq matrix dat extraction from file extraction Input ile input dat extraction output ile output dat Reads an binary input file input dat applies extraction processing with default_idq_matrix dat matrix file and saves the result in output dat 47 48 Chapter 5 The Quantis Library
94. tis gt Samples Java In order for Java to be able to use the Quantis library execute the following command which will add the Quantis library to the Java library path export LD LIBRARY PATH SLD LIBRARY PATH lt directory containing libQuantis so gt The location of the Quantis library is explained in section Library location in the chapter The Quantis Library You may also add this line to the bashrc file as you did before when adding Java and Ant to the PATH variable if you want it to be loaded automatically when you open a new shell e Type the command ant The Java archive created is dist Quantis jar Toexecute the program pass the command java jar dist Quantis jar Alternatively type ant run Windows In order to be able to work with Java and Ant you need to add their binaries to the PATH system variable if they aren t there yet Additionally you need to add the directory containing the Quantis libraries to PATH as well 83 Java Sample You can set it in Control Panel gt System Properties gt Tab Advanced gt Environment Variables note that usually you have to be Administrator user to do this Choose or create the variable PATH up per case important under System Variables and add lt path to ant gt bin lt path to ja va gt Ybin lt path to Quantis libs making sure that all entries are separated by a semicolon To find your Quantis libraries refer to chapter The Quantis L
95. tributes 2 Transter Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Device Qualifier for other device speed bLength 10 bDescriptorType 6 ee d Guy 15 We N C eee 4 1S ey fm Mel Vendor Specific Class 32 Mac OS X Operating System GB Q bcdUSB 2 00 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 bNumConfigurations 1 Device Status 0x0000 Bus Powered Please verify that you have the Device Qualifier and Device Status information sections and not messages such as can t get device qualifier Operation not permitted can t get debug descriptor Operation not permitted cannot read device status Operation not permitted If you get one or more Operation not permitted messages you don t have the right per missions to access the Quantis device In such a case Verify that etc udev rules d idq quantis rules or etc udev rules d idq quantis rhel rules exists and has the same content as the one provided on the USB flash drive Verify that your user is in the plugdev group Reboot the system to ensure that the new rules are loaded by the udev daemon You Quantis device is now installed You can go to the next Chapter to install the application software 3 3 Mac OS X Operating System 3 3 1 3 3 2 3 3 3 This section contains instructions on how to install and operate Qua
96. ts integer data type Using a 64 bits platform improve dramatically the performances 7 1 1 Basic Functions This section introduces a minimal set of functions you need to use to process the randomness extrac tion 7 1 1 1 QuantisExtractorGetLibVersion float QuantisExtractorGetLibVersion Returns the version of the library as a number composed of a major and a minor version number The value before the point represents the major version number while the value after the point represents the minor version number 7 1 1 2 QuantisExtractorlnitializeMatrix int32 t QuantisExtractorInitializeMatrix const char matrixFilename uint64 t extractorMatrix ug Gat Matera xS zen uintl6 t matrixSizeOut Reads the extractor matrix from the specified file and store in memory This function allocate the required memory space Use QuantisExtractorUnitializeMatrix to free memory Returns QUANTIS SUCCES on success ora QUANTIS EXT ERROR code on failure Parameters 71 Basic Functions matrixFilename a pointer to a char array representing the path and the filename of the extractor matrix extractorMatrix a pointer to a pointer where the matrix is stored in memory matrixSizeln the number of bits which are input to the extractor matrixSizeOut the number of bits which are output to the extractor 7 1 1 3 QuantisExtractorUnlnitializeMatrix void QuantisExtractorUnInitializeMatrix uint64 t ext
97. u require to Get a progression status during the processing you may require to run the randomness extraction in a thread Create you own matrix file Get multiple time small amount of random data and you want to increase the speed of processing using a temporary buffer QuantisExtractorGetMatrixSizeln uint16_t QuantisExtractorGetMatrixSizeIn Returns the input size in bits of the matrix See QuantisExtractorInitializeMatrix 7 1 2 2 QuantisExtractorGetMatrixSizeOut uintl6 t QuantisExtractorGetMatrixSizeOut Returns the output size in bits of the matrix See QuantisExtractorInitializeMatrix 73 Do Advanced Functions 7 1 2 3 QuantisExtractorComputeBufferSize int32 t QuantisExtractorComputeBufferSize uint32 t numberOfBytesRequested uint32 t numberOfBytesAfterExtraction uint32 t numberOfBytesBeforeExtraction Get the parameters for reading the bytes to perform randomness extraction Returns QUANTIS SUCCES onsuccess ora QUANTIS EXT ERROR code on failure Parameters numberOfBytesRequested the number of bytes to read not larger than QUANTIS MAX READ SIZE numberOfBytesAfterEx the number of bytes that will be output after the extraction traction numberOfBytesBeforeEx the number of bytes required before the extraction traction 7 1 2 4 QuantisExtractorlnitializeOutputBuffer int32 t QuantisExtractorInitializeOutputBuffer uint
98. uint32 t numberOfBytesRequested Return QUANTIS SUCCESS if reading is successful QUANTIS EXT ERROR otherwise Parameters outputBuffer a pointer to the buffer where the read bytes should be written numberOfBytesRequested number of bytes to read TT Do Advanced Functions 7 1 2 17 QuantisExtractorStorageBufferGetSize Get the number of bytes which has been written into the buffer int32_t QuantisExtractorStorageBufferGetSize Return the number of bytes in the storage buffer 7 1 2 18 QuantisExtractorStorageBufferlsEnabled Return the state enabled disabled of the storage buffer int8_t QuantisExtractorStorageBufferIsEnabled Return 0 disabled 1 enabled 78 Chapter 8 Sample Code You will find sample code on how to use each library wrapper in the subdirectory lt path to Quan tis gt Samples In this chapter we give a few further examples and explanations concerning com pilation and usage 8 1 Windows Compilation Execution On Windows use Visual Studio 2008 or Visual Studio 2010 Open the solution file extension sIn for the sample you wish to compile e g if you want to use the C example open the file QuantisDemo sin For VB Net and C you don t need to do any further configuration just build the solutions You will get an executable called Quant isDemo exe which is located in the same directory as the solution file Double click on it to e
99. umber int modulesMask Enable one or more modules Returns QUANTIS SUCCES on success or a QUANTIS_ERROR code on failure Parameters deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 modulesMask a bitmask of the modules as specified in the Quant isGet ModulesMask function that are to be enabled QuantisModulesReset Do 5 4 9 QuantisModulesReset int QuantisModulesReset QuantisDeviceType deviceType unsigned int deviceNumber int modulesMask Reset one or more modules Returns QUANTIS SUCCES on success or a QUANTIS ERROR code on failure Parameters deviceType the type PCI or USB of the Quantis device deviceNumber the number of the Quantis device Note that device numbering starts at 0 modulesMask a bitmask of the modules as specified in the Quant isGet ModulesMask function that are to be reset This function executes sequentially Quant isModuleDisable and Quant isMod uleEnable with the given parameters 5 5 Recompiling the Quantis Library 5 5 1 Windows compilation with Visual Studio 2008 Before compiling the Quantis libraries you have prepare your machine described below If you already have some of these components you may of course skip the relevant section Installing the Windows Driver Kit 7 0 Download the Windows Driver Kit version 7 0 0 It comes as an iso
100. umbers ranging between 2 147 483 648 and 2 147 483 647 inclusive Floating point numbers Generates numbers between 0 0 inclusive and 1 0 exclusive The EasyQuantis Command Line Do 3 Select a data separator Comma separated values CSV CSV is a type of delimited text data which uses a comma to separate subsequent values The benefit of CSV is that they allow for the transfer of data across different applications The following is an example of CSV Valuel Value2 Value3 ValueN One entry per line Each value is on a separate line Valuel Value2 Value3 ValueN g When generating binary data you cannot select a data separator 4 If needed you can scale the random values to be within a smaller range o For more details about the scaling algorithms please refer to section 5 3 7 2 1 Inte gral Values The Scaling Algorithm 5 Select the data destination Display Data is displayed on screen You can copy paste the data to your application Use this option for small amounts of random data that you want to use it right away This option is not available for binary data Save to file The data is written to a file Use this option to generate large amounts of random data or to generate data for later use On some systems Mac OS X Windows the temporary default directory is not very convenient and should probably changed to a better suited one This will ease
101. ver software How do you want to search for driver software gt Search automatically for updated driver software i Windows will search your computer and the Internet for the latest driver software for your device unless you ve disabled this feature in your device installation settings gt Browse my computer for driver software Locate and install driver software manually 3 1 3 5 Update Driver Software Search Location Click the button Browse an select the directory D Drivers Windows This directory contains all drivers for Windows Activate the option Include subfolders and validate your choices by clicking the Next button 16 Windows 7 CDa Browse for driver software on your computer Search for driver software in this location D Drivers Windows v Browse 7 Include subfolders Y Let me pick from a list of device drivers on my computer This list will show installed driver software compatible with the device and all driver software in the same category as the device 3 1 3 6 Update Driver Software Installation Wait while the Windows installs the driver Installing driver software PE 3 1 3 7 Update Driver Software Completed When the wizard has finished installing the Quantis driver click the Close button to exit the installa tion Reboot the computer if asked 17 Bo Windows 8 l Update Driver Software Quantis USB R
102. version 4 3 4 To solve this issue you need to install Qt4 version 4 3 4 or newer If Qt version 4 3 4 or newer is not available on your system you can still use EasyQuantis in command line mode which is not affected by this issue Please refer to Section 4 5 The EasyQuantis Command Line This issue can also be solved by recompiling the Quantis library and EasyQuantis on your system A 2 Quantis Samples A 2 1 A 2 2 When I try to run the C sample code after a successful build it crashes and gives me an Access Violation error What should I do If the C sample crashes upon build and you get an Access Violation error restart VS2010 in administrator mode since there is some memory that cannot be accessed by a normal user To do that right click on the VS2010 icon and choose Run in administrator mode Then reopen your solution project and proceed as normal Tam on a Windows 64 bits machine When I execute the Java sample I get JNI related errors What should I do This error occurs on some Windows 64 bits systems and can be solved by recompiling the Quantis libraries on your own machine Instructions for recompiling the library can be found in chapter The Quantis Library in section Recompiling the Quantis Library 85 86 Appendix B Frequently Asked Questions FAQ B 1 Quantis Library B 1 1 Can I use the 32 bit Quantis library on a 64 bit system Yes you can use the 32 bit Quantis libr
103. viceType int quantisGetModules int QuantisGetModulesMask int cardNumber QuantisDeviceType deviceType unsigned int deviceNumber char quantisGetSerialNumber char QuantisGetSerialNumber int cardNumber QuantisDeviceType deviceType unsigned int deviceNumber int quantisLibVersion float QuantisGetLibVersion int quantisModuleDataRate int QuantisGetModulesDataRate int cardNumber QuantisDeviceType deviceType unsigned int deviceNumber int quantisModulesDisable int QuantisModulesDisable int cardNumber QuantisDeviceType deviceType int moduleMask unsigned int deviceNumber int modulesMask int quantisModulesEnable int QuantisModulesEnable int cardNumber QuantisDeviceType deviceType int moduleMask unsigned int deviceNumber int modulesMask int quantisModulesPower int QuantisGetModulesPower int cardNumber QuantisDeviceType deviceType unsigned int deviceNumber int quantisModulesReset int QuantisModulesReset int cardNumber QuantisDeviceType deviceType int moduleMask unsigned int deviceNumber int modulesMask int quantisModulesStatus int QuantisGetModulesStatus int cardNumber QuantisDeviceType deviceType unsigned int deviceNumber int quantisRead int QuantisRead int cardNumber QuantisDevic
104. vices and printers 19 Bo Windows 8 t Ed gt Control Panel gt vw O Search Control Panel Adjust your computer s settings View by Category v System and Security User Accounts and Family Safety fa Change account type ay Set up Family Safety for any user Review your computer s status Save backup copies of your files with File History Find and fix problems Appearance and Personalisation Change the theme Change desktop background Adjust screen resolution Network and Internet View network status and tasks Choose homegroup and sharing options Clock Lan e and Region Hardware and Sound D he pest and Regio View devices and printers Add a device Change input methods Change date time or number formats Ease of Access Let Windows suggest settings Optimise visual display Programs Uninstall a program Click on the Quantis device with the right mouse button Select Properties on the menu v T fs lt Hard Devices Add a device Ev 4 Unspecified 1 Create shortcut Troubleshoot 3 1 4 2 1 Quantis USB Properties Hardware In the Quantis Properties dialog click on the Hardware tab and then on the Properties 20 Windows 8 The drivers for this device are not installed Code 28 To find a driver for this device click Update Driver Update Driver or Cms 3 1 4 2 2 Quantis USB Properties Update Driver First
105. with libusb 1 0 libusb 0 1 is the legacy release and is not developed any more As of December 2008 libusb 1 0 is the current stable branch This new branch used to access the Quantis USB adds features missing in the first release libusb 1 0 is only available on Debian Squeeze and newer releases It is also available on Debian lenny backports Please refer to the Debian help on how to enable backports packages On all other Debian releases you need to manually install libusb 1 0 Please refer to Section 3 2 2 1 4 Manua USB support in the kernel is gene emabled o od http libusb org wiki Libusb1 0 30 Quantis USB CDa o9 libusb 1 0 is only available on Ubuntu Jaunty 9 04 and newer releases On previous Ubuntu releases you need to manually install libusb 1 0 Please refer to Section 3 2 2 1 4 Manually Compile libusb 1 0 Type the following command as root to install libusb 1 0 and the development package needed if you want to write your own application using the Quantis libraries L apt get install Ixbusb 1 0 0 libusb 1 0 0 dev 3 2 2 1 2 Red Hat Enterprise Linux and CentOS Distributions libusb 1 0 is currently not available on Red Hat Enterprise Linux nor CentOS distributions You need to manually install libusb 1 0 Please refer to Section 3 2 2 1 4 Manually Compile libusb 1 0 3 2 2 1 3 Other Distributions Use the package manager of your distribution to install the library libus
106. xecute it For the C C samples proceed as follows Make sure to add the path path to Quan tis NLibs AppsNQuantis to your VC include directories and path to Quantis NLibs AppsNQuantisN your system arch to your VC library directories Also add path to Quantis NLibs AppsNQuan tis lt your system arch NQuantis lib to your Linker input additional dependencies in Visual Studio Now build the solution This will create an executable called ORNG exe Execute it from your command prompt as follows ORNG exe device type device number mow where you substitute the type by u or p for USB device or PCI device and the number by your device number The Java Sample compilation is described further below since it is system independent The C 11 sample can in principle be executed similarly to the C sample but since the necessary features of C 11 are not yet enabled in VS2008 or in VS2010 it will be executed as normal C code To use the actual C 11 features you would need to recompile the Quantis library Further details on how to do this can be found under the section The C random_device interface 8 1 1 Visual Studio 2008 vs 2010 The Samples available for Visual Studio have been created under VS2008 but they are also compatible with 2010 8 2 Linux Solaris OpenSolaris FreeBSD compilation and execution The VB Net and C samples can t be compiled on Unix based systems

Download Pdf Manuals

image

Related Search

Related Contents

Gaggenau Combi-steam oven BS 474 User's Manual  SRE 10x C*  PDFカタログはこちら(1.1MB)  programa de tecnologias informáticas 10º - 11º - Direção  Acer Aspire ES1-511-C1MS  Developing code for the element14/Freescale XL_STAR  Samsung MM-G35 User Manual  Broan 373001 Instructions / Assembly  austroads test method ag:am/t013 pavement surface texture  Instruction Manual P6207 FET Probe 070-7909-02  

Copyright © All rights reserved.
Failed to retrieve file