Lines 1-33
Link Here
|
1 |
Fix build for FreeBSD 9.x base OpenSSL and LibreSSL. Fix for LibreSSL is |
1 |
--- lib/mega.c.orig 2018-07-22 23:41:55.000000000 +0200 |
2 |
already in upstream repository, so this file can be removed once FreeBSD 9.x |
2 |
+++ lib/mega.c 2018-07-25 10:45:41.692456000 +0200 |
3 |
support is dropped AND the next version of megatools is released. |
3 |
@@ -3172,6 +3172,7 @@ |
4 |
--- lib/mega.c.orig 2016-11-03 13:45:42 UTC |
4 |
GError *local_err = NULL; |
5 |
+++ lib/mega.c |
5 |
gc_free gchar *url = NULL; |
6 |
@@ -29,7 +29,9 @@ |
6 |
gc_string_free GString *response = NULL; |
7 |
#include <string.h> |
7 |
+ gc_free gchar* chksum = NULL; |
8 |
#include <time.h> |
8 |
|
9 |
#include <openssl/aes.h> |
9 |
tman_debug("W[%d]: started for chunk %d\n", worker->index, c->index); |
10 |
+#if OPENSSL_VERSION_NUMBER >= 0x101000000L && !defined(LIBRESSL_VERSION_NUMBER) |
10 |
|
11 |
#include <openssl/modes.h> |
11 |
@@ -3217,7 +3218,7 @@ |
12 |
+#endif |
12 |
} |
13 |
#include <openssl/bn.h> |
13 |
|
14 |
#include <openssl/rsa.h> |
14 |
// prepare URL including chunk offset |
15 |
#include <openssl/rand.h> |
15 |
- gc_free gchar* chksum = upload_checksum(buf, c->size); |
16 |
@@ -803,7 +805,7 @@ static gboolean rsa_key_gen(rsa_key* k) |
16 |
+ chksum = upload_checksum(buf, c->size); |
17 |
return FALSE; |
17 |
url = g_strdup_printf("%s/%" G_GOFFSET_FORMAT "?c=%s", t->upload_url, c->offset, chksum); |
18 |
} |
18 |
|
19 |
|
19 |
// perform upload POST |
20 |
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L |
20 |
@@ -4639,6 +4640,26 @@ |
21 |
+#if OPENSSL_VERSION_NUMBER >= 0x101000000L && !defined(LIBRESSL_VERSION_NUMBER) |
21 |
} |
22 |
RSA_get0_key(key, &k->m, &k->e, &k->d); |
22 |
|
23 |
RSA_get0_factors(key, &k->q, &k->p); |
23 |
// }}} |
24 |
RSA_get0_crt_params(key, NULL, NULL, &k->u); |
24 |
+// {{{ mega_node_has_ancestor |
25 |
@@ -2988,7 +2990,7 @@ struct _put_data |
25 |
+ |
26 |
GByteArray* buffer; |
26 |
+gboolean mega_node_has_ancestor(struct mega_node *n, struct mega_node *ancestor) |
27 |
}; |
27 |
+{ |
28 |
|
28 |
+ g_return_val_if_fail(n != NULL, FALSE); |
29 |
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L |
29 |
+ g_return_val_if_fail(ancestor != NULL, FALSE); |
30 |
+#if OPENSSL_VERSION_NUMBER >= 0x101000000L && !defined(LIBRESSL_VERSION_NUMBER) |
30 |
+ |
31 |
void AES_ctr128_encrypt( |
31 |
+ struct mega_node* it = n->parent; |
32 |
const unsigned char *in, |
32 |
+ |
33 |
unsigned char *out, |
33 |
+ while (it) { |
|
|
34 |
+ if (it == ancestor) |
35 |
+ return TRUE; |
36 |
+ |
37 |
+ it = it->parent; |
38 |
+ } |
39 |
+ |
40 |
+ return FALSE; |
41 |
+} |
42 |
+ |
43 |
+// }}} |
44 |
|
45 |
// {{{ mega_session_save |
46 |
|