openssl 3 build fix proposal.
diff --git a/lib/openssl.c b/lib/openssl.c
index 85327a2..93a74d3 100644
--- a/lib/openssl.c
+++ b/lib/openssl.c
@@ -29,6 +29,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#define OPENSSL_API_COMPAT 0x00908000L
 #include <openssl/bn.h>
 #include <openssl/crypto.h>
 #include <openssl/ec.h>
diff --git a/src/esni.c b/src/esni.c
index 5c5c047..7ec29fb 100644
--- a/src/esni.c
+++ b/src/esni.c
@@ -34,6 +34,7 @@
 #include <strings.h>
 #endif
 #include <time.h>
+#define OPENSSL_API_COMPAT 0x00908000L
 #include <openssl/err.h>
 #include <openssl/engine.h>
 #include <openssl/pem.h>
diff --git a/t/cli.c b/t/cli.c
index 5c540dc..c937784 100644
--- a/t/cli.c
+++ b/t/cli.c
@@ -39,6 +39,7 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <unistd.h>
+#define OPENSSL_API_COMPAT 0x00908000L
 #include <openssl/err.h>
 #include <openssl/evp.h>
 #include <openssl/engine.h>
diff --git a/t/openssl.c b/t/openssl.c
index 5669b81..54e9872 100644
--- a/t/openssl.c
+++ b/t/openssl.c
@@ -25,6 +25,7 @@
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>
+#define OPENSSL_API_COMPAT 0x00908000L
 #include <openssl/opensslv.h>
 #include <openssl/bio.h>
 #include <openssl/pem.h>
@@ -384,5 +385,10 @@
     subtest("minicrypto vs.", test_picotls);
 
     esni_private_keys[0]->on_exchange(esni_private_keys, 1, NULL, ptls_iovec_init(NULL, 0));
-    return done_testing();
+    int ret = done_testing();
+#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x30000000L
+    OSSL_PROVIDER_unload(dflt);
+    OSSL_PROVIDER_unload(legacy);
+#endif
+    return ret;
 }