DHerr(DH_F_DH_NEW,ERR_R_MALLOC_FAILURE);
return(NULL);
}
- if(engine)
- ret->engine = engine;
+
+ if (engine)
+ {
+ if(ENGINE_init(engine))
+ ret->engine = engine;
+ else
+ ret->engine = NULL;
+ }
else
+ ret->engine=ENGINE_get_default_DH();
+ if(ret->engine == NULL)
{
- if((ret->engine=ENGINE_get_default_DH()) == NULL)
- {
- DHerr(DH_F_DH_NEW,ERR_LIB_ENGINE);
- OPENSSL_free(ret);
- return NULL;
- }
+ DHerr(DH_F_DH_NEW,ERR_LIB_ENGINE);
+ OPENSSL_free(ret);
+ return NULL;
}
meth = ENGINE_get_DH(ret->engine);
ret->pad=0;
DSAerr(DSA_F_DSA_NEW,ERR_R_MALLOC_FAILURE);
return(NULL);
}
- if(engine)
- ret->engine = engine;
+
+ if (engine)
+ {
+ if(ENGINE_init(engine))
+ ret->engine = engine;
+ else
+ ret->engine = NULL;
+ }
else
+ ret->engine=ENGINE_get_default_DSA();
+
+ if(ret->engine == NULL)
{
- if((ret->engine=ENGINE_get_default_DSA()) == NULL)
- {
- DSAerr(DSA_F_DSA_NEW,ERR_LIB_ENGINE);
- OPENSSL_free(ret);
- return NULL;
- }
+ DSAerr(DSA_F_DSA_NEW,ERR_LIB_ENGINE);
+ OPENSSL_free(ret);
+ return NULL;
}
+
meth = ENGINE_get_DSA(ret->engine);
ret->pad=0;
ret->version=0;
return(NULL);
}
- if (engine == NULL)
+ if (engine)
{
- if((ret->engine=ENGINE_get_default_RSA()) == NULL)
- {
- RSAerr(RSA_F_RSA_NEW_METHOD,ERR_LIB_ENGINE);
- OPENSSL_free(ret);
- return NULL;
- }
+ if(ENGINE_init(engine))
+ ret->engine = engine;
+ else
+ ret->engine = NULL;
}
else
- ret->engine=engine;
+ ret->engine=ENGINE_get_default_RSA();
+
+ if(ret->engine == NULL)
+ {
+ RSAerr(RSA_F_RSA_NEW_METHOD,ERR_LIB_ENGINE);
+ OPENSSL_free(ret);
+ return NULL;
+ }
+
meth = ENGINE_get_RSA(ret->engine);
ret->pad=0;