marinofaggiana 4 years ago
parent
commit
601b8c6c17

+ 1 - 2
Cartfile

@@ -4,7 +4,6 @@ github "kishikawakatsumi/UICKeyChainStore" "v2.1.2"
 github "MortimerGoro/MGSwipeTableCell" "1.6.8"
 github "dzenbot/DZNEmptyDataSet" "v1.8.1"
 github "jdg/MBProgressHUD" "1.1.0"
-github "realm/realm-cocoa" "v5.4.0"
 github "SVGKit/SVGKit" "3.x"
 github "WeTransfer/WeScan" "1.2.0"
 github "malcommac/SwiftRichString"
@@ -12,7 +11,6 @@ github "yannickl/QRCodeReader.swift" "10.1.1"
 github "weichsel/ZIPFoundation" "0.9.10"
 github "rechsteiner/Parchment" "v2.4.0"
 github "WenchaoD/FSCalendar" "2.8.0"
-github "krzyzanowskim/OpenSSL" "1.0.218"
 github "huri000/SwiftEntryKit" "1.2.3"
 github "scenee/FloatingPanel"
 github "ivanbruel/MarkdownKit"
@@ -23,3 +21,4 @@ github "AssistoLab/DropDown" "v2.3.13"
 
 github "https://github.com/marinofaggiana/KTVHTTPCache" "2.0.2"
 github "https://github.com/marinofaggiana/TOPasscodeViewController" "0.0.7"
+github "https://github.com/marinofaggiana/OpenSSL"

+ 1 - 2
Cartfile.resolved

@@ -14,12 +14,11 @@ github "huri000/SwiftEntryKit" "1.2.3"
 github "ivanbruel/MarkdownKit" "1.6"
 github "jdg/MBProgressHUD" "1.1.0"
 github "kishikawakatsumi/UICKeyChainStore" "v2.1.2"
-github "krzyzanowskim/OpenSSL" "1.0.218"
 github "malcommac/SwiftRichString" "3.7.2"
 github "marinofaggiana/KTVHTTPCache" "2.0.2"
+github "marinofaggiana/OpenSSL" "1.0.220"
 github "marinofaggiana/TOPasscodeViewController" "0.0.7"
 github "nextcloud/ios-communication-library" "856c5e5375b13c70e8cac87f4e8cc5d14045efcd"
-github "realm/realm-cocoa" "v5.4.0"
 github "rechsteiner/Parchment" "v2.4.0"
 github "scenee/FloatingPanel" "v1.7.5"
 github "tilltue/TLPhotoPicker" "2.0.12"

+ 0 - 98
Libraries external/openssl/async.h

@@ -1,98 +0,0 @@
-/*
- * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the OpenSSL license (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#include <stdlib.h>
-
-#ifndef HEADER_ASYNC_H
-# define HEADER_ASYNC_H
-
-#if defined(_WIN32)
-# if defined(BASETYPES) || defined(_WINDEF_H)
-/* application has to include <windows.h> to use this */
-#define OSSL_ASYNC_FD       HANDLE
-#define OSSL_BAD_ASYNC_FD   INVALID_HANDLE_VALUE
-# endif
-#else
-#define OSSL_ASYNC_FD       int
-#define OSSL_BAD_ASYNC_FD   -1
-#endif
-
-
-# ifdef  __cplusplus
-extern "C" {
-# endif
-
-typedef struct async_job_st ASYNC_JOB;
-typedef struct async_wait_ctx_st ASYNC_WAIT_CTX;
-
-#define ASYNC_ERR      0
-#define ASYNC_NO_JOBS  1
-#define ASYNC_PAUSE    2
-#define ASYNC_FINISH   3
-
-int ASYNC_init_thread(size_t max_size, size_t init_size);
-void ASYNC_cleanup_thread(void);
-
-#ifdef OSSL_ASYNC_FD
-ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void);
-void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx);
-int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key,
-                               OSSL_ASYNC_FD fd,
-                               void *custom_data,
-                               void (*cleanup)(ASYNC_WAIT_CTX *, const void *,
-                                               OSSL_ASYNC_FD, void *));
-int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key,
-                        OSSL_ASYNC_FD *fd, void **custom_data);
-int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd,
-                               size_t *numfds);
-int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd,
-                                   size_t *numaddfds, OSSL_ASYNC_FD *delfd,
-                                   size_t *numdelfds);
-int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key);
-#endif
-
-int ASYNC_is_capable(void);
-
-int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret,
-                    int (*func)(void *), void *args, size_t size);
-int ASYNC_pause_job(void);
-
-ASYNC_JOB *ASYNC_get_current_job(void);
-ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job);
-void ASYNC_block_pause(void);
-void ASYNC_unblock_pause(void);
-
-/* BEGIN ERROR CODES */
-/*
- * The following lines are auto generated by the script mkerr.pl. Any changes
- * made after this point may be overwritten when the script is next run.
- */
-
-int ERR_load_ASYNC_strings(void);
-
-/* Error codes for the ASYNC functions. */
-
-/* Function codes. */
-# define ASYNC_F_ASYNC_CTX_NEW                            100
-# define ASYNC_F_ASYNC_INIT_THREAD                        101
-# define ASYNC_F_ASYNC_JOB_NEW                            102
-# define ASYNC_F_ASYNC_PAUSE_JOB                          103
-# define ASYNC_F_ASYNC_START_FUNC                         104
-# define ASYNC_F_ASYNC_START_JOB                          105
-
-/* Reason codes. */
-# define ASYNC_R_FAILED_TO_SET_POOL                       101
-# define ASYNC_R_FAILED_TO_SWAP_CONTEXT                   102
-# define ASYNC_R_INIT_FAILED                              105
-# define ASYNC_R_INVALID_POOL_SIZE                        103
-
-# ifdef  __cplusplus
-}
-# endif
-#endif

+ 0 - 533
Libraries external/openssl/ct.h

