summaryrefslogtreecommitdiff
path: root/databases/mysql56-client/files/patch-mysys__ssl_my__aes__openssl.cc
blob: 0d1dea6cf6cb06a1fa387bd295ba5f18cb8f4eb5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
--- mysys_ssl/my_aes_openssl.cc.orig	2019-11-26 16:53:45 UTC
+++ mysys_ssl/my_aes_openssl.cc
@@ -120,7 +120,7 @@ int my_aes_encrypt(const unsigned char *source, uint32
                    const unsigned char *key, uint32 key_length,
                    enum my_aes_opmode mode, const unsigned char *iv)
 {
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   EVP_CIPHER_CTX stack_ctx;
   EVP_CIPHER_CTX *ctx= &stack_ctx;
 #else /* OPENSSL_VERSION_NUMBER < 0x10100000L */
@@ -135,7 +135,7 @@ int my_aes_encrypt(const unsigned char *source, uint32
   if (!ctx || !cipher || (EVP_CIPHER_iv_length(cipher) > 0 && !iv))
     return MY_AES_BAD_DATA;
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   EVP_CIPHER_CTX_init(ctx);
 #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
 
@@ -148,7 +148,7 @@ int my_aes_encrypt(const unsigned char *source, uint32
   if (!EVP_EncryptFinal(ctx, dest + u_len, &f_len))
     goto aes_error;                             /* Error */
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   EVP_CIPHER_CTX_cleanup(ctx);
 #else /* OPENSSL_VERSION_NUMBER < 0x10100000L */
   EVP_CIPHER_CTX_free(ctx);
@@ -158,7 +158,7 @@ int my_aes_encrypt(const unsigned char *source, uint32
 aes_error:
   /* need to explicitly clean up the error if we want to ignore it */
   ERR_clear_error();
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   EVP_CIPHER_CTX_cleanup(ctx);
 #else /* OPENSSL_VERSION_NUMBER < 0x10100000L */
   EVP_CIPHER_CTX_free(ctx);
@@ -172,7 +172,7 @@ int my_aes_decrypt(const unsigned char *source, uint32
                    const unsigned char *key, uint32 key_length,
                    enum my_aes_opmode mode, const unsigned char *iv)
 {
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   EVP_CIPHER_CTX stack_ctx;
   EVP_CIPHER_CTX *ctx= &stack_ctx;
 #else /* OPENSSL_VERSION_NUMBER < 0x10100000L */
@@ -188,7 +188,7 @@ int my_aes_decrypt(const unsigned char *source, uint32
   if (!ctx || !cipher || (EVP_CIPHER_iv_length(cipher) > 0 && !iv))
     return MY_AES_BAD_DATA;
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   EVP_CIPHER_CTX_init(ctx);
 #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
 
@@ -201,7 +201,7 @@ int my_aes_decrypt(const unsigned char *source, uint32
   if (!EVP_DecryptFinal_ex(ctx, dest + u_len, &f_len))
     goto aes_error;                             /* Error */
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   EVP_CIPHER_CTX_cleanup(ctx);
 #else /* OPENSSL_VERSION_NUMBER < 0x10100000L */
   EVP_CIPHER_CTX_free(ctx);
@@ -211,7 +211,7 @@ int my_aes_decrypt(const unsigned char *source, uint32
 aes_error:
   /* need to explicitly clean up the error if we want to ignore it */
   ERR_clear_error();
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   EVP_CIPHER_CTX_cleanup(ctx);
 #else /* OPENSSL_VERSION_NUMBER < 0x10100000L */
   EVP_CIPHER_CTX_free(ctx);