The switch to having an (ENGINE *) handle inside each RSA structure rather

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.
This commit is contained in:
Geoff Thorpe 2000-05-28 22:54:51 +00:00
parent bb51f21728
commit b6577e040e
2 changed files with 7 additions and 7 deletions

View File

@ -197,7 +197,7 @@ RSA_METHOD *RSA_get_method(RSA *rsa);
#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 */

View File

@ -128,21 +128,21 @@ RSA_METHOD *RSA_set_method(RSA *rsa, RSA_METHOD *meth)
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