@@ -1,533 +0,0 @@
-/*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the OpenSSL license (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_CT_H
-# define HEADER_CT_H
-
-# include <openssl/opensslconf.h>
-
-# ifndef OPENSSL_NO_CT
-# include <openssl/ossl_typ.h>
-# include <openssl/safestack.h>
-# include <openssl/x509.h>
-# ifdef  __cplusplus
-extern "C" {
-# endif
-
-
-/* Minimum RSA key size, from RFC6962 */
-# define SCT_MIN_RSA_BITS 2048
-
-/* All hashes are SHA256 in v1 of Certificate Transparency */
-# define CT_V1_HASHLEN SHA256_DIGEST_LENGTH
-
-typedef enum {
-    CT_LOG_ENTRY_TYPE_NOT_SET = -1,
-    CT_LOG_ENTRY_TYPE_X509 = 0,
-    CT_LOG_ENTRY_TYPE_PRECERT = 1
-} ct_log_entry_type_t;
-
-typedef enum {
-    SCT_VERSION_NOT_SET = -1,
-    SCT_VERSION_V1 = 0
-} sct_version_t;
-
-typedef enum {
-    SCT_SOURCE_UNKNOWN,
-    SCT_SOURCE_TLS_EXTENSION,
-    SCT_SOURCE_X509V3_EXTENSION,
-    SCT_SOURCE_OCSP_STAPLED_RESPONSE
-} sct_source_t;
-
-typedef enum {
-    SCT_VALIDATION_STATUS_NOT_SET,
-    SCT_VALIDATION_STATUS_UNKNOWN_LOG,
-    SCT_VALIDATION_STATUS_VALID,
-    SCT_VALIDATION_STATUS_INVALID,
-    SCT_VALIDATION_STATUS_UNVERIFIED,
-    SCT_VALIDATION_STATUS_UNKNOWN_VERSION
-} sct_validation_status_t;
-
-DEFINE_STACK_OF(SCT)
-DEFINE_STACK_OF(CTLOG)
-
-/******************************************
- * CT policy evaluation context functions *
- ******************************************/
-
-/*
- * Creates a new, empty policy evaluation context.
- * The caller is responsible for calling CT_POLICY_EVAL_CTX_free when finished
- * with the CT_POLICY_EVAL_CTX.
- */
-CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void);
-
-/* Deletes a policy evaluation context and anything it owns. */
-void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx);
-
-/* Gets the peer certificate that the SCTs are for */
-X509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx);
-
-/*
- * Sets the certificate associated with the received SCTs.
- * Increments the reference count of cert.
- * Returns 1 on success, 0 otherwise.
- */
-int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert);
-
-/* Gets the issuer of the aforementioned certificate */
-X509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx);
-
-/*
- * Sets the issuer of the certificate associated with the received SCTs.
- * Increments the reference count of issuer.
- * Returns 1 on success, 0 otherwise.
- */
-int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer);
-
-/* Gets the CT logs that are trusted sources of SCTs */
-const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx);
-
-/* Sets the log store that is in use. It must outlive the CT_POLICY_EVAL_CTX. */
-void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx,
-                                               CTLOG_STORE *log_store);
-
-/*
- * Gets the time, in milliseconds since the Unix epoch, that will be used as the
- * current time when checking whether an SCT was issued in the future.
- * Such SCTs will fail validation, as required by RFC6962.
- */
-uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx);
-
-/*
- * Sets the time to evaluate SCTs against, in milliseconds since the Unix epoch.
- * If an SCT's timestamp is after this time, it will be interpreted as having
- * been issued in the future. RFC6962 states that "TLS clients MUST reject SCTs
- * whose timestamp is in the future", so an SCT will not validate in this case.
- */
-void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms);
-
-/*****************
- * SCT functions *
- *****************/
-
-/*
- * Creates a new, blank SCT.
- * The caller is responsible for calling SCT_free when finished with the SCT.
- */
-SCT *SCT_new(void);
-
-/*
- * Creates a new SCT from some base64-encoded strings.
- * The caller is responsible for calling SCT_free when finished with the SCT.
- */
-SCT *SCT_new_from_base64(unsigned char version,
-                         const char *logid_base64,
-                         ct_log_entry_type_t entry_type,
-                         uint64_t timestamp,
-                         const char *extensions_base64,
-                         const char *signature_base64);
-
-/*
- * Frees the SCT and the underlying data structures.
- */
-void SCT_free(SCT *sct);
-
-/*
- * Free a stack of SCTs, and the underlying SCTs themselves.
- * Intended to be compatible with X509V3_EXT_FREE.
- */
-void SCT_LIST_free(STACK_OF(SCT) *a);
-
-/*
- * Returns the version of the SCT.
- */
-sct_version_t SCT_get_version(const SCT *sct);
-
-/*
- * Set the version of an SCT.
- * Returns 1 on success, 0 if the version is unrecognized.
- */
-__owur int SCT_set_version(SCT *sct, sct_version_t version);
-
-/*
- * Returns the log entry type of the SCT.
- */
-ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct);
-
-/*
- * Set the log entry type of an SCT.
- * Returns 1 on success, 0 otherwise.
- */
-__owur int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type);
-
-/*
- * Gets the ID of the log that an SCT came from.
- * Ownership of the log ID remains with the SCT.
- * Returns the length of the log ID.
- */
-size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id);
-
-/*
- * Set the log ID of an SCT to point directly to the *log_id specified.
- * The SCT takes ownership of the specified pointer.
- * Returns 1 on success, 0 otherwise.
- */
-__owur int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len);
-
-/*
- * Set the log ID of an SCT.
- * This makes a copy of the log_id.
- * Returns 1 on success, 0 otherwise.
- */
-__owur int SCT_set1_log_id(SCT *sct, const unsigned char *log_id,
-                           size_t log_id_len);
-
-/*
- * Returns the timestamp for the SCT (epoch time in milliseconds).
- */
-uint64_t SCT_get_timestamp(const SCT *sct);
-
-/*
- * Set the timestamp of an SCT (epoch time in milliseconds).
- */
-void SCT_set_timestamp(SCT *sct, uint64_t timestamp);
-
-/*
- * Return the NID for the signature used by the SCT.
- * For CT v1, this will be either NID_sha256WithRSAEncryption or
- * NID_ecdsa_with_SHA256 (or NID_undef if incorrect/unset).
- */
-int SCT_get_signature_nid(const SCT *sct);
-
-/*
- * Set the signature type of an SCT
- * For CT v1, this should be either NID_sha256WithRSAEncryption or
- * NID_ecdsa_with_SHA256.
- * Returns 1 on success, 0 otherwise.
- */
-__owur int SCT_set_signature_nid(SCT *sct, int nid);
-
-/*
- * Set *ext to point to the extension data for the SCT. ext must not be NULL.
- * The SCT retains ownership of this pointer.
- * Returns length of the data pointed to.
- */
-size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext);
-
-/*
- * Set the extensions of an SCT to point directly to the *ext specified.
- * The SCT takes ownership of the specified pointer.
- */
-void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len);
-
-/*
- * Set the extensions of an SCT.
- * This takes a copy of the ext.
- * Returns 1 on success, 0 otherwise.
- */
-__owur int SCT_set1_extensions(SCT *sct, const unsigned char *ext,
-                               size_t ext_len);
-
-/*
- * Set *sig to point to the signature for the SCT. sig must not be NULL.
- * The SCT retains ownership of this pointer.
- * Returns length of the data pointed to.
- */
-size_t SCT_get0_signature(const SCT *sct, unsigned char **sig);
-
-/*
- * Set the signature of an SCT to point directly to the *sig specified.
- * The SCT takes ownership of the specified pointer.
- */
-void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len);
-
-/*
- * Set the signature of an SCT to be a copy of the *sig specified.
- * Returns 1 on success, 0 otherwise.
- */
-__owur int SCT_set1_signature(SCT *sct, const unsigned char *sig,
-                              size_t sig_len);
-
-/*
- * The origin of this SCT, e.g. TLS extension, OCSP response, etc.
- */
-sct_source_t SCT_get_source(const SCT *sct);
-
-/*
- * Set the origin of this SCT, e.g. TLS extension, OCSP response, etc.
- * Returns 1 on success, 0 otherwise.
- */
-__owur int SCT_set_source(SCT *sct, sct_source_t source);
-
-/*
- * Returns a text string describing the validation status of |sct|.
- */
-const char *SCT_validation_status_string(const SCT *sct);
-
-/*
- * Pretty-prints an |sct| to |out|.
- * It will be indented by the number of spaces specified by |indent|.
- * If |logs| is not NULL, it will be used to lookup the CT log that the SCT came
- * from, so that the log name can be printed.
- */
-void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs);
-
-/*
- * Pretty-prints an |sct_list| to |out|.
- * It will be indented by the number of spaces specified by |indent|.
- * SCTs will be delimited by |separator|.
- * If |logs| is not NULL, it will be used to lookup the CT log that each SCT
- * came from, so that the log names can be printed.
- */
-void SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent,
-                    const char *separator, const CTLOG_STORE *logs);
-
-/*
- * Gets the last result of validating this SCT.
- * If it has not been validated yet, returns SCT_VALIDATION_STATUS_NOT_SET.
- */
-sct_validation_status_t SCT_get_validation_status(const SCT *sct);
-
-/*
- * Validates the given SCT with the provided context.
- * Sets the "validation_status" field of the SCT.
- * Returns 1 if the SCT is valid and the signature verifies.
- * Returns 0 if the SCT is invalid or could not be verified.
- * Returns -1 if an error occurs.
- */
-__owur int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx);
-
-/*
- * Validates the given list of SCTs with the provided context.
- * Sets the "validation_status" field of each SCT.
- * Returns 1 if there are no invalid SCTs and all signatures verify.
- * Returns 0 if at least one SCT is invalid or could not be verified.
- * Returns a negative integer if an error occurs.
- */
-__owur int SCT_LIST_validate(const STACK_OF(SCT) *scts,
-                             CT_POLICY_EVAL_CTX *ctx);
-
-
-/*********************************
- * SCT parsing and serialisation *
- *********************************/
-
-/*
- * Serialize (to TLS format) a stack of SCTs and return the length.
- * "a" must not be NULL.
- * If "pp" is NULL, just return the length of what would have been serialized.
- * If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
- * for data that caller is responsible for freeing (only if function returns
- * successfully).
- * If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
- * that "*pp" is large enough to accept all of the serialized data.
- * Returns < 0 on error, >= 0 indicating bytes written (or would have been)
- * on success.
- */
-__owur int i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
-
-/*
- * Convert TLS format SCT list to a stack of SCTs.
- * If "a" or "*a" is NULL, a new stack will be created that the caller is
- * responsible for freeing (by calling SCT_LIST_free).
- * "**pp" and "*pp" must not be NULL.
- * Upon success, "*pp" will point to after the last bytes read, and a stack
- * will be returned.
- * Upon failure, a NULL pointer will be returned, and the position of "*pp" is
- * not defined.
- */
-STACK_OF(SCT) *o2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
-                            size_t len);
-
-/*
- * Serialize (to DER format) a stack of SCTs and return the length.
- * "a" must not be NULL.
- * If "pp" is NULL, just returns the length of what would have been serialized.
- * If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
- * for data that caller is responsible for freeing (only if function returns
- * successfully).
- * If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
- * that "*pp" is large enough to accept all of the serialized data.
- * Returns < 0 on error, >= 0 indicating bytes written (or would have been)
- * on success.
- */
-__owur int i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
-
-/*
- * Parses an SCT list in DER format and returns it.
- * If "a" or "*a" is NULL, a new stack will be created that the caller is
- * responsible for freeing (by calling SCT_LIST_free).
- * "**pp" and "*pp" must not be NULL.
- * Upon success, "*pp" will point to after the last bytes read, and a stack
- * will be returned.
- * Upon failure, a NULL pointer will be returned, and the position of "*pp" is
- * not defined.
- */
-STACK_OF(SCT) *d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
-                            long len);
-
-/*
- * Serialize (to TLS format) an |sct| and write it to |out|.
- * If |out| is null, no SCT will be output but the length will still be returned.
- * If |out| points to a null pointer, a string will be allocated to hold the
- * TLS-format SCT. It is the responsibility of the caller to free it.
- * If |out| points to an allocated string, the TLS-format SCT will be written
- * to it.
- * The length of the SCT in TLS format will be returned.
- */
-__owur int i2o_SCT(const SCT *sct, unsigned char **out);
-
-/*
- * Parses an SCT in TLS format and returns it.
- * If |psct| is not null, it will end up pointing to the parsed SCT. If it
- * already points to a non-null pointer, the pointer will be free'd.
- * |in| should be a pointer to a string containing the TLS-format SCT.
- * |in| will be advanced to the end of the SCT if parsing succeeds.
- * |len| should be the length of the SCT in |in|.
- * Returns NULL if an error occurs.
- * If the SCT is an unsupported version, only the SCT's 'sct' and 'sct_len'
- * fields will be populated (with |in| and |len| respectively).
- */
-SCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len);
-
-/********************
- * CT log functions *
- ********************/
-
-/*
- * Creates a new CT log instance with the given |public_key| and |name|.
- * Takes ownership of |public_key| but copies |name|.
- * Returns NULL if malloc fails or if |public_key| cannot be converted to DER.
- * Should be deleted by the caller using CTLOG_free when no longer needed.
- */
-CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name);
-
-/*
- * Creates a new CTLOG instance with the base64-encoded SubjectPublicKeyInfo DER
- * in |pkey_base64|. The |name| is a string to help users identify this log.
- * Returns 1 on success, 0 on failure.
- * Should be deleted by the caller using CTLOG_free when no longer needed.
- */
-int CTLOG_new_from_base64(CTLOG ** ct_log,
-                          const char *pkey_base64, const char *name);
-
-/*
- * Deletes a CT log instance and its fields.
- */
-void CTLOG_free(CTLOG *log);
-
-/* Gets the name of the CT log */
-const char *CTLOG_get0_name(const CTLOG *log);
-/* Gets the ID of the CT log */
-void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id,
-                       size_t *log_id_len);
-/* Gets the public key of the CT log */
-EVP_PKEY *CTLOG_get0_public_key(const CTLOG *log);
-
-/**************************
- * CT log store functions *
- **************************/
-
-/*
- * Creates a new CT log store.
- * Should be deleted by the caller using CTLOG_STORE_free when no longer needed.
- */
-CTLOG_STORE *CTLOG_STORE_new(void);
-
-/*
- * Deletes a CT log store and all of the CT log instances held within.
- */
-void CTLOG_STORE_free(CTLOG_STORE *store);
-
-/*
- * Finds a CT log in the store based on its log ID.
- * Returns the CT log, or NULL if no match is found.
- */
-const CTLOG *CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store,
-                                        const uint8_t *log_id,
-                                        size_t log_id_len);
-
-/*
- * Loads a CT log list into a |store| from a |file|.
- * Returns 1 if loading is successful, or 0 otherwise.
- */
-__owur int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file);
-
-/*
- * Loads the default CT log list into a |store|.
- * See internal/cryptlib.h for the environment variable and file path that are
- * consulted to find the default file.
- * Returns 1 if loading is successful, or 0 otherwise.
- */
-__owur int CTLOG_STORE_load_default_file(CTLOG_STORE *store);
-
-/* BEGIN ERROR CODES */
-/*
- * The following lines are auto generated by the script mkerr.pl. Any changes
- * made after this point may be overwritten when the script is next run.
- */
-
-int ERR_load_CT_strings(void);
-
-/* Error codes for the CT functions. */
-
-/* Function codes. */
-# define CT_F_CTLOG_NEW                                   117
-# define CT_F_CTLOG_NEW_FROM_BASE64                       118
-# define CT_F_CTLOG_NEW_FROM_CONF                         119
-# define CT_F_CTLOG_STORE_LOAD_CTX_NEW                    122
-# define CT_F_CTLOG_STORE_LOAD_FILE                       123
-# define CT_F_CTLOG_STORE_LOAD_LOG                        130
-# define CT_F_CTLOG_STORE_NEW                             131
-# define CT_F_CT_BASE64_DECODE                            124
-# define CT_F_CT_POLICY_EVAL_CTX_NEW                      133
-# define CT_F_CT_V1_LOG_ID_FROM_PKEY                      125
-# define CT_F_I2O_SCT                                     107
-# define CT_F_I2O_SCT_LIST                                108
-# define CT_F_I2O_SCT_SIGNATURE                           109
-# define CT_F_O2I_SCT                                     110
-# define CT_F_O2I_SCT_LIST                                111
-# define CT_F_O2I_SCT_SIGNATURE                           112
-# define CT_F_SCT_CTX_NEW                                 126
-# define CT_F_SCT_CTX_VERIFY                              128
-# define CT_F_SCT_NEW                                     100
-# define CT_F_SCT_NEW_FROM_BASE64                         127
-# define CT_F_SCT_SET0_LOG_ID                             101
-# define CT_F_SCT_SET1_EXTENSIONS                         114
-# define CT_F_SCT_SET1_LOG_ID                             115
-# define CT_F_SCT_SET1_SIGNATURE                          116
-# define CT_F_SCT_SET_LOG_ENTRY_TYPE                      102
-# define CT_F_SCT_SET_SIGNATURE_NID                       103
-# define CT_F_SCT_SET_VERSION                             104
-
-/* Reason codes. */
-# define CT_R_BASE64_DECODE_ERROR                         108
-# define CT_R_INVALID_LOG_ID_LENGTH                       100
-# define CT_R_LOG_CONF_INVALID                            109
-# define CT_R_LOG_CONF_INVALID_KEY                        110
-# define CT_R_LOG_CONF_MISSING_DESCRIPTION                111
-# define CT_R_LOG_CONF_MISSING_KEY                        112
-# define CT_R_LOG_KEY_INVALID                             113
-# define CT_R_SCT_FUTURE_TIMESTAMP                        116
-# define CT_R_SCT_INVALID                                 104
-# define CT_R_SCT_INVALID_SIGNATURE                       107
-# define CT_R_SCT_LIST_INVALID                            105
-# define CT_R_SCT_LOG_ID_MISMATCH                         114
-# define CT_R_SCT_NOT_SET                                 106
-# define CT_R_SCT_UNSUPPORTED_VERSION                     115
-# define CT_R_UNRECOGNIZED_SIGNATURE_NID                  101
-# define CT_R_UNSUPPORTED_ENTRY_TYPE                      102
-# define CT_R_UNSUPPORTED_VERSION                         103
-
-#  ifdef  __cplusplus
-}
-#  endif
-# endif
-#endif

