New functions to allow RSA_METHODs to be changed without poking round in
authorDr. Stephen Henson <steve@openssl.org>
Tue, 29 Jun 1999 22:22:42 +0000 (22:22 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Tue, 29 Jun 1999 22:22:42 +0000 (22:22 +0000)
RSA structure internals.

CHANGES
crypto/rsa/rsa.h
crypto/rsa/rsa_lib.c
util/libeay.num

diff --git a/CHANGES b/CHANGES
index 70dcca1ac34400838dabcfcf381d950d7efea7bc..23082d3304773b284bcc7bf7336a6478c30edb52 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,11 @@
 
  Changes between 0.9.3a and 0.9.4
 
+  *) New functions RSA_get_default_method(), RSA_set_method() and
+     RSA_get_method(). These allows replacement of RSA_METHODs without having
+     to mess around with the internals of an RSA structure.
+     [Steve Henson]
+
   *) Fix memory leaks in DSA_do_sign and DSA_is_prime.
      Also really enable memory leak checks in openssl.c and in some
      test programs.
index 11f66b65f01a3dffaf4ac44b05d2a7e537af835e..3be447dff2e85b918dbce667bc11de278bafc2fb 100644 (file)
@@ -161,6 +161,9 @@ void        RSA_free (RSA *r);
 int    RSA_flags(RSA *r);
 
 void RSA_set_default_method(RSA_METHOD *meth);
+RSA_METHOD *RSA_get_default_method(void);
+RSA_METHOD *RSA_get_method(RSA *rsa);
+RSA_METHOD *RSA_set_method(RSA *rsa, RSA_METHOD *meth);
 
 /* This function needs the memory locking malloc callbacks to be installed */
 int RSA_memory_lock(RSA *r);
index 1ac1331fa4def3b74168991bfb68eab278edb1b4..c0ca2923a699d123f6933b79864c2f2c64fcabed 100644 (file)
@@ -79,6 +79,26 @@ void RSA_set_default_method(RSA_METHOD *meth)
        default_RSA_meth=meth;
        }
 
+RSA_METHOD *RSA_get_default_method(void)
+{
+       return default_RSA_meth;
+}
+
+RSA_METHOD *RSA_get_method(RSA *rsa)
+{
+       return rsa->meth;
+}
+
+RSA_METHOD *RSA_set_method(RSA *rsa, RSA_METHOD *meth)
+{
+       RSA_METHOD *mtmp;
+       mtmp = rsa->meth;
+       if (mtmp->finish) mtmp->finish(rsa);
+       rsa->meth = meth;
+       if (meth->init) meth->init(rsa);
+       return mtmp;
+}
+
 RSA *RSA_new_method(RSA_METHOD *meth)
        {
        RSA *ret;
index 4c49be676e2442f8aee53592725464f2b222baba..f9ea4e8750957167300d332df8d936cb1d0c3d22 100755 (executable)
@@ -1818,3 +1818,6 @@ sk_ASN1_OBJECT_insert                   1842
 sk_ASN1_OBJECT_push                     1843
 d2i_ASN1_SET_OF_ASN1_OBJECT             1844
 PKCS7_signatureVerify                   1845
+RSA_set_method                          1846
+RSA_get_method                          1847
+RSA_get_default_method                  1848