4

I want to build an OpenSSL RSA engine, starting from this existing source code file which is a faster method implemented by Intel. First of all I want to build this code so I'm using these commands:

gcc -fPIC -m64 -o eng_rsax.o -c eng_rsax.c
gcc -shared -o eng_rsax.so -lcrypto eng_rsax.o

... and no error shows up. Then, when I'm trying to test the engine by using the command:

openssl engine -t -c `pwd`/eng_rsax.so

... I receive the following errors:

140470207960736:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(/some_path/eng_rsax.so): /some_path/eng_rsax.so: undefined symbol: mod_exp_512
140470207960736:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:
140470207960736:error:260B6084:engine routines:DYNAMIC_LOAD:dso not found:eng_dyn.c:450:
140470207960736:error:2606A074:engine routines:ENGINE_by_id:no such engine:eng_list.c:417:id=/some_path/eng_rsax.so

At this point I guess I'm not using the right flags and maybe the commands for building the engine are incomplete.
What do I need to do in order to make this work?

jww
  • 97,681
  • 90
  • 411
  • 885
Dani Grosu
  • 544
  • 1
  • 4
  • 22
  • It looks like its partially a path problem. Perhpas you can `LD_LIBRARY_PATH="$(pwd):LD_LIBRARY_PATH" openssl engine -t -c `pwd`/eng_rsax.so` – jww Mar 07 '16 at 00:52
  • Thank you for commenting, but the error is still there. – Dani Grosu Mar 08 '16 at 14:04

1 Answers1

1

In order to make this work, I just implemented the body of mod_exp_512 function at line 260 by adding {} instead of ;. I used the same commands:

gcc -fPIC -m64 -o eng_rsax.o -c eng_rsax.c
gcc -shared -o eng_rsax.so -lcrypto eng_rsax.o
Dani Grosu
  • 544
  • 1
  • 4
  • 22