+ 0 - 75
Libraries external/openssl/kdf.h

@@ -1,75 +0,0 @@
-/*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the OpenSSL license (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_KDF_H
-# define HEADER_KDF_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-# define EVP_PKEY_CTRL_TLS_MD       (EVP_PKEY_ALG_CTRL)
-# define EVP_PKEY_CTRL_TLS_SECRET   (EVP_PKEY_ALG_CTRL + 1)
-# define EVP_PKEY_CTRL_TLS_SEED     (EVP_PKEY_ALG_CTRL + 2)
-# define EVP_PKEY_CTRL_HKDF_MD      (EVP_PKEY_ALG_CTRL + 3)
-# define EVP_PKEY_CTRL_HKDF_SALT    (EVP_PKEY_ALG_CTRL + 4)
-# define EVP_PKEY_CTRL_HKDF_KEY     (EVP_PKEY_ALG_CTRL + 5)
-# define EVP_PKEY_CTRL_HKDF_INFO    (EVP_PKEY_ALG_CTRL + 6)
-
-# define EVP_PKEY_CTX_set_tls1_prf_md(pctx, md) \
-            EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
-                              EVP_PKEY_CTRL_TLS_MD, 0, (void *)md)
-
-# define EVP_PKEY_CTX_set1_tls1_prf_secret(pctx, sec, seclen) \
-            EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
-                              EVP_PKEY_CTRL_TLS_SECRET, seclen, (void *)sec)
-
-# define EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, seed, seedlen) \
-            EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
-                              EVP_PKEY_CTRL_TLS_SEED, seedlen, (void *)seed)
-
-# define EVP_PKEY_CTX_set_hkdf_md(pctx, md) \
-            EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
-                              EVP_PKEY_CTRL_HKDF_MD, 0, (void *)md)
-
-# define EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt, saltlen) \
-            EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
-                              EVP_PKEY_CTRL_HKDF_SALT, saltlen, (void *)salt)
-
-# define EVP_PKEY_CTX_set1_hkdf_key(pctx, key, keylen) \
-            EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
-                              EVP_PKEY_CTRL_HKDF_KEY, keylen, (void *)key)
-
-# define EVP_PKEY_CTX_add1_hkdf_info(pctx, info, infolen) \
-            EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
-                              EVP_PKEY_CTRL_HKDF_INFO, infolen, (void *)info)
-
-/* BEGIN ERROR CODES */
-/*
- * The following lines are auto generated by the script mkerr.pl. Any changes
- * made after this point may be overwritten when the script is next run.
- */
-
-int ERR_load_KDF_strings(void);
-
-/* Error codes for the KDF functions. */
-
-/* Function codes. */
-# define KDF_F_PKEY_TLS1_PRF_CTRL_STR                     100
-# define KDF_F_PKEY_TLS1_PRF_DERIVE                       101
-
-/* Reason codes. */
-# define KDF_R_INVALID_DIGEST                             100
-# define KDF_R_MISSING_PARAMETER                          101
-# define KDF_R_VALUE_MISSING                              102
-
-# ifdef  __cplusplus
-}
-# endif
-#endif

