From b6577e040ebe6e19b7904a386964f26f0a6663d2 Mon Sep 17 00:00:00 2001 From: Geoff Thorpe Date: Sun, 28 May 2000 22:54:51 +0000 Subject: [PATCH] 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. --- crypto/rsa/rsa.h | 2 +- crypto/rsa/rsa_lib.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crypto/rsa/rsa.h b/crypto/rsa/rsa.h index 8bccf73c27..ef3fd62757 100644 --- a/crypto/rsa/rsa.h +++ b/crypto/rsa/rsa.h @@ -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 */ diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c index 885fb0227f..e970b4c188 100644 --- a/crypto/rsa/rsa_lib.c +++ b/crypto/rsa/rsa_lib.c @@ -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 -- 2.25.1