  /*
   * Borland C seems too stupid to be able to shift and do longs in the
 diff --git a/crypto/opensslconf.h.in b/crypto/opensslconf.h.in
-index 7a1c85d..a5f51a7 100644
+index 7a1c85d..7162c0f 100644
 --- a/crypto/opensslconf.h.in
 +++ b/crypto/opensslconf.h.in
 @@ -1,5 +1,15 @@

+    BIO_free_all(tmpmem);
+    return ret;
 }
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
index 266111e..f60fac6 100644
--- a/crypto/rand/rand_unix.c

+
 /* Generate 80386 code? */
 #undef I386_ONLY
 
@@ -56,7 +66,7 @@
 #endif
 #endif
 
-#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
+#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) && !defined(OPENSSL_SYSNAME_UEFI)
 #define CONFIG_HEADER_BN_H
 #undef BN_LLONG
 
diff --git a/crypto/pem/pem.h b/crypto/pem/pem.h
index d3b23fc..87b0b6a 100644