+ 0 - 44
Libraries external/openssl/md2.h

@@ -1,44 +0,0 @@
-/*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the OpenSSL license (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_MD2_H
-# define HEADER_MD2_H
-
-# include <openssl/opensslconf.h>
-
-# ifndef OPENSSL_NO_MD2
-# include <stddef.h>
-# ifdef  __cplusplus
-extern "C" {
-# endif
-
-typedef unsigned char MD2_INT;
-
-# define MD2_DIGEST_LENGTH       16
-# define MD2_BLOCK               16
-
-typedef struct MD2state_st {
-    unsigned int num;
-    unsigned char data[MD2_BLOCK];
-    MD2_INT cksm[MD2_BLOCK];
-    MD2_INT state[MD2_BLOCK];
-} MD2_CTX;
-
-const char *MD2_options(void);
-int MD2_Init(MD2_CTX *c);
-int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len);
-int MD2_Final(unsigned char *md, MD2_CTX *c);
-unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md);
-
-# ifdef  __cplusplus
-}
-# endif
-# endif
-
-#endif

+ 0 - 63
Libraries external/openssl/rc5.h

@@ -1,63 +0,0 @@
-/*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the OpenSSL license (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef HEADER_RC5_H
-# define HEADER_RC5_H
-
-# include <openssl/opensslconf.h>
-
-# ifndef OPENSSL_NO_RC5
-# ifdef  __cplusplus
-extern "C" {
-# endif
-
-# define RC5_ENCRYPT     1
-# define RC5_DECRYPT     0
-
-# define RC5_32_INT unsigned int
-
-# define RC5_32_BLOCK            8
-# define RC5_32_KEY_LENGTH       16/* This is a default, max is 255 */
-
-/*
- * This are the only values supported.  Tweak the code if you want more The
- * most supported modes will be RC5-32/12/16 RC5-32/16/8
- */
-# define RC5_8_ROUNDS    8
-# define RC5_12_ROUNDS   12
-# define RC5_16_ROUNDS   16
-
-typedef struct rc5_key_st {
-    /* Number of rounds */
-    int rounds;
-    RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)];
-} RC5_32_KEY;
-
-void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
-                    int rounds);
-void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out,
-                        RC5_32_KEY *key, int enc);
-void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key);
-void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key);
-void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out,
-                        long length, RC5_32_KEY *ks, unsigned char *iv,
-                        int enc);
-void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out,
-                          long length, RC5_32_KEY *schedule,
-                          unsigned char *ivec, int *num, int enc);
-void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out,
-                          long length, RC5_32_KEY *schedule,
-                          unsigned char *ivec, int *num);
-
-# ifdef  __cplusplus
-}
-# endif
-# endif
-
-#endif

