than (RSA_METHOD *) required a couple of functions to change shape. I
didn't really pick the best shape to change RSA_set_method into though. :-)
There's nothing really appropriate to return from RSA_set_method; the
temptation to return an "old handle" fails when you consider that the
caller might ignore the return value and so botch up the reference
counting, this wasn't an issue before because there was no reference
counting.
#if 0
RSA_METHOD *RSA_set_method(RSA *rsa, RSA_METHOD *meth);
#else
-RSA_METHOD *RSA_set_method(RSA *rsa, struct engine_st *h);
+int RSA_set_method(RSA *rsa, struct engine_st *h);
#endif
/* This function needs the memory locking malloc callbacks to be installed */
return mtmp;
}
#else
-RSA_METHOD *RSA_set_method(RSA *rsa, ENGINE *h)
+int RSA_set_method(RSA *rsa, ENGINE *h)
{
ENGINE *mtmp;
- RSA_METHOD *meth, *old_meth;
+ RSA_METHOD *meth;
mtmp = rsa->handle;
- old_meth = ENGINE_get_RSA(mtmp);
+ meth = ENGINE_get_RSA(mtmp);
if (!ENGINE_init(h))
- return NULL;
- if (old_meth->finish) old_meth->finish(rsa);
+ return 0;
+ if (meth->finish) meth->finish(rsa);
rsa->handle = h;
meth = ENGINE_get_RSA(h);
if (meth->init) meth->init(rsa);
/* SHOULD ERROR CHECK THIS!!! */
ENGINE_finish(mtmp);
- return old_meth;
+ return 1;
}
#endif