I am not sure why I am geting the following errors when I try to call
functions that are included by OpenSSL. I basically copied the code out
of the O'Reilly OpenSSL book, so the code should be okay. I have
included the OpenSSL EVP headers (and even tried to include all the
digest headers) but I still get this compile error.

I have been working off the assumption that it is an include error but
nothing I try fixes it. I have tried to include <openssl/evp.h> and
"/usr/include/openssl/evp.h".

Here is the compile error:


/usr/qt/3/bin/uic form1.ui -o form1.h
g++ -c -pipe -Wall -W -march=pentium3 -pipe -O2  -DQT_NO_DEBUG
-I/usr/qt/3/mkspecs/linux-g++ -I. -I. -I/usr/qt/3/include -o hasher.o
hasher.cpp
/usr/qt/3/bin/uic form1.ui -i form1.h -o form1.cpp
g++ -c -pipe -Wall -W -march=pentium3 -pipe -O2  -DQT_NO_DEBUG
-I/usr/qt/3/mkspecs/linux-g++ -I. -I. -I/usr/qt/3/include -o form1.o
form1.cpp
/usr/qt/3/bin/moc form1.h -o moc_form1.cpp
g++ -c -pipe -Wall -W -march=pentium3 -pipe -O2  -DQT_NO_DEBUG
-I/usr/qt/3/mkspecs/linux-g++ -I. -I. -I/usr/qt/3/include -o moc_form1.o
moc_form1.cpp
g++  -o hasher hasher.o form1.o moc_form1.o   -L/usr/qt/3/lib
-L/usr/X11R6/lib -lqt -lXext -lX11 -lm
form1.o(.text+0x2cb): In function `Form1::computeHash(QString, QString)':
: undefined reference to `OpenSSL_add_all_digests'
form1.o(.text+0x2de): In function `Form1::computeHash(QString, QString)':
: undefined reference to `EVP_get_digestbyname'
form1.o(.text+0x305): In function `Form1::computeHash(QString, QString)':
: undefined reference to `EVP_DigestInit'
form1.o(.text+0x323): In function `Form1::computeHash(QString, QString)':
: undefined reference to `EVP_DigestUpdate'
form1.o(.text+0x335): In function `Form1::computeHash(QString, QString)':
: undefined reference to `EVP_DigestFinal'
collect2: ld returned 1 exit status
make: *** [hasher] Error 1



Here is the function where I call the (er!!) functions:


QString Form1::computeHash(QString hash_algorithm, QString hash_input )
{

    //Declare Local Variables
    const EVP_MD *m;
    EVP_MD_CTX ctx;
    unsigned char *ret;
    unsigned int *ret_len = 0;
    const char *input = hash_input.ascii();
    const char *change_ret;


    OpenSSL_add_all_digests();

    if (!(m = EVP_get_digestbyname(hash_algorithm.ascii())))
    return NULL;

    if (!(ret=(unsigned char *)malloc(EVP_MAX_MD_SIZE)))
    return NULL;

    EVP_DigestInit(&ctx, m);

    EVP_DigestUpdate(&ctx, input, strlen(input));

    EVP_DigestFinal(&ctx, ret, ret_len);

    change_ret = ( const char*) ret;
    return QString::fromLatin1(change_ret, -1);

}

It's probably a simple C++ error that I am forgetting about.


Thanks in advance,
Cutaway
-- 
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to