+ 132 - 16
Nextcloud.xcodeproj/project.pbxproj

@@ -3,7 +3,7 @@
 	archiveVersion = 1;
 	classes = {
 	};
-	objectVersion = 46;
+	objectVersion = 52;
 	objects = {
 
 /* Begin PBXBuildFile section */
@@ -202,6 +202,14 @@
 		F780710A1EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */ = {isa = PBXBuildFile; fileRef = F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */; };
 		F78111692507AEB500CB218B /* NCCollectionCommon.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78111682507AEB500CB218B /* NCCollectionCommon.swift */; };
 		F78295311F962EFA00A572F5 /* NCEndToEndEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F70CAE391F8CF31A008125FD /* NCEndToEndEncryption.m */; };
+		F782A57B25123694007BBABD /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = F782A57A25123694007BBABD /* Realm */; };
+		F782A57D25123694007BBABD /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = F782A57C25123694007BBABD /* RealmSwift */; };
+		F782A583251236B7007BBABD /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = F782A582251236B7007BBABD /* Realm */; };
+		F782A585251236B7007BBABD /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = F782A584251236B7007BBABD /* RealmSwift */; };
+		F782A587251236CA007BBABD /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = F782A586251236CA007BBABD /* Realm */; };
+		F782A589251236CA007BBABD /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = F782A588251236CA007BBABD /* RealmSwift */; };
+		F782A58B251236D1007BBABD /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = F782A58A251236D1007BBABD /* Realm */; };
+		F782A58D251236D1007BBABD /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = F782A58C251236D1007BBABD /* RealmSwift */; };
 		F782FDC424E6933900666099 /* NCUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70BFC7320E0FA7C00C67599 /* NCUtility.swift */; };
 		F785EE9D246196DF00B3F945 /* NCNetworkingE2EE.swift in Sources */ = {isa = PBXBuildFile; fileRef = F785EE9C246196DF00B3F945 /* NCNetworkingE2EE.swift */; };
 		F785EE9E2461A09900B3F945 /* NCNetworking.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75A9EE523796C6F0044CFCE /* NCNetworking.swift */; };
@@ -260,8 +268,6 @@
 		F7C40BEF219994ED0004137E /* KTVCocoaHTTPServer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7C40BEE219994ED0004137E /* KTVCocoaHTTPServer.framework */; };
 		F7C40BF1219994F20004137E /* KTVHTTPCache.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7C40BF0219994F20004137E /* KTVHTTPCache.framework */; };
 		F7C40BF32199978B0004137E /* MBProgressHUD.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7C40BF22199978B0004137E /* MBProgressHUD.framework */; };
-		F7C40C102199BA5D0004137E /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7C40C0F2199BA5D0004137E /* Realm.framework */; };
-		F7C40C122199BA620004137E /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7C40C112199BA620004137E /* RealmSwift.framework */; };
 		F7C7B489245EBA4100D93E60 /* NCViewerQuickLook.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C7B488245EBA4100D93E60 /* NCViewerQuickLook.swift */; };
 		F7C9555321F0C4CA0024296E /* NCActivity.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7C9555221F0C4CA0024296E /* NCActivity.storyboard */; };
 		F7C9555521F0C5470024296E /* NCActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C9555421F0C5470024296E /* NCActivity.swift */; };
