[openssl-dev] Linker error when adding new cipher in crypto folder

Richard Levitte levitte at openssl.org
Fri Dec 30 12:47:40 UTC 2016


In message <B5AC3FBD-33F9-4377-AEB3-E2671DE0926F at unh.newhaven.edu> on Fri, 30 Dec 2016 02:36:45 +0000, "Schmicker, Robert" <rschm2 at unh.newhaven.edu> said:

rschm2> Hello,
rschm2> 
rschm2> I am attempting to add a new cipher into the crypto library. I have
rschm2> done the following so far…
rschm2> 
rschm2> 1. Added my code to the openssl/crypto folder
rschm2> 2. Created a build.info for make to compile my code (created this
rschm2> based off of openssl/crypto/dh’s build.info)
rschm2> 3. Added my cipher name to the list of ciphers to compile in Configure
rschm2> 4. Compiled and installed all code without errors and object files for
rschm2> my new cipher are created in openssl/crypto/mycipher/
rschm2> 5. Created a test.c file that verifies that the library is installed
rschm2> and working properly by generating a MD5 hash of a string
rschm2> Compiled as:
rschm2> gcc test.c -I/usr/local/openssl/include/openssl/ -o test -lcrypto -
rschm2> lssl -Wall
rschm2> 6. I am able to properly include <openssl/mycipher.h> in my test.c
rschm2> file
rschm2> 
rschm2> However, as soon as I make a call to my cipher in test.c I get a
rschm2> linker error and gcc is unable to find any of my functions.
rschm2> 
rschm2> It seems that the header file I have in the openssl/include folder
rschm2> isn’t being linked somehow to my code in the openssl/cypto folder.
rschm2> 
rschm2> I feel like I’m missing a step here…
rschm2> 
rschm2> Any help is much appreciated!

On way is to, as already mentioned, edit util/libcrypto.num.  The
other is to edit util/mkdef.pl and then run 'make update'.  In
mkdef.pl, you'll find a bunch of lines like this:

    $crypto.="include/openssl/whatever.h"

Simply add a line like that for mycipher.h.

(note: mkdef.pl might be a bit picky sometimes)

Cheers,
Richard

-- 
Richard Levitte         levitte at openssl.org
OpenSSL Project         http://www.openssl.org/~levitte/


More information about the openssl-dev mailing list