[openssl-users] Linker error when adding new cipher to crypto folder

Michael Wojcik Michael.Wojcik at microfocus.com
Fri Dec 30 19:43:12 UTC 2016

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:openssl-users-bounces at openssl.org] On Behalf Of Schmicker, Robert
Sent: Thursday, December 29, 2016 21:38
To: openssl-users at openssl.org
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<http://build.info> for make to compile my code (created this based off of openssl/crypto/dh’s build.info<http://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
Compiled as:
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.

I feel like I’m missing a step here…

Any help is much appreciated!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20161230/d8fa7443/attachment.html>

More information about the openssl-users mailing list