Generate Random no using the OpenSSL api

Discussion in 'Programming' started by rahuldas14, May 31, 2012.

  1. #1
    I have been trying to generate random no using openssl api.

    I have this in my header:

    #include <openssl/rand.h>
    #include <openssl/ssl.h>

    Code is:
    result = RAND_bytes(buffer, 5);

    Compile it by:
    g++ -o test test.cpp -lssl

    I get the following errors:
    test.cpp:(.text+0x71): undefined reference to `RAND_bytes'
    collect2: ld returned 1 exit status


    Please help.
     
    rahuldas14, May 31, 2012 IP