Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Library and pgm #2036

    ekinox777
    Member

    Using this library I get an output speed of ~406kbs, while using /dev/random (enabling truerng through rng-tool) I get only ~80kbs. (without truerng the speed of /dev/random is very low, ~3-4 bytes/s).
    Why there is such a big diference? Why does entropy pool not use all available output of TrueRNG?

    in reply to: Library and pgm #2035

    ekinox777
    Member

    Thank you for your help!
    The linking is working now without errors.

    Regarding libudev:
    I built the library without libudev or libusb.
    When I try to build the library WITH libudev “make all” works w/o errors but “make check” fails.
    when running the binary file I get this error:

    mihai@bhairava:~/Soft/TrueRNG/truerng-2.0$ src.bin/truerng --list
    
    Searching...
    lt-truerng: truerng_open.c:196: truerng_libudev: Assertion 'Serial_found != NULL' failed.
    Aborted (core dumped)

    Built without libudev or libusb I get no errors, but it is unable to detect ids and serial:

    mihai@bhairava:~/Soft/TrueRNG/truerng-2.0$ src.bin/truerng --list
    
    Searching...
    file path : /dev/TrueRNG
    idVendor  : <unknown>
    idProduct : <unknown>
    Product   : <unknown>
    Serial    : <unknown>
    
    Configuring...
    state     : ON
    mode      : NORMAL  300 baud

    Perhaps it is because I use a TrueRNG v3(?)

    Anyway, I can use now the library. , which seems to give a higher bitrate than using /dev/random (via rng-tools).

    gratefully yours,
    Mihai

    in reply to: Library and pgm #2030

    ekinox777
    Member

    Hello!
    Thank you for your work. I’m trying to test your library but without succes. I know some c++ but lack skills in compiling and linking. I couldn’t successfully build a simple program dynamically or statically linking.
    I’m trying with gcc, under Ubuntu.
    Here is the code main.cpp:

    #include <cstdlib>
    #include "truerng.h"
    #include <iostream>
    
    using namespace std;
    
    /*
     * 
     */
    int main(int argc, char** argv) {
        unsigned int nb_bytes =10;
        unsigned char buf[(nb_bytes)];
        int rc;
        //rc = truerng(buf, sizeof(buf));
        rc = truerng_bytes(TRUERNG_PATH_DEFAULT, TRUERNG_ID_ANY, TRUERNG_ID_ANY, TRUERNG_SERIAL_ANY, buf, sizeof(buf));
       for (int i=0;i<nb_bytes;i++) cout << buf[i];
        return 0;
    }

    Trying to link statically I get:

    g++ -Wl,-static libtruerng.a main.o -o trng 
    /usr/bin/ld: cannot find -lgcc_s
    /usr/bin/ld: cannot find -lgcc_s
    collect2: error: ld returned 1 exit status
    

    Trying to link dynamically I get:

    
    g++  -ltruerng main.cpp -o trng 
    main.cpp: In function ‘int main(int, char**)’:
    main.cpp:28:114: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        rc = truerng_bytes(TRUERNG_PATH_DEFAULT, TRUERNG_ID_ANY, TRUERNG_ID_ANY, TRUERNG_SERIAL_ANY, buf, sizeof(buf));
                                                                                                                     ^
    /tmp/ccRtZRGs.o: In function 
    'main':
    main.cpp:(.text+0xaf): undefined reference to 'truerng_bytes(char*, unsigned short, unsigned short, char*, unsigned char*, unsigned long)'
    collect2: error: ld returned 1 exit status

    All the files (truerng.h, main.cpp, libtruerng.a, libtruerng.so, libtruerng.so.2.0.0) are in the same folder.

    I tried to understand the compiling and linking of the binary pgm “truerng” but it seems too complicated for my skills. Is there a simple way to compile and link my example, without using makefile and libtool?

    cheers,
    Mihai

    • This reply was modified 7 years, 2 months ago by  ekinox777.
    • This reply was modified 7 years, 2 months ago by  ekinox777.
    • This reply was modified 7 years, 2 months ago by  ekinox777.
Viewing 3 posts - 1 through 3 (of 3 total)