View | Details | Raw Unified | Return to bug 229030 | Differences between
and this patch

Collapse All | Expand All

(-)security/botan110/Makefile (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	botan
4
PORTNAME=	botan
5
PORTVERSION=	1.10.13
5
PORTVERSION=	1.10.13
6
PORTREVISION=	9
6
PORTREVISION=	10
7
CATEGORIES=	security
7
CATEGORIES=	security
8
MASTER_SITES=	http://botan.randombit.net/releases/
8
MASTER_SITES=	http://botan.randombit.net/releases/
9
PKGNAMESUFFIX=	110
9
PKGNAMESUFFIX=	110
(-)security/botan110/files/patch-src_engine_openssl_ossl__bc.cpp (+143 lines)
Line 0 Link Here
1
--- src/engine/openssl/ossl_bc.cpp.orig	2018-10-15 00:16:53 UTC
2
+++ src/engine/openssl/ossl_bc.cpp
3
@@ -40,7 +40,7 @@ class EVP_BlockCipher : public BlockCipher
4
       size_t block_sz;
5
       Key_Length_Specification cipher_key_spec;
6
       std::string cipher_name;
7
-      mutable EVP_CIPHER_CTX encrypt, decrypt;
8
+      mutable EVP_CIPHER_CTX *encrypt, *decrypt;
9
    };
10
 
11
 /*
12
@@ -55,14 +55,14 @@ EVP_BlockCipher::EVP_BlockCipher(const EVP_CIPHER* alg
13
    if(EVP_CIPHER_mode(algo) != EVP_CIPH_ECB_MODE)
14
       throw Invalid_Argument("EVP_BlockCipher: Non-ECB EVP was passed in");
15
 
16
-   EVP_CIPHER_CTX_init(&encrypt);
17
-   EVP_CIPHER_CTX_init(&decrypt);
18
+   EVP_CIPHER_CTX_init(encrypt);
19
+   EVP_CIPHER_CTX_init(decrypt);
20
 
21
-   EVP_EncryptInit_ex(&encrypt, algo, 0, 0, 0);
22
-   EVP_DecryptInit_ex(&decrypt, algo, 0, 0, 0);
23
+   EVP_EncryptInit_ex(encrypt, algo, 0, 0, 0);
24
+   EVP_DecryptInit_ex(decrypt, algo, 0, 0, 0);
25
 
26
-   EVP_CIPHER_CTX_set_padding(&encrypt, 0);
27
-   EVP_CIPHER_CTX_set_padding(&decrypt, 0);
28
+   EVP_CIPHER_CTX_set_padding(encrypt, 0);
29
+   EVP_CIPHER_CTX_set_padding(decrypt, 0);
30
    }
31
 
32
 /*
33
@@ -79,14 +79,14 @@ EVP_BlockCipher::EVP_BlockCipher(const EVP_CIPHER* alg
34
    if(EVP_CIPHER_mode(algo) != EVP_CIPH_ECB_MODE)
35
       throw Invalid_Argument("EVP_BlockCipher: Non-ECB EVP was passed in");
36
 
37
-   EVP_CIPHER_CTX_init(&encrypt);
38
-   EVP_CIPHER_CTX_init(&decrypt);
39
+   EVP_CIPHER_CTX_init(encrypt);
40
+   EVP_CIPHER_CTX_init(decrypt);
41
 
42
-   EVP_EncryptInit_ex(&encrypt, algo, 0, 0, 0);
43
-   EVP_DecryptInit_ex(&decrypt, algo, 0, 0, 0);
44
+   EVP_EncryptInit_ex(encrypt, algo, 0, 0, 0);
45
+   EVP_DecryptInit_ex(decrypt, algo, 0, 0, 0);
46
 
47
-   EVP_CIPHER_CTX_set_padding(&encrypt, 0);
48
-   EVP_CIPHER_CTX_set_padding(&decrypt, 0);
49
+   EVP_CIPHER_CTX_set_padding(encrypt, 0);
50
+   EVP_CIPHER_CTX_set_padding(decrypt, 0);
51
    }
52
 
53
 /*
54
@@ -94,8 +94,8 @@ EVP_BlockCipher::EVP_BlockCipher(const EVP_CIPHER* alg
55
 */
56
 EVP_BlockCipher::~EVP_BlockCipher()
57
    {
58
-   EVP_CIPHER_CTX_cleanup(&encrypt);
59
-   EVP_CIPHER_CTX_cleanup(&decrypt);
60
+   EVP_CIPHER_CTX_cleanup(encrypt);
61
+   EVP_CIPHER_CTX_cleanup(decrypt);
62
    }
