diff -ur openssl-0.9.6g.orig/crypto/evp/c_allc.c openssl-0.9.6g/crypto/evp/c_allc.c
--- openssl-0.9.6g.orig/crypto/evp/c_allc.c	2002-08-09 07:15:45.000000000 +1000
+++ openssl-0.9.6g/crypto/evp/c_allc.c	2002-08-30 15:50:55.000000000 +1000
@@ -62,12 +62,12 @@
 #include <openssl/pkcs12.h>
 #include <openssl/objects.h>
 
+int EVP_ciphers_added;
+
 void OpenSSL_add_all_ciphers(void)
 	{
-	static int done=0;
-
-	if (done) return;
-	done=1;
+	if (EVP_ciphers_added) return;
+	EVP_ciphers_added=1;
 #ifndef NO_DES
 	EVP_add_cipher(EVP_des_cfb());
 	EVP_add_cipher(EVP_des_ede_cfb());
diff -ur openssl-0.9.6g.orig/crypto/evp/c_alld.c openssl-0.9.6g/crypto/evp/c_alld.c
--- openssl-0.9.6g.orig/crypto/evp/c_alld.c	2002-08-09 07:15:45.000000000 +1000
+++ openssl-0.9.6g/crypto/evp/c_alld.c	2002-08-30 15:50:55.000000000 +1000
@@ -62,12 +62,12 @@
 #include <openssl/pkcs12.h>
 #include <openssl/objects.h>
 
+int EVP_digests_added;
+
 void OpenSSL_add_all_digests(void)
 	{
-	static int done=0;
-
-	if (done) return;
-	done=1;
+	if (EVP_digests_added) return;
+	EVP_digests_added=1;
 #ifndef NO_MD2
 	EVP_add_digest(EVP_md2());
 #endif
diff -ur openssl-0.9.6g.orig/crypto/evp/names.c openssl-0.9.6g/crypto/evp/names.c
--- openssl-0.9.6g.orig/crypto/evp/names.c	2000-03-18 10:49:15.000000000 +1100
+++ openssl-0.9.6g/crypto/evp/names.c	2002-08-30 15:50:55.000000000 +1000
@@ -110,10 +110,15 @@
 	return(cp);
 	}
 
+extern int EVP_ciphers_added;
+extern int EVP_digests_added;
+
 void EVP_cleanup(void)
 	{
 	OBJ_NAME_cleanup(OBJ_NAME_TYPE_CIPHER_METH);
+	EVP_ciphers_added = 0;	/* flag that ciphers need to be added again */
 	OBJ_NAME_cleanup(OBJ_NAME_TYPE_MD_METH);
+	EVP_digests_added = 0;	/* flag that digests need to be added again */
 	/* The above calls will only clean out the contents of the name
 	   hash table, but not the hash table itself.  The following line
 	   does that part.  -- Richard Levitte */
