View | Details | Raw Unified | Return to bug 228248
Collapse All | Expand All

(-)databases/sqlcipher/files/patch-sqlcipher-libressl-2.7 (+31 lines)
Line 0 Link Here
1
diff --git a/src/crypto_openssl.c b/src/crypto_openssl.c
2
index a45db3b..4344076 100644
3
--- src/crypto_openssl.c.orig
4
+++ src/crypto_openssl.c
5
@@ -47,7 +47,7 @@ static unsigned int openssl_external_init = 0;
6
 static unsigned int openssl_init_count = 0;
7
 static sqlite3_mutex* openssl_rand_mutex = NULL;
8
 
9
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
10
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000) 
11
 static HMAC_CTX *HMAC_CTX_new(void)
12
 {
13
   HMAC_CTX *ctx = OPENSSL_malloc(sizeof(*ctx));
14
@@ -117,7 +117,7 @@ static int sqlcipher_openssl_activate(void *ctx) {
15
 
16
   if(openssl_init_count == 0 && openssl_external_init == 0)  {
17
     /* if the library was not externally initialized, then should be now */
18
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
19
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000)
20
     OpenSSL_add_all_algorithms();
21
 #endif
22
   } 
23
@@ -154,7 +154,7 @@ static int sqlcipher_openssl_deactivate(void *ctx) {
24
        Note: this code will only be reached if OpensSSL_add_all_algorithms()
25
        is called by SQLCipher internally. This should prevent SQLCipher from 
26
        "cleaning up" openssl when it was initialized externally by the program */
27
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
28
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000)
29
       EVP_cleanup();
30
 #endif
31
     } else {

Return to bug 228248