Re: Linker error when adding new cipher to crypto folder
The header is irrelevant to linking, unless it contains macros that change the names of external symbols.
My guess is that you need -L/usr/local/openssl/lib, or something along those lines, on your gcc command line. I suspect you're linking against normal OpenSSL
libraries installed elsewhere on your system, and not against the ones you built.
This is not specific to OpenSSL, by the way; it's all standard UNIX / Linux library use.
Michael Wojcik Distinguished Engineer, Micro Focus
From: openssl-users [mailto:[hidden email]]
On Behalf Of Schmicker, Robert Sent: Thursday, December 29, 2016 21:38 To:[hidden email] Subject: [openssl-users] Linker error when adding new cipher to crypto folder
I am attempting to add a new cipher into the crypto library. I have done the following so far…
1. Added my code to the openssl/crypto folder
2. Created a build.info for make to compile my code (created this based off of openssl/crypto/dh’s build.info)
3. Added my cipher name to the list of ciphers to compile in Configure
4. Compiled and installed all code without errors and object files for my new cipher are created in openssl/crypto/mycipher/
5. Created a test.c file that verifies that the library is installed and working properly by generating a MD5 hash of a string
gcc test.c -I/usr/local/openssl/include/openssl/ -o test -lcrypto -lssl -Wall
6. I am able to properly include <openssl/mycipher.h> in my test.c file
However, as soon as I make a call to my cipher in test.c I get a linker error and gcc is unable to find any of my functions.
It seems that the header file I have in the openssl/include folder isn’t being linked somehow to my code in the openssl/cypto folder.