<div dir="ltr">Hello,<div>I have a custom rsa engine. It builds and works fine. Later, I have added a static library with my custom engine code. My code compiles. However, when I try to load the custom engine it shows <b>invalid engine "rsa-engine-new".  </b>The full error is given below,</div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>x@x:~/Downloads/x/x/x/rsa_engine$ openssl rsautl -decrypt -inkey private.pem -in msg.enc -engine rsa-engine-new<br>invalid engine "rsa-engine-new"<br>140112744122112:error:25066067:DSO support routines:dlfcn_load:could not load the shared library:crypto/dso/dso_dlfcn.c:119:filename(/opt/openssl/lib/engines-1.1/rsa-engine-new.so): /opt/openssl/lib/engines-1.1/rsa-engine-new.so: undefined symbol: dune_init<br>140112744122112:error:25070067:DSO support routines:DSO_load:could not load the shared library:crypto/dso/dso_lib.c:162:<br>140112744122112:error:260B6084:engine routines:dynamic_load:dso not found:crypto/engine/eng_dyn.c:414:<br>140112744122112:error:2606A074:engine routines:ENGINE_by_id:no such engine:crypto/engine/eng_list.c:334:id=rsa-engine-new<br>140112744122112:error:25066067:DSO support routines:dlfcn_load:could not load the shared library:crypto/dso/dso_dlfcn.c:119:filename(librsa-engine-new.so): librsa-engine-new.so: cannot open shared object file: No such file or directory<br>140112744122112:error:25070067:DSO support routines:DSO_load:could not load the shared library:crypto/dso/dso_lib.c:162:<br>140112744122112:error:260B6084:engine routines:dynamic_load:dso not found:crypto/engine/eng_dyn.c:414:<br></div></blockquote></div><div><br></div><div>Now the error doesn't say much about the cause of invalid engine. However my guess is it is from the  "<b>undefined symbol: dune_init</b>". "dune_init" is from the static library. Therefire I believe my linking is not working. I use the following Makefile to compile the engine,</div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><ol><li>rsa-engine: rsa/rsa.c rsa/bignum.c rsa/aes.c rsa/x509parse.c rsa/pem.c</li><li>  gcc -fPIC -o rsa/rsa.o -c rsa/rsa.c</li><li>        gcc -fPIC -o rsa/bignum.o -c rsa/bignum.c</li><li>  gcc -fPIC -o rsa/aes.o -c rsa/aes.c</li><li>        gcc -fPIC -o rsa/x509parse.o -c rsa/x509parse.c</li><li>    gcc -fPIC -o rsa/pem.o -c rsa/pem.c</li><li>        gcc -fPIC -c rsa-engine.c</li><li>  gcc -shared -o librsa_engine.so libdune/libdune.a -lcrypto rsa-engine.o rsa/rsa.o rsa/bignum.o rsa/aes.o rsa/x509parse.o rsa/pem.o </li><li>       mv librsa_engine.so rsa-engine-new.so</li><li>      sudo cp rsa-engine-new.so /opt/openssl/lib/engines-1.1/</li><li>clean: </li><li>        rm -f *.o rsa/*.o *.so rsa-engine</li></ol></div></blockquote>So, can anyone please if my guess is correct or not? If my guess is correct, how can I fix my Makefile? </div><div><br></div><div>N.B: Static library </div><div><ul><li>libdune/libdune.a is in the same directory with the main rsa-engine.c </li><li>libdune/libdune.a is compiled with -fPIC flag</li></ul><div><br></div></div><div>Thanks,</div><div>Shariful</div></div>