@@ -722,6 +728,8 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				F782A58D251236D1007BBABD /* RealmSwift in Frameworks */,
+				F782A58B251236D1007BBABD /* Realm in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -729,6 +737,8 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				F782A585251236B7007BBABD /* RealmSwift in Frameworks */,
+				F782A583251236B7007BBABD /* Realm in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -736,6 +746,8 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				F782A589251236CA007BBABD /* RealmSwift in Frameworks */,
+				F782A587251236CA007BBABD /* Realm in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -765,15 +777,15 @@
 				F7063DF12199E56F003F38DA /* CocoaLumberjackSwift.framework in Frameworks */,
 				F7C40BE721998F410004137E /* DZNEmptyDataSet.framework in Frameworks */,
 				F7C40BEF219994ED0004137E /* KTVCocoaHTTPServer.framework in Frameworks */,
+				F782A57B25123694007BBABD /* Realm in Frameworks */,
 				F7C40BF1219994F20004137E /* KTVHTTPCache.framework in Frameworks */,
-				F7C40C102199BA5D0004137E /* Realm.framework in Frameworks */,
 				F774264122EB3F7300B23912 /* DropDown.framework in Frameworks */,
-				F7C40C122199BA620004137E /* RealmSwift.framework in Frameworks */,
 				F78AA20621F783E900D0F205 /* SwiftRichString.framework in Frameworks */,
 				F7DBD82C23E46A4700ECB7C6 /* MarkdownKit.framework in Frameworks */,
 				F74AFCE922E8B025003DE61F /* FSCalendar.framework in Frameworks */,
 				F700510322DF6897003A3356 /* Parchment.framework in Frameworks */,
 				F7D2C773246470CA008513AE /* XLForm.framework in Frameworks */,
+				F782A57D25123694007BBABD /* RealmSwift in Frameworks */,
 				371B5A3323D0BD5500FAFAE9 /* FloatingPanel.framework in Frameworks */,
 				F70F2BA5225F2D8900EBB73E /* ZIPFoundation.framework in Frameworks */,
 			);
@@ -1567,6 +1579,10 @@
 			dependencies = (
 			);
 			name = "Notification Service Extension";
+			packageProductDependencies = (
+				F782A58A251236D1007BBABD /* Realm */,
+				F782A58C251236D1007BBABD /* RealmSwift */,
+			);
 			productName = "Notification Service Extension";
 			productReference = 2C33C47F23E2C475005F963B /* Notification Service Extension.appex */;
 			productType = "com.apple.product-type.app-extension";
@@ -1584,6 +1600,10 @@
 			dependencies = (
 			);
 			name = Share;
+			packageProductDependencies = (
+				F782A582251236B7007BBABD /* Realm */,
+				F782A584251236B7007BBABD /* RealmSwift */,
+			);
 			productName = "Share Ext";
 			productReference = F7CE8AFB1DC1F8D8009CAE48 /* Share.appex */;
 			productType = "com.apple.product-type.app-extension";
@@ -1601,6 +1621,10 @@
 			dependencies = (
 			);
 			name = "File Provider Extension";
+			packageProductDependencies = (
+				F782A586251236CA007BBABD /* Realm */,
+				F782A588251236CA007BBABD /* RealmSwift */,
+			);
 			productName = "File Provider Extension";
 			productReference = F771E3D020E2392D00AFB62D /* File Provider Extension.appex */;
 			productType = "com.apple.product-type.app-extension";
@@ -1624,6 +1648,10 @@
 				2C33C48523E2C475005F963B /* PBXTargetDependency */,
 			);
 			name = Nextcloud;
+			packageProductDependencies = (
+				F782A57A25123694007BBABD /* Realm */,
+				F782A57C25123694007BBABD /* RealmSwift */,
+			);
 			productName = "Crypto Cloud";
 			productReference = F7CE8AFA1DC1F8D8009CAE48 /* Nextcloud.app */;
 			productType = "com.apple.product-type.application";
@@ -1727,6 +1755,9 @@
 				da,
 			);
 			mainGroup = F7F67B9F1A24D27800EE80DA;
+			packageReferences = (
+				F782A57925123694007BBABD /* XCRemoteSwiftPackageReference "realm-cocoa" */,
+			);
 			productRefGroup = F7F67B9F1A24D27800EE80DA;
 			projectDirPath = "";
 			projectRoot = "";
@@ -1864,8 +1895,6 @@
 				"$(SRCROOT)/Carthage/Build/iOS/KTVHTTPCache.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/KTVCocoaHTTPServer.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/MBProgressHUD.framework",
-				"$(SRCROOT)/Carthage/Build/iOS/Realm.framework",
-				"$(SRCROOT)/Carthage/Build/iOS/RealmSwift.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/SVGKit.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/CocoaLumberjack.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/CocoaLumberjackSwift.framework",
@@ -2226,7 +2255,11 @@
 				HEADER_SEARCH_PATHS = "\"Libraries external\"/**";
 				INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/Notification_Service_Extension.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@executable_path/../../Frameworks",
+				);
 				LIBRARY_SEARCH_PATHS = "\"Libraries external\"/**";
 				MARKETING_VERSION = 3.0.7;
 				MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
@@ -2277,7 +2310,11 @@
 				HEADER_SEARCH_PATHS = "\"Libraries external\"/**";
 				INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/Notification_Service_Extension.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@executable_path/../../Frameworks",
+				);
 				LIBRARY_SEARCH_PATHS = "\"Libraries external\"/**";
 				MARKETING_VERSION = 3.0.7;
 				MTL_FAST_MATH = YES;
@@ -2320,7 +2357,11 @@
 				HEADER_SEARCH_PATHS = "\"Libraries external\"/**";
 				INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/Share.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@executable_path/../../Frameworks",
+				);
 				LIBRARY_SEARCH_PATHS = "\"Libraries external\"/**";
 				MARKETING_VERSION = 3.0.7;
 				OTHER_LDFLAGS = "-ObjC";
@@ -2364,7 +2405,11 @@
 				HEADER_SEARCH_PATHS = "\"Libraries external\"/**";
 				INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/Share.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@executable_path/../../Frameworks",
+				);
 				LIBRARY_SEARCH_PATHS = "\"Libraries external\"/**";
 				MARKETING_VERSION = 3.0.7;
 				OTHER_LDFLAGS = "-ObjC";
@@ -2414,7 +2459,11 @@
 				HEADER_SEARCH_PATHS = "\"Libraries external\"/**";
 				INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/File_Provider_Extension.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@executable_path/../../Frameworks",
+				);
 				LIBRARY_SEARCH_PATHS = "\"Libraries external\"/**";
 				MARKETING_VERSION = 3.0.7;
 				OTHER_LDFLAGS = "-ObjC";
@@ -2464,7 +2513,11 @@
 				HEADER_SEARCH_PATHS = "\"Libraries external\"/**";
 				INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/File_Provider_Extension.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@executable_path/../../Frameworks",
