* to stealing the "best available" method. Will fallback
* to DSO_METH_null() in the worst case. */
default_DSO_meth = DSO_METHOD_openssl();
- ret = (DSO *)Malloc(sizeof(DSO));
+ ret = (DSO *)OPENSSL_malloc(sizeof(DSO));
if(ret == NULL)
{
DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE);
{
/* sk_new doesn't generate any errors so we do */
DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE);
- Free(ret);
+ OPENSSL_free(ret);
return(NULL);
}
if(meth == NULL)
ret->references = 1;
if((ret->meth->init != NULL) && !ret->meth->init(ret))
{
- Free(ret);
+ OPENSSL_free(ret);
ret=NULL;
}
return(ret);
sk_free(dso->meth_data);
- Free(dso);
+ OPENSSL_free(dso);
return(1);
}
return(1);
}
-DSO *DSO_load(DSO *dso, char *filename, DSO_METHOD *meth)
+DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags)
{
DSO *ret;
int allocated = 0;
}
else
ret = dso;
+ /* Bleurgh ... have to check for negative return values for
+ * errors. <grimace> */
+ if(DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0)
+ {
+ DSOerr(DSO_F_DSO_LOAD,DSO_R_CTRL_FAILED);
+ if(allocated)
+ DSO_free(ret);
+ return(NULL);
+ }
if(ret->meth->dso_load == NULL)
{
DSOerr(DSO_F_DSO_LOAD,DSO_R_UNSUPPORTED);
return(ret);
}
-void *DSO_bind(DSO *dso, char *symname)
+void *DSO_bind(DSO *dso, const char *symname)
{
void *ret = NULL;
/* Success */
return(ret);
}
+
+/* I don't really like these *_ctrl functions very much to be perfectly
+ * honest. For one thing, I think I have to return a negative value for
+ * any error because possible DSO_ctrl() commands may return values
+ * such as "size"s that can legitimately be zero (making the standard
+ * "if(DSO_cmd(...))" form that works almost everywhere else fail at
+ * odd times. I'd prefer "output" values to be passed by reference and
+ * the return value as success/failure like usual ... but we conform
+ * when we must... :-) */
+long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg)
+ {
+ if(dso == NULL)
+ {
+ DSOerr(DSO_F_DSO_CTRL,ERR_R_PASSED_NULL_PARAMETER);
+ return(-1);
+ }
+ if((dso->meth == NULL) || (dso->meth->dso_ctrl == NULL))
+ {
+ DSOerr(DSO_F_DSO_CTRL,DSO_R_UNSUPPORTED);
+ return(-1);
+ }
+ return(dso->meth->dso_ctrl(dso,cmd,larg,parg));
+ }