Give DH, DSA, and RSA functions to "up" their reference counts. Otherwise,
[openssl.git] / crypto / rsa / rsa_lib.c
index 4fd919808c34ea68939cae8a443fab0369a3dc47..3accf013f3cbee47c73517acbe29621ec323bca2 100644 (file)
@@ -248,6 +248,22 @@ void RSA_free(RSA *r)
        OPENSSL_free(r);
        }
 
+int RSA_up(RSA *r)
+       {
+       int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_RSA);
+#ifdef REF_PRINT
+       REF_PRINT("RSA",r);
+#endif
+#ifdef REF_CHECK
+       if (i < 2)
+               {
+               fprintf(stderr, "RSA_up, bad reference count\n");
+               abort();
+               }
+#endif
+       return ((i > 1) ? 1 : 0);
+       }
+
 int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
             CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
         {