+				);
 				LIBRARY_SEARCH_PATHS = "\"Libraries external\"/**";
 				MARKETING_VERSION = 3.0.7;
 				OTHER_LDFLAGS = "-ObjC";
@@ -2503,7 +2556,11 @@
 				HEADER_SEARCH_PATHS = "$(PROJECT_DIR)\"/Libraries external/openssl\"";
 				INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/iOSClient.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@executable_path/../../Frameworks",
+				);
 				LIBRARY_SEARCH_PATHS = "";
 				MARKETING_VERSION = 3.0.7;
 				OTHER_LDFLAGS = "-ObjC";
@@ -2547,7 +2604,11 @@
 				HEADER_SEARCH_PATHS = "$(PROJECT_DIR)\"/Libraries external/openssl\"";
 				INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/iOSClient.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+					"@executable_path/../../Frameworks",
+				);
 				LIBRARY_SEARCH_PATHS = "";
 				MARKETING_VERSION = 3.0.7;
 				OTHER_LDFLAGS = "-ObjC";
@@ -2681,7 +2742,8 @@
 				);
 				SDKROOT = iphoneos;
 				SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG NC";
-				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
+				SWIFT_COMPILATION_MODE = wholemodule;
+				SWIFT_OPTIMIZATION_LEVEL = "-O";
 				SWIFT_SWIFT3_OBJC_INFERENCE = Off;
 				VALIDATE_PRODUCT = YES;
 			};
@@ -2736,6 +2798,60 @@
 			defaultConfigurationName = Release;
 		};
 /* End XCConfigurationList section */
+
+/* Begin XCRemoteSwiftPackageReference section */
+		F782A57925123694007BBABD /* XCRemoteSwiftPackageReference "realm-cocoa" */ = {
+			isa = XCRemoteSwiftPackageReference;
+			repositoryURL = "https://github.com/realm/realm-cocoa";
+			requirement = {
+				kind = upToNextMajorVersion;
+				minimumVersion = 5.4.0;
+			};
+		};
+/* End XCRemoteSwiftPackageReference section */
+
+/* Begin XCSwiftPackageProductDependency section */
+		F782A57A25123694007BBABD /* Realm */ = {
+			isa = XCSwiftPackageProductDependency;
+			package = F782A57925123694007BBABD /* XCRemoteSwiftPackageReference "realm-cocoa" */;
+			productName = Realm;
+		};
+		F782A57C25123694007BBABD /* RealmSwift */ = {
+			isa = XCSwiftPackageProductDependency;
+			package = F782A57925123694007BBABD /* XCRemoteSwiftPackageReference "realm-cocoa" */;
+			productName = RealmSwift;
+		};
+		F782A582251236B7007BBABD /* Realm */ = {
+			isa = XCSwiftPackageProductDependency;
+			package = F782A57925123694007BBABD /* XCRemoteSwiftPackageReference "realm-cocoa" */;
+			productName = Realm;
+		};
+		F782A584251236B7007BBABD /* RealmSwift */ = {
+			isa = XCSwiftPackageProductDependency;
+			package = F782A57925123694007BBABD /* XCRemoteSwiftPackageReference "realm-cocoa" */;
+			productName = RealmSwift;
+		};
+		F782A586251236CA007BBABD /* Realm */ = {
+			isa = XCSwiftPackageProductDependency;
+			package = F782A57925123694007BBABD /* XCRemoteSwiftPackageReference "realm-cocoa" */;
+			productName = Realm;
+		};
+		F782A588251236CA007BBABD /* RealmSwift */ = {
+			isa = XCSwiftPackageProductDependency;
+			package = F782A57925123694007BBABD /* XCRemoteSwiftPackageReference "realm-cocoa" */;
+			productName = RealmSwift;
+		};
+		F782A58A251236D1007BBABD /* Realm */ = {
+			isa = XCSwiftPackageProductDependency;
+			package = F782A57925123694007BBABD /* XCRemoteSwiftPackageReference "realm-cocoa" */;
+			productName = Realm;
+		};
+		F782A58C251236D1007BBABD /* RealmSwift */ = {
+			isa = XCSwiftPackageProductDependency;
+			package = F782A57925123694007BBABD /* XCRemoteSwiftPackageReference "realm-cocoa" */;
+			productName = RealmSwift;
+		};
+/* End XCSwiftPackageProductDependency section */
 	};
 	rootObject = F7F67BA01A24D27800EE80DA /* Project object */;
 }

+ 25 - 0
Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

@@ -0,0 +1,25 @@
+{
+  "object": {
+    "pins": [
+      {
+        "package": "Realm",
+        "repositoryURL": "https://github.com/realm/realm-cocoa",
+        "state": {
+          "branch": null,
+          "revision": "6310911a38d55003f0b8acca96635aa2bfc3e2c0",
+          "version": "5.4.0"
+        }
+      },
+      {
+        "package": "RealmCore",
+        "repositoryURL": "https://github.com/realm/realm-core",
+        "state": {
+          "branch": null,
+          "revision": "34d7fbcbab2a94bcad081bddf9d172961cd84659",
+          "version": "6.0.25"
+        }
+      }
+    ]
+  },
+  "version": 1
+}

+ 1 - 1
Nextcloud.xcodeproj/xcshareddata/xcschemes/Nextcloud.xcscheme

@@ -3,7 +3,7 @@
    LastUpgradeVersion = "1020"
    version = "1.7">
    <BuildAction
-      parallelizeBuildables = "YES"
+      parallelizeBuildables = "NO"
       buildImplicitDependencies = "YES">
       <BuildActionEntries>
          <BuildActionEntry

+ 29 - 0
carthage-build.sh

@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+# carthage-build.sh
+# Usage example: ./carthage-build.sh --platform iOS
+
+set -euo pipefail
+
+xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
+trap 'rm -f "$xcconfig"' INT TERM HUP EXIT
+
+# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
+# the build will fail on lipo due to duplicate architectures.
+# Xcode 12 Beta 3:
+echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_12A8169g = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
+# Xcode 12 beta 4
+echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_12A8179i = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
+# Xcode 12 beta 5
+echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_12A8189h = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
+# Xcode 12 beta 6
+echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_12A8189n = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
+# Xcode 12 GM
+echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_12A7209 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
+
+echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$(XCODE_PRODUCT_BUILD_VERSION))' >> $xcconfig
+echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig
+
+export XCODE_XCCONFIG_FILE="$xcconfig"
+carthage build "$@"
+

+ 3 - 1
iOSClient/Main/CCMain.h

@@ -39,7 +39,7 @@
 @class tableMetadata;
 @class NCViewRichWorkspace;
 
