[openssl-dev] Errors when loading an OpenSSL RSA Engine

Richard Levitte levitte at openssl.org
Thu Mar 10 10:53:44 UTC 2016


In message <1457601549609-64535.post at n7.nabble.com> on Thu, 10 Mar 2016 02:19:09 -0700 (MST), danigrosu <dni.grosu at gmail.com> said:

dni.grosu> Blumenthal, Uri - 0553 - MITLL wrote
dni.grosu> > But autotools setup did not work (see my
dni.grosu> > previous post in this thread). Perhaps Richard could shed some light on
dni.grosu> > that.
dni.grosu> 
dni.grosu> I just did what that guy said and it worked. Basically I created a "m4"
dni.grosu> directory
dni.grosu> and I copied the "ax_check_openssl.m4" file to the "m4" directory, then I
dni.grosu> used
dni.grosu> the "autoreconf -fi -I m4" command, then ./configure, then make.
dni.grosu> -- "ax_check_openssl.m4" can be found here 
dni.grosu> autoconf-archive-2015.09.25.tar.xz
dni.grosu> <http://gnu.mirrors.linux.ro/autoconf-archive/>  
dni.grosu> 
dni.grosu> 
dni.grosu> Blumenthal, Uri - 0553 - MITLL wrote
dni.grosu> > Regarding RSA-X engine, it lacks the dynamic binding code necessary for
dni.grosu> > being loaded, etc. That’s why it fails to load. Check the contents of
dni.grosu> > e_md5.c and eng_rsax.c for differences.
dni.grosu> > 
dni.grosu> > $ OPENSSL_ENGINES=. openssl engine -t -c rsax
dni.grosu> > (rsax) RSAX engine support
dni.grosu> >  [RSA]
dni.grosu> >      [ available ]
dni.grosu> > $ 
dni.grosu> 
dni.grosu> Be aware that the name "rsax" is the name of the engine that OpenSSL
dni.grosu> already knows. Try to change it's name to something else, e.g. "rsax_smth".
dni.grosu> I get the same error after I change it's name to "rsax_dani":
dni.grosu> 
dni.grosu> /140334964717216:error:25066067:DSO support routines:DLFCN_LOAD:could not
dni.grosu> load the shared library:dso_dlfcn.c:185:filename(./librsax_dani.so):
dni.grosu> ./librsax_dani.so: cannot open shared object file: No such file or directory
dni.grosu> 140334964717216:error:25070067:DSO support routines:DSO_load:could not load
dni.grosu> the shared library:dso_lib.c:244:
dni.grosu> 140334964717216:error:260B6084:engine routines:DYNAMIC_LOAD:dso not
dni.grosu> found:eng_dyn.c:450:
dni.grosu> 140334964717216:error:2606A074:engine routines:ENGINE_by_id:no such
dni.grosu> engine:eng_list.c:417:id=rsax_dani/
dni.grosu> 
dni.grosu> Then I tryed to use the following macros in order to dynamically bind
dni.grosu> the engine (as I saw in the md5 engine):
dni.grosu> 
dni.grosu> /IMPLEMENT_DYNAMIC_BIND_FN(bind_helper)
dni.grosu> IMPLEMENT_DYNAMIC_CHECK_FN()/
dni.grosu> 
dni.grosu> I changed the "bind_helper" function to be exactly like "bind" function
dni.grosu> from the md5 engine => /static int bind_helper(ENGINE *e, const char *id)/
dni.grosu> and I get this error message:
dni.grosu> 
dni.grosu> /eng_rsax.c: In function ‘ENGINE_rsax’:
dni.grosu> eng_rsax.c:178:2: error: too few arguments to function ‘bind_helper’
dni.grosu>   if(!bind_helper(ret))
dni.grosu>   ^
dni.grosu> eng_rsax.c:142:12: note: declared here
dni.grosu>  static int bind_helper(ENGINE *e, const char *id)
dni.grosu>             ^
dni.grosu> 140334964717216:error:25066067:DSO support routines:DLFCN_LOAD:could not
dni.grosu> load the shared library:dso_dlfcn.c:185:filename(./librsax_dani.so):
dni.grosu> ./librsax_dani.so: cannot open shared object file: No such file or directory
dni.grosu> 140334964717216:error:25070067:DSO support routines:DSO_load:could not load
dni.grosu> the shared library:dso_lib.c:244:
dni.grosu> 140334964717216:error:260B6084:engine routines:DYNAMIC_LOAD:dso not
dni.grosu> found:eng_dyn.c:450:
dni.grosu> 140334964717216:error:2606A074:engine routines:ENGINE_by_id:no such
dni.grosu> engine:eng_list.c:417:id=rsax_dani/

Yeah, the Intel seem to have been inspired by engines/e_chil.c but
only kept the static engine parts.

bind_helper in e_chil. is exactly that, a helper, and wasn't
originally designed to be given directly to IMPLEMENT_DYNAMIC_BIND_FN.
I'm not saying you did anything wrong, though...  I'm just giving you
some historical context.

The issue is easily fixed by adding a parameter in the problematic
call, like this:

  if(!bind_helper(ret, engine_e_rsax_id))

Cheers,
Richard

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


More information about the openssl-dev mailing list