Aleix Conchillo Flaque <[EMAIL PROTECTED]> writes:
>
> ENGINE*
> setup(char const* engine)
> {
> if (::ENGINE_by_id(engine) == NULL)
> {
> return NULL;
> }
>
> ENGINE* e = ::ENGINE_by_id("dynamic");
> if (e)
> {
> if (!::ENGINE_ctrl_cmd_string(e, "SO_PATH", engine.c_str(), 0)
> || !::ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0))
> {
> // fails in here
> e = NULL;
> }
> }
> return e;
> }
>
i found the error. by the way, a dummy one. ENGINE_by_id already loads
the shared library, so the function should look like this:
ENGINE*
setup(std::string const& engine)
{
ENGINE* e = NULL;
if ((e = ::ENGINE_by_id(engine.c_str())) == NULL)
{
return NULL;
}
std::string err;
// if engine was not found try to load the shared library
if (e == NULL)
{
e = ::ENGINE_by_id("dynamic");
if ((e == NULL)
|| !::ENGINE_ctrl_cmd_string(e, "SO_PATH", engine.c_str(), 0)
|| !::ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0))
{
err = "Unable to load engine dynamic library: " + engine;
::ENGINE_free(e);
e = NULL;
}
}
if (e == NULL)
{
throw engine_exception(err);
}
return e;
}
regards,
aleix
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]