-@interface CCMain : UITableViewController <UIActionSheetDelegate, UIGestureRecognizerDelegate, UIViewControllerPreviewingDelegate, UISplitViewControllerDelegate, UIPopoverControllerDelegate, UIDocumentMenuDelegate, UIDocumentPickerDelegate, UISearchResultsUpdating, UISearchControllerDelegate, UISearchBarDelegate, UIScrollViewDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
+@interface CCMain : UITableViewController <UIActionSheetDelegate, UIGestureRecognizerDelegate, UIViewControllerPreviewingDelegate, UISplitViewControllerDelegate, UIPopoverControllerDelegate, UIDocumentPickerDelegate, UISearchResultsUpdating, UISearchControllerDelegate, UISearchBarDelegate, UIScrollViewDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
 
 @property (nonatomic, strong) NCViewRichWorkspace *viewRichWorkspace;
 
@@ -83,5 +83,7 @@
 - (void)minCharTextFieldDidChange:(UITextField *)sender;
 - (void)actionDelete:(NSIndexPath *)indexPath;
 
+- (void)uploadFileAsset:(NSArray *)assets serverUrl:(NSString *)serverUrl useSubFolder:(BOOL)useSubFolder session:(NSString *)session;
+
 @end
 

+ 6 - 2
iOSClient/Main/CCMain.m

@@ -819,14 +819,18 @@
 #pragma mark ===== Upload new Photos/Videos =====
 #pragma --------------------------------------------------------------------------------------------
 
-- (void)uploadFileAsset:(NSMutableArray *)assets serverUrl:(NSString *)serverUrl useSubFolder:(BOOL)useSubFolder session:(NSString *)session
+-(void)dismissFormUploadAssets
+{
+}
+
+- (void)uploadFileAsset:(NSArray *)assets serverUrl:(NSString *)serverUrl useSubFolder:(BOOL)useSubFolder session:(NSString *)session
 {
     // if request create the folder for Auto Upload & the subfolders
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         
         NSString *autoUploadPath = [[NCManageDatabase sharedInstance] getAccountAutoUploadPathWithUrlBase:appDelegate.urlBase account:appDelegate.account];
         if ([autoUploadPath isEqualToString:serverUrl]) {
-            if ([[NCNetworking shared] createFolderWithAssets:(PHFetchResult *)assets selector:selectorUploadFile useSubFolder:useSubFolder account:appDelegate.account urlBase:appDelegate.urlBase]) {
+            if ([[NCNetworking shared] createFolderWithAssets:assets selector:selectorUploadFile useSubFolder:useSubFolder account:appDelegate.account urlBase:appDelegate.urlBase]) {
                 [[NCContentPresenter shared] messageNotification:@"_error_" description:@"_error_createsubfolders_upload_" delay:k_dismissAfterSecond type:messageTypeError errorCode:k_CCErrorInternalError forced:true];
                 return;
             }

+ 20 - 2
iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift

@@ -325,6 +325,25 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate {
         }
     }
     
+    @objc func save() {
+        
+        self.dismiss(animated: true, completion: {
+            
+            let useFolderPhotoRow : XLFormRowDescriptor  = self.form.formRow(withTag: "useFolderAutoUpload")!
+            let useSubFolderRow : XLFormRowDescriptor  = self.form.formRow(withTag: "useSubFolder")!
+            var useSubFolder : Bool = false
+            
+            if (useFolderPhotoRow.value! as AnyObject).boolValue == true {
+                
+                self.serverUrl = NCManageDatabase.sharedInstance.getAccountAutoUploadPath(urlBase: self.appDelegate.urlBase, account: self.appDelegate.account)
+                useSubFolder = (useSubFolderRow.value! as AnyObject).boolValue
+            }
+            
+            self.appDelegate.activeMain.uploadFileAsset(self.assets, serverUrl: self.serverUrl, useSubFolder: useSubFolder, session: self.session)
+        })
+    }
+    
+    /*
     @objc func save() {
         
         self.dismiss(animated: true, completion: {
@@ -440,8 +459,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate {
             }
         })
     }
-    
-    
+    */
     
     @objc func cancel() {
         

+ 1 - 1
iOSClient/Main/NCMainCommon.swift

@@ -470,7 +470,7 @@ class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentI
             if metadata.account != appDelegate.account {
                 let tableAccount = NCManageDatabase.sharedInstance.getAccount(predicate: NSPredicate(format: "account == %@", metadata.account))
                 if tableAccount != nil {
-                    let fileNamePath = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(tableAccount!.user, urlBase: tableAccount!.urlBase) + "-" + tableAccount!.user + ".png"
+                    let fileNamePath = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.user, urlBase: appDelegate.urlBase) + "-" + appDelegate.user + ".png"
                     var avatar = UIImage.init(contentsOfFile: fileNamePath)
                     if avatar != nil {
                         let avatarImageView = CCAvatar.init(image: avatar, borderColor: UIColor.black, borderWidth: 0.5)

+ 2 - 1
iOSClient/Networking/NCService.swift

@@ -66,6 +66,7 @@ class NCService: NSObject {
                 
                 let user = tableAccount.user
                 let url = tableAccount.urlBase
+                let stringUser = CCUtility.getStringUser(user, urlBase: url)!
                 
                 self.appDelegate.settingAccount(tableAccount.account, urlBase: tableAccount.urlBase, user: tableAccount.user, userID: tableAccount.userID, password: CCUtility.getPassword(tableAccount.account))
                        
@@ -96,7 +97,7 @@ class NCService: NSObject {
                 }
                                         
                 let avatarUrl = "\(self.appDelegate.urlBase!)/index.php/avatar/\(self.appDelegate.user!)/\(k_avatar_size)".addingPercentEncoding(withAllowedCharacters: .urlFragmentAllowed)!
-                let fileNamePath = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(user, urlBase: url) + "-" + self.appDelegate.user + ".png"
+                let fileNamePath = CCUtility.getDirectoryUserData() + "/" + stringUser + "-" + self.appDelegate.user + ".png"
                         
                 NCCommunication.shared.downloadContent(serverUrl: avatarUrl) { (account, data, errorCode, errorMessage) in
                     if errorCode == 0 {

+ 1 - 1
iOSClient/Viewer/NCViewerVideo.swift

@@ -104,7 +104,7 @@ class NCViewerVideo: NSObject {
                 }
                 
                 CCUtility.copyFile(atPath: url.path, toPath: CCUtility.getDirectoryProviderStorageOcId(self.metadata.ocId, fileNameView: self.metadata.fileNameView))
-                _ = NCManageDatabase.sharedInstance.addLocalFile(metadata: self.metadata)
+                NCManageDatabase.sharedInstance.addLocalFile(metadata: self.metadata)
                 KTVHTTPCache.cacheDelete(with: self.videoURL)
                 
                 NotificationCenter.default.postOnMainThread(name: k_notificationCenter_reloadDataSource, userInfo: ["ocId":self.metadata.ocId, "serverUrl":self.metadata.serverUrl])