63
 
64
 /*
65
@@ -105,7 +105,7 @@ void EVP_BlockCipher::encrypt_n(const byte in[], byte 
66
                                 size_t blocks) const
67
    {
68
    int out_len = 0;
69
-   EVP_EncryptUpdate(&encrypt, out, &out_len, in, blocks * block_sz);
70
+   EVP_EncryptUpdate(encrypt, out, &out_len, in, blocks * block_sz);
71
    }
72
 
73
 /*
74
@@ -115,7 +115,7 @@ void EVP_BlockCipher::decrypt_n(const byte in[], byte 
75
                                 size_t blocks) const
76
    {
77
    int out_len = 0;
78
-   EVP_DecryptUpdate(&decrypt, out, &out_len, in, blocks * block_sz);
79
+   EVP_DecryptUpdate(decrypt, out, &out_len, in, blocks * block_sz);
80
    }
81
 
82
 /*
83
@@ -130,19 +130,19 @@ void EVP_BlockCipher::key_schedule(const byte key[], s
84
       full_key += std::make_pair(key, 8);
85
       }
86
    else
87
-      if(EVP_CIPHER_CTX_set_key_length(&encrypt, length) == 0 ||
88
-         EVP_CIPHER_CTX_set_key_length(&decrypt, length) == 0)
89
+      if(EVP_CIPHER_CTX_set_key_length(encrypt, length) == 0 ||
90
+         EVP_CIPHER_CTX_set_key_length(decrypt, length) == 0)
91
          throw Invalid_Argument("EVP_BlockCipher: Bad key length for " +
92
                                 cipher_name);
93
 
94
    if(cipher_name == "RC2")
95
       {
96
-      EVP_CIPHER_CTX_ctrl(&encrypt, EVP_CTRL_SET_RC2_KEY_BITS, length*8, 0);
97
-      EVP_CIPHER_CTX_ctrl(&decrypt, EVP_CTRL_SET_RC2_KEY_BITS, length*8, 0);
98
+      EVP_CIPHER_CTX_ctrl(encrypt, EVP_CTRL_SET_RC2_KEY_BITS, length*8, 0);
99
+      EVP_CIPHER_CTX_ctrl(decrypt, EVP_CTRL_SET_RC2_KEY_BITS, length*8, 0);
100
       }
101
 
102
-   EVP_EncryptInit_ex(&encrypt, 0, 0, full_key.begin(), 0);
103
-   EVP_DecryptInit_ex(&decrypt, 0, 0, full_key.begin(), 0);
104
+   EVP_EncryptInit_ex(encrypt, 0, 0, full_key.begin(), 0);
105
+   EVP_DecryptInit_ex(decrypt, 0, 0, full_key.begin(), 0);
106
    }
107
 
108
 /*
109
@@ -150,7 +150,7 @@ void EVP_BlockCipher::key_schedule(const byte key[], s
110
 */
111
 BlockCipher* EVP_BlockCipher::clone() const
112
    {
113
-   return new EVP_BlockCipher(EVP_CIPHER_CTX_cipher(&encrypt),
114
+   return new EVP_BlockCipher(EVP_CIPHER_CTX_cipher(encrypt),
115
                               cipher_name,
116
                               cipher_key_spec.minimum_keylength(),
117
                               cipher_key_spec.maximum_keylength(),
118
@@ -162,16 +162,16 @@ BlockCipher* EVP_BlockCipher::clone() const
119
 */
120
 void EVP_BlockCipher::clear()
121
    {
122
-   const EVP_CIPHER* algo = EVP_CIPHER_CTX_cipher(&encrypt);
123
+   const EVP_CIPHER* algo = EVP_CIPHER_CTX_cipher(encrypt);
124
 
125
-   EVP_CIPHER_CTX_cleanup(&encrypt);
126
-   EVP_CIPHER_CTX_cleanup(&decrypt);
127
-   EVP_CIPHER_CTX_init(&encrypt);
128
-   EVP_CIPHER_CTX_init(&decrypt);
129
-   EVP_EncryptInit_ex(&encrypt, algo, 0, 0, 0);
130
-   EVP_DecryptInit_ex(&decrypt, algo, 0, 0, 0);
131
-   EVP_CIPHER_CTX_set_padding(&encrypt, 0);
132
-   EVP_CIPHER_CTX_set_padding(&decrypt, 0);
133
+   EVP_CIPHER_CTX_cleanup(encrypt);
134
+   EVP_CIPHER_CTX_cleanup(decrypt);
135
+   EVP_CIPHER_CTX_init(encrypt);
136
+   EVP_CIPHER_CTX_init(decrypt);
137
+   EVP_EncryptInit_ex(encrypt, algo, 0, 0, 0);
138
+   EVP_DecryptInit_ex(decrypt, algo, 0, 0, 0);
139
+   EVP_CIPHER_CTX_set_padding(encrypt, 0);
140
+   EVP_CIPHER_CTX_set_padding(decrypt, 0);
141
    }
142
 
143
 }
(-)security/botan110/files/patch-src_engine_openssl_ossl__md.cpp (+88 lines)
Line 0 Link Here
1
--- src/engine/openssl/ossl_md.cpp.orig	2018-10-15 00:26:19 UTC
2
+++ src/engine/openssl/ossl_md.cpp
3
@@ -24,12 +24,12 @@ class EVP_HashFunction : public HashFunction
4
 
5
       size_t output_length() const
6
          {
7
-         return EVP_MD_size(EVP_MD_CTX_md(&md));
8
+         return EVP_MD_size(EVP_MD_CTX_md(md));
9
          }
10
 
11
       size_t hash_block_size() const
12
          {
13
-         return EVP_MD_block_size(EVP_MD_CTX_md(&md));
14
+         return EVP_MD_block_size(EVP_MD_CTX_md(md));
15
          }
16
 
17
       EVP_HashFunction(const EVP_MD*, const std::string&);
18
@@ -40,7 +40,7 @@ class EVP_HashFunction : public HashFunction
19
 
20
       size_t block_size;
21
       std::string algo_name;
22
-      EVP_MD_CTX md;
23
+      EVP_MD_CTX *md;
24
    };
25
 
26
 /*
27
@@ -48,7 +48,7 @@ class EVP_HashFunction : public HashFunction
28
 */
29
 void EVP_HashFunction::add_data(const byte input[], size_t length)
30
    {
31
-   EVP_DigestUpdate(&md, input, length);
32
+   EVP_DigestUpdate(md, input, length);
33
    }
34
 
35
 /*
36
@@ -56,9 +56,9 @@ void EVP_HashFunction::add_data(const byte input[], si
37
 */
38
 void EVP_HashFunction::final_result(byte output[])
39
    {
40
-   EVP_DigestFinal_ex(&md, output, 0);
41
-   const EVP_MD* algo = EVP_MD_CTX_md(&md);
42
-   EVP_DigestInit_ex(&md, algo, 0);
43
+   EVP_DigestFinal_ex(md, output, 0);
44
+   const EVP_MD* algo = EVP_MD_CTX_md(md);
45
+   EVP_DigestInit_ex(md, algo, 0);
46
    }
47
 
48
 /*
49
@@ -66,8 +66,8 @@ void EVP_HashFunction::final_result(byte output[])
50
 */
51
 void EVP_HashFunction::clear()
52
    {
53
-   const EVP_MD* algo = EVP_MD_CTX_md(&md);
54
-   EVP_DigestInit_ex(&md, algo, 0);
55
+   const EVP_MD* algo = EVP_MD_CTX_md(md);
56
+   EVP_DigestInit_ex(md, algo, 0);
57
    }
58
 
59
 /*
60
@@ -75,7 +75,7 @@ void EVP_HashFunction::clear()
61
 */
62
 HashFunction* EVP_HashFunction::clone() const
63
    {
64
-   const EVP_MD* algo = EVP_MD_CTX_md(&md);
65
+   const EVP_MD* algo = EVP_MD_CTX_md(md);
66
    return new EVP_HashFunction(algo, name());
67
    }
68
 
69
@@ -86,8 +86,8 @@ EVP_HashFunction::EVP_HashFunction(const EVP_MD* algo,
70
                                    const std::string& name) :
71
    algo_name(name)
72
    {
73
-   EVP_MD_CTX_init(&md);
74
-   EVP_DigestInit_ex(&md, algo, 0);
75
+   EVP_MD_CTX_init(md);
76
+   EVP_DigestInit_ex(md, algo, 0);
77
    }
78
 
79
 /*
80
@@ -95,7 +95,7 @@ EVP_HashFunction::EVP_HashFunction(const EVP_MD* algo,
81
 */
82
 EVP_HashFunction::~EVP_HashFunction()
83
    {
84
-   EVP_MD_CTX_cleanup(&md);
85
+   EVP_MD_CTX_free(md);
86
    }
87
 
88
 }

Return to bug 229030