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

2017-01-10 Thread Schmicker, Robert

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<http://build.info> for make to compile my code 
(created this
rschm2> based off of openssl/crypto/dh?s build.info<http://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  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!

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

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

levitte>Simply add a line like that for mycipher.h.

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

levitte>Cheers,
levitte>Richard

levitte>--
levitte>Richard Levitte levi...@openssl.org<mailto:levi...@openssl.org>
levitte>OpenSSL Project http://www.openssl.org/~levitte/

Hello,

I would just like to thank Richard Levitte and Viktor for their help as I was 
finally able to figure it out. In case anyone else would like this same process 
I have included some general documentation below:

1) git clone openssl project
2) edit util/mkdef.pl<http://util/mkdef.pl> for  header 
file (header file must be extern and have (void) in function declaration if no 
arguments are being passed)
3) edit Configure (line 313ish) and add in crypto function amongst others
4) create build.info<http://build.info/> under /crypto/mycipher/ (follow other 
crypto build.info<http://build.info>’s to create)
5) ./config
6) make update
7) make -j 

Rob

On Dec 31, 2016, at 5:52 PM, 
openssl-dev-requ...@openssl.org<mailto:openssl-dev-requ...@openssl.org> wrote:

Re: Linker error when adding new cipher in crypto folder

-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


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

2016-12-30 Thread Richard Levitte
In message  on Fri, 30 
Dec 2016 02:36:45 +, "Schmicker, Robert"  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  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 levi...@openssl.org
OpenSSL Project http://www.openssl.org/~levitte/
-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev


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

2016-12-29 Thread Viktor Dukhovni

> On Dec 29, 2016, at 9:36 PM, Schmicker, Robert  
> wrote:
> 
> 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.

Edit util/libcrypto.num and/or util/libssl.num, only the symbols listed there
are exported by the library shared objects.

-- 
Viktor.

-- 
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev