1 |
commit: 35f4591df05a0748eadbefb847a5d362803b7edb |
2 |
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Dec 31 12:22:23 2018 +0000 |
4 |
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Dec 31 12:22:40 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=35f4591d |
7 |
|
8 |
sys-fs/dmg2img: Revbump to fix build against openssl-1.1 |
9 |
|
10 |
bumped to EAPI-6. |
11 |
|
12 |
Closes: https://bugs.gentoo.org/674168 |
13 |
Package-Manager: Portage-2.3.53, Repoman-2.3.12 |
14 |
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org> |
15 |
|
16 |
sys-fs/dmg2img/dmg2img-1.6.7-r1.ebuild | 39 ++++ |
17 |
sys-fs/dmg2img/files/dmg2img-1.6.7-openssl11.patch | 202 +++++++++++++++++++++ |
18 |
2 files changed, 241 insertions(+) |
19 |
|
20 |
diff --git a/sys-fs/dmg2img/dmg2img-1.6.7-r1.ebuild b/sys-fs/dmg2img/dmg2img-1.6.7-r1.ebuild |
21 |
new file mode 100644 |
22 |
index 00000000000..bf3ba7ee1f5 |
23 |
--- /dev/null |
24 |
+++ b/sys-fs/dmg2img/dmg2img-1.6.7-r1.ebuild |
25 |
@@ -0,0 +1,39 @@ |
26 |
+# Copyright 1999-2018 Gentoo Authors |
27 |
+# Distributed under the terms of the GNU General Public License v2 |
28 |
+ |
29 |
+EAPI=6 |
30 |
+inherit toolchain-funcs |
31 |
+ |
32 |
+DESCRIPTION="Converts Apple DMG files to standard HFS+ images" |
33 |
+HOMEPAGE="http://vu1tur.eu.org/tools" |
34 |
+SRC_URI="http://vu1tur.eu.org/tools/${P}.tar.gz" |
35 |
+ |
36 |
+LICENSE="GPL-2" |
37 |
+SLOT="0" |
38 |
+KEYWORDS="~amd64 ~ppc ~x86" |
39 |
+IUSE="" |
40 |
+ |
41 |
+RDEPEND="dev-libs/openssl:0= |
42 |
+ app-arch/bzip2 |
43 |
+ sys-libs/zlib" |
44 |
+DEPEND="${RDEPEND}" |
45 |
+ |
46 |
+PATCHES=( |
47 |
+ "${FILESDIR}"/${P}-openssl11.patch #674168 |
48 |
+) |
49 |
+ |
50 |
+src_prepare() { |
51 |
+ default |
52 |
+ sed -i -e 's:-s:$(LDFLAGS):g' Makefile || die "sed failed" |
53 |
+} |
54 |
+ |
55 |
+src_compile() { |
56 |
+ tc-export CC |
57 |
+ emake CFLAGS="${CFLAGS}" |
58 |
+} |
59 |
+ |
60 |
+src_install() { |
61 |
+ dobin dmg2img vfdecrypt |
62 |
+ dodoc README |
63 |
+ doman vfdecrypt.1 |
64 |
+} |
65 |
|
66 |
diff --git a/sys-fs/dmg2img/files/dmg2img-1.6.7-openssl11.patch b/sys-fs/dmg2img/files/dmg2img-1.6.7-openssl11.patch |
67 |
new file mode 100644 |
68 |
index 00000000000..53b73038ade |
69 |
--- /dev/null |
70 |
+++ b/sys-fs/dmg2img/files/dmg2img-1.6.7-openssl11.patch |
71 |
@@ -0,0 +1,202 @@ |
72 |
+diff --git a/old/vfdecrypt.c b/vfdecrypt.c |
73 |
+index 56d3530..b1a36d3 100644 |
74 |
+--- a/old/vfdecrypt.c |
75 |
++++ b/vfdecrypt.c |
76 |
+@@ -183,7 +183,7 @@ void adjust_v2_header_byteorder(cencrypted_v2_pwheader *pwhdr) { |
77 |
+ pwhdr->encrypted_keyblob_size = htonl(pwhdr->encrypted_keyblob_size); |
78 |
+ } |
79 |
+ |
80 |
+-HMAC_CTX hmacsha1_ctx; |
81 |
++HMAC_CTX *hmacsha1_ctx; |
82 |
+ AES_KEY aes_decrypt_key; |
83 |
+ int CHUNK_SIZE=4096; // default |
84 |
+ |
85 |
+@@ -196,9 +196,9 @@ void compute_iv(uint32_t chunk_no, uint8_t *iv) { |
86 |
+ unsigned int mdLen; |
87 |
+ |
88 |
+ chunk_no = OSSwapHostToBigInt32(chunk_no); |
89 |
+- HMAC_Init_ex(&hmacsha1_ctx, NULL, 0, NULL, NULL); |
90 |
+- HMAC_Update(&hmacsha1_ctx, (void *) &chunk_no, sizeof(uint32_t)); |
91 |
+- HMAC_Final(&hmacsha1_ctx, mdResult, &mdLen); |
92 |
++ HMAC_Init_ex(hmacsha1_ctx, NULL, 0, NULL, NULL); |
93 |
++ HMAC_Update(hmacsha1_ctx, (void *) &chunk_no, sizeof(uint32_t)); |
94 |
++ HMAC_Final(hmacsha1_ctx, mdResult, &mdLen); |
95 |
+ memcpy(iv, mdResult, CIPHER_BLOCKSIZE); |
96 |
+ } |
97 |
+ |
98 |
+@@ -212,52 +212,75 @@ void decrypt_chunk(uint8_t *ctext, uint8_t *ptext, uint32_t chunk_no) { |
99 |
+ /* DES3-EDE unwrap operation loosely based on to RFC 2630, section 12.6 |
100 |
+ * wrapped_key has to be 40 bytes in length. */ |
101 |
+ int apple_des3_ede_unwrap_key(uint8_t *wrapped_key, int wrapped_key_len, uint8_t *decryptKey, uint8_t *unwrapped_key) { |
102 |
+- EVP_CIPHER_CTX ctx; |
103 |
++ EVP_CIPHER_CTX *ctx; |
104 |
+ uint8_t *TEMP1, *TEMP2, *CEKICV; |
105 |
+ uint8_t IV[8] = { 0x4a, 0xdd, 0xa2, 0x2c, 0x79, 0xe8, 0x21, 0x05 }; |
106 |
+ int outlen, tmplen, i; |
107 |
+ |
108 |
+- EVP_CIPHER_CTX_init(&ctx); |
109 |
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L |
110 |
++ ctx = EVP_CIPHER_CTX_new(); |
111 |
++#else |
112 |
++ ctx = malloc(sizeof(*ctx)); |
113 |
++#endif |
114 |
++ if (!ctx) { |
115 |
++ fprintf(stderr, "Out of memory: EVP_CIPHER_CTX!\n"); |
116 |
++ return(-1); |
117 |
++ } |
118 |
++ |
119 |
++ EVP_CIPHER_CTX_init(ctx); |
120 |
+ /* result of the decryption operation shouldn't be bigger than ciphertext */ |
121 |
+ TEMP1 = malloc(wrapped_key_len); |
122 |
+ TEMP2 = malloc(wrapped_key_len); |
123 |
+ CEKICV = malloc(wrapped_key_len); |
124 |
+ /* uses PKCS#7 padding for symmetric key operations by default */ |
125 |
+- EVP_DecryptInit_ex(&ctx, EVP_des_ede3_cbc(), NULL, decryptKey, IV); |
126 |
++ EVP_DecryptInit_ex(ctx, EVP_des_ede3_cbc(), NULL, decryptKey, IV); |
127 |
+ |
128 |
+- if(!EVP_DecryptUpdate(&ctx, TEMP1, &outlen, wrapped_key, wrapped_key_len)) { |
129 |
++ if(!EVP_DecryptUpdate(ctx, TEMP1, &outlen, wrapped_key, wrapped_key_len)) { |
130 |
+ fprintf(stderr, "internal error (1) during key unwrap operation!\n"); |
131 |
+ return(-1); |
132 |
+ } |
133 |
+- if(!EVP_DecryptFinal_ex(&ctx, TEMP1 + outlen, &tmplen)) { |
134 |
++ if(!EVP_DecryptFinal_ex(ctx, TEMP1 + outlen, &tmplen)) { |
135 |
+ fprintf(stderr, "internal error (2) during key unwrap operation!\n"); |
136 |
+ return(-1); |
137 |
+ } |
138 |
+ outlen += tmplen; |
139 |
+- EVP_CIPHER_CTX_cleanup(&ctx); |
140 |
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L |
141 |
++ EVP_CIPHER_CTX_reset(ctx); |
142 |
++#else |
143 |
++ EVP_CIPHER_CTX_cleanup(ctx); |
144 |
++#endif |
145 |
+ |
146 |
+ /* reverse order of TEMP3 */ |
147 |
+ for(i = 0; i < outlen; i++) TEMP2[i] = TEMP1[outlen - i - 1]; |
148 |
+ |
149 |
+- EVP_CIPHER_CTX_init(&ctx); |
150 |
++ EVP_CIPHER_CTX_init(ctx); |
151 |
+ /* uses PKCS#7 padding for symmetric key operations by default */ |
152 |
+- EVP_DecryptInit_ex(&ctx, EVP_des_ede3_cbc(), NULL, decryptKey, TEMP2); |
153 |
+- if(!EVP_DecryptUpdate(&ctx, CEKICV, &outlen, TEMP2+8, outlen-8)) { |
154 |
++ EVP_DecryptInit_ex(ctx, EVP_des_ede3_cbc(), NULL, decryptKey, TEMP2); |
155 |
++ if(!EVP_DecryptUpdate(ctx, CEKICV, &outlen, TEMP2+8, outlen-8)) { |
156 |
+ fprintf(stderr, "internal error (3) during key unwrap operation!\n"); |
157 |
+ return(-1); |
158 |
+ } |
159 |
+- if(!EVP_DecryptFinal_ex(&ctx, CEKICV + outlen, &tmplen)) { |
160 |
++ if(!EVP_DecryptFinal_ex(ctx, CEKICV + outlen, &tmplen)) { |
161 |
+ fprintf(stderr, "internal error (4) during key unwrap operation!\n"); |
162 |
+ return(-1); |
163 |
+ } |
164 |
+ |
165 |
+ outlen += tmplen; |
166 |
+- EVP_CIPHER_CTX_cleanup(&ctx); |
167 |
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L |
168 |
++ EVP_CIPHER_CTX_reset(ctx); |
169 |
++#else |
170 |
++ EVP_CIPHER_CTX_cleanup(ctx); |
171 |
++#endif |
172 |
+ |
173 |
+ memcpy(unwrapped_key, CEKICV+4, outlen-4); |
174 |
+ free(TEMP1); |
175 |
+ free(TEMP2); |
176 |
+ free(CEKICV); |
177 |
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L |
178 |
++ EVP_CIPHER_CTX_free(ctx); |
179 |
++#else |
180 |
++ free(ctx); |
181 |
++#endif |
182 |
+ return(0); |
183 |
+ } |
184 |
+ |
185 |
+@@ -279,31 +302,46 @@ int unwrap_v1_header(char *passphrase, cencrypted_v1_header *header, uint8_t *ae |
186 |
+ int unwrap_v2_header(char *passphrase, cencrypted_v2_pwheader *header, uint8_t *aes_key, uint8_t *hmacsha1_key) { |
187 |
+ /* derived key is a 3DES-EDE key */ |
188 |
+ uint8_t derived_key[192/8]; |
189 |
+- EVP_CIPHER_CTX ctx; |
190 |
++ EVP_CIPHER_CTX *ctx; |
191 |
+ uint8_t *TEMP1; |
192 |
+ int outlen, tmplen; |
193 |
+ |
194 |
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L |
195 |
++ ctx = EVP_CIPHER_CTX_new(); |
196 |
++#else |
197 |
++ ctx = malloc(sizeof(*ctx)); |
198 |
++#endif |
199 |
++ if (!ctx) { |
200 |
++ fprintf(stderr, "Out of memory: EVP_CIPHER_CTX!\n"); |
201 |
++ return(-1); |
202 |
++ } |
203 |
++ |
204 |
+ PKCS5_PBKDF2_HMAC_SHA1(passphrase, strlen(passphrase), (unsigned char*)header->kdf_salt, 20, |
205 |
+ PBKDF2_ITERATION_COUNT, sizeof(derived_key), derived_key); |
206 |
+ |
207 |
+ print_hex(derived_key, 192/8); |
208 |
+ |
209 |
+- EVP_CIPHER_CTX_init(&ctx); |
210 |
++ EVP_CIPHER_CTX_init(ctx); |
211 |
+ /* result of the decryption operation shouldn't be bigger than ciphertext */ |
212 |
+ TEMP1 = malloc(header->encrypted_keyblob_size); |
213 |
+ /* uses PKCS#7 padding for symmetric key operations by default */ |
214 |
+- EVP_DecryptInit_ex(&ctx, EVP_des_ede3_cbc(), NULL, derived_key, header->blob_enc_iv); |
215 |
++ EVP_DecryptInit_ex(ctx, EVP_des_ede3_cbc(), NULL, derived_key, header->blob_enc_iv); |
216 |
+ |
217 |
+- if(!EVP_DecryptUpdate(&ctx, TEMP1, &outlen, header->encrypted_keyblob, header->encrypted_keyblob_size)) { |
218 |
++ if(!EVP_DecryptUpdate(ctx, TEMP1, &outlen, header->encrypted_keyblob, header->encrypted_keyblob_size)) { |
219 |
+ fprintf(stderr, "internal error (1) during key unwrap operation!\n"); |
220 |
+ return(-1); |
221 |
+ } |
222 |
+- if(!EVP_DecryptFinal_ex(&ctx, TEMP1 + outlen, &tmplen)) { |
223 |
++ if(!EVP_DecryptFinal_ex(ctx, TEMP1 + outlen, &tmplen)) { |
224 |
+ fprintf(stderr, "internal error (2) during key unwrap operation!\n"); |
225 |
+ return(-1); |
226 |
+ } |
227 |
+ outlen += tmplen; |
228 |
+- EVP_CIPHER_CTX_cleanup(&ctx); |
229 |
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L |
230 |
++ EVP_CIPHER_CTX_free(ctx); |
231 |
++#else |
232 |
++ EVP_CIPHER_CTX_cleanup(ctx); |
233 |
++ free(ctx); |
234 |
++#endif |
235 |
+ memcpy(aes_key, TEMP1, 16); |
236 |
+ memcpy(hmacsha1_key, TEMP1, 20); |
237 |
+ |
238 |
+@@ -446,8 +484,21 @@ int main(int argc, char *argv[]) { |
239 |
+ CHUNK_SIZE = v2header.blocksize; |
240 |
+ } |
241 |
+ |
242 |
+- HMAC_CTX_init(&hmacsha1_ctx); |
243 |
+- HMAC_Init_ex(&hmacsha1_ctx, hmacsha1_key, sizeof(hmacsha1_key), EVP_sha1(), NULL); |
244 |
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L |
245 |
++ hmacsha1_ctx = HMAC_CTX_new(); |
246 |
++#else |
247 |
++ hmacsha1_ctx = malloc(sizeof(*hmacsha1_ctx)); |
248 |
++#endif |
249 |
++ if (!hmacsha1_ctx) { |
250 |
++ fprintf(stderr, "Out of memory: HMAC CTX!\n"); |
251 |
++ exit(1); |
252 |
++ } |
253 |
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L |
254 |
++ HMAC_CTX_reset(hmacsha1_ctx); |
255 |
++#else |
256 |
++ HMAC_CTX_init(hmacsha1_ctx); |
257 |
++#endif |
258 |
++ HMAC_Init_ex(hmacsha1_ctx, hmacsha1_key, sizeof(hmacsha1_key), EVP_sha1(), NULL); |
259 |
+ AES_set_decrypt_key(aes_key, CIPHER_KEY_LENGTH * 8, &aes_decrypt_key); |
260 |
+ |
261 |
+ if (verbose >= 1) { |
262 |
+@@ -472,5 +523,11 @@ int main(int argc, char *argv[]) { |
263 |
+ } |
264 |
+ |
265 |
+ if (verbose) fprintf(stderr, "%"PRIX32" chunks written\n", chunk_no); |
266 |
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L |
267 |
++ HMAC_CTX_free(hmacsha1_ctx); |
268 |
++#else |
269 |
++ HMAC_CTX_cleanup(hmacsha1_ctx); |
270 |
++ free(hmacsha1_ctx); |
271 |
++#endif |
272 |
+ return(0); |
273 |
+ } |