This commit is contained in:
TriForceX
2019-09-25 20:51:37 -03:00
commit 6203ff3e7c
11215 changed files with 428258 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
fix musl build
Patch inspired by
https://github.com/kraj/meta-musl/blob/master/recipes-core/util-linux/util-linux-2.25/0001-switch_root-use-typeof-instead-of-__SWORD_TYPE-for-s.patch
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
diff -uNr ecryptfs-utils-109.org/src/utils/mount.ecryptfs_private.c ecryptfs-utils-109/src/utils/mount.ecryptfs_private.c
--- ecryptfs-utils-109.org/src/utils/mount.ecryptfs_private.c 2016-01-22 17:04:52.000000000 +0100
+++ ecryptfs-utils-109/src/utils/mount.ecryptfs_private.c 2016-01-24 16:52:37.000000000 +0100
@@ -224,6 +224,7 @@
static int check_cwd_f_type()
{
+ struct statfs buf;
/**
* This is *not* a list of compatible lower filesystems list for
* eCryptfs. This is a list of filesystems that we reasonably expect to
@@ -235,7 +236,7 @@
* deceive other programs with a crafted /proc/self/*. See
* https://launchpad.net/bugs/1530566 for more details.
*/
- __SWORD_TYPE f_type_whitelist[] = {
+ typeof(buf.f_type) f_type_whitelist[] = {
0x61756673 /* AUFS_SUPER_MAGIC */,
0x9123683E /* BTRFS_SUPER_MAGIC */,
0x00C36400 /* CEPH_SUPER_MAGIC */,
@@ -259,7 +260,6 @@
0x58465342 /* XFS_SB_MAGIC */,
0x2FC12FC1 /* ZFS_SUPER_MAGIC */,
};
- struct statfs buf;
size_t i, whitelist_len;
if (statfs(".", &buf) != 0) {

View File

@@ -0,0 +1,173 @@
Fix build with OpenSSL 1.1.x
Downloaded from upstream commit
https://code.launchpad.net/~jelle-vdwaa/ecryptfs/ecryptfs/+merge/319746
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
=== modified file 'src/key_mod/ecryptfs_key_mod_openssl.c'
--- a/src/key_mod/ecryptfs_key_mod_openssl.c 2013-10-25 19:45:09 +0000
+++ b/src/key_mod/ecryptfs_key_mod_openssl.c 2017-06-02 18:27:28 +0000
@@ -41,6 +41,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <libgen.h>
+#include <openssl/bn.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include <openssl/err.h>
@@ -55,6 +56,19 @@
char *passphrase;
};
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+static void RSA_get0_key(const RSA *r,
+ const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
+{
+ if (n != NULL)
+ *n = r->n;
+ if (e != NULL)
+ *e = r->e;
+ if (d != NULL)
+ *d = r->d;
+}
+#endif
+
static void
ecryptfs_openssl_destroy_openssl_data(struct openssl_data *openssl_data)
{
@@ -142,6 +156,7 @@
{
int len, nbits, ebits, i;
int nbytes, ebytes;
+ const BIGNUM *key_n, *key_e;
unsigned char *hash;
unsigned char *data = NULL;
int rc = 0;
@@ -152,11 +167,13 @@
rc = -ENOMEM;
goto out;
}
- nbits = BN_num_bits(key->n);
+ RSA_get0_key(key, &key_n, NULL, NULL);
+ nbits = BN_num_bits(key_n);
nbytes = nbits / 8;
if (nbits % 8)
nbytes++;
- ebits = BN_num_bits(key->e);
+ RSA_get0_key(key, NULL, &key_e, NULL);
+ ebits = BN_num_bits(key_e);
ebytes = ebits / 8;
if (ebits % 8)
ebytes++;
@@ -179,11 +196,13 @@
data[i++] = '\02';
data[i++] = (nbits >> 8);
data[i++] = nbits;
- BN_bn2bin(key->n, &(data[i]));
+ RSA_get0_key(key, &key_n, NULL, NULL);
+ BN_bn2bin(key_n, &(data[i]));
i += nbytes;
data[i++] = (ebits >> 8);
data[i++] = ebits;
- BN_bn2bin(key->e, &(data[i]));
+ RSA_get0_key(key, NULL, &key_e, NULL);
+ BN_bn2bin(key_e, &(data[i]));
i += ebytes;
SHA1(data, len + 3, hash);
to_hex(sig, (char *)hash, ECRYPTFS_SIG_SIZE);
@@ -278,7 +297,9 @@
BIO *in = NULL;
int rc;
+ #if OPENSSL_VERSION_NUMBER < 0x10100000L
CRYPTO_malloc_init();
+ #endif
ERR_load_crypto_strings();
OpenSSL_add_all_algorithms();
ENGINE_load_builtin_engines();
=== modified file 'src/key_mod/ecryptfs_key_mod_pkcs11_helper.c'
--- a/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c 2013-10-25 19:45:09 +0000
+++ b/src/key_mod/ecryptfs_key_mod_pkcs11_helper.c 2017-06-02 18:27:28 +0000
@@ -41,6 +41,7 @@
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
+#include <openssl/bn.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/x509.h>
@@ -77,6 +78,19 @@
typedef const unsigned char *__pkcs11_openssl_d2i_t;
#endif
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+static void RSA_get0_key(const RSA *r,
+ const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
+{
+ if (n != NULL)
+ *n = r->n;
+ if (e != NULL)
+ *e = r->e;
+ if (d != NULL)
+ *d = r->d;
+}
+#endif
+
/**
* ecryptfs_pkcs11h_deserialize
* @pkcs11h_data: The deserialized version of the key module data;
@@ -282,7 +296,11 @@
goto out;
}
+ #if OPENSSL_VERSION_NUMBER < 0x10100000L
if (pubkey->type != EVP_PKEY_RSA) {
+ #else
+ if (EVP_PKEY_base_id(pubkey) != EVP_PKEY_RSA) {
+ #endif
syslog(LOG_ERR, "PKCS#11: Invalid public key algorithm");
rc = -EIO;
goto out;
@@ -318,6 +336,7 @@
int nbytes, ebytes;
char *hash = NULL;
char *data = NULL;
+ const BIGNUM *rsa_n, *rsa_e;
int rc;
if ((rc = ecryptfs_pkcs11h_get_public_key(&rsa, blob))) {
@@ -331,11 +350,13 @@
rc = -ENOMEM;
goto out;
}
- nbits = BN_num_bits(rsa->n);
+ RSA_get0_key(rsa, &rsa_n, NULL, NULL);
+ nbits = BN_num_bits(rsa_n);
nbytes = nbits / 8;
if (nbits % 8)
nbytes++;
- ebits = BN_num_bits(rsa->e);
+ RSA_get0_key(rsa, NULL, &rsa_e, NULL);
+ ebits = BN_num_bits(rsa_e);
ebytes = ebits / 8;
if (ebits % 8)
ebytes++;
@@ -358,11 +379,13 @@
data[i++] = '\02';
data[i++] = (char)(nbits >> 8);
data[i++] = (char)nbits;
- BN_bn2bin(rsa->n, &(data[i]));
+ RSA_get0_key(rsa, &rsa_n, NULL, NULL);
+ BN_bn2bin(rsa_n, &(data[i]));
i += nbytes;
data[i++] = (char)(ebits >> 8);
data[i++] = (char)ebits;
- BN_bn2bin(rsa->e, &(data[i]));
+ RSA_get0_key(rsa, NULL, &rsa_e, NULL);
+ BN_bn2bin(rsa_e, &(data[i]));
i += ebytes;
SHA1(data, len + 3, hash);
to_hex(sig, hash, ECRYPTFS_SIG_SIZE);

View File

@@ -0,0 +1,35 @@
config BR2_PACKAGE_ECRYPTFS_UTILS
bool "ecryptfs-utils"
depends on BR2_USE_WCHAR # gettext
depends on BR2_USE_MMU # keyutils
depends on BR2_TOOLCHAIN_HAS_THREADS # libnss -> libnspr
depends on BR2_PACKAGE_LIBNSPR_ARCH_SUPPORT # libnss -> libnspr
depends on !BR2_MIPS_NABI32 # libnss
depends on !BR2_STATIC_LIBS # libnss, keyutils
select BR2_PACKAGE_KEYUTILS
select BR2_PACKAGE_LIBNSS
# runtime dependency only, some scripts are using the
# 'gettext' program to get translations
select BR2_PACKAGE_GETTEXT
# runtime dependency only
select BR2_PACKAGE_GETENT
help
eCryptfs is a POSIX-compliant enterprise cryptographic
filesystem for Linux. It is stacked on top of any other
Linux filesystem, it stores cryptographic metadata in the
header of each file written.
The eCryptfs kernel module is available in all Linux kernels
since version 2.6.19. This package provides userspace
utilities needed to mount eCryptfs.
Files are encrypted using a passphrase. Consider building
openssl for another method.
http://ecryptfs.org
comment "ecryptfs-utils needs a toolchain w/ threads, wchar, dynami library"
depends on BR2_PACKAGE_LIBNSPR_ARCH_SUPPORT
depends on BR2_USE_MMU
depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR || \
BR2_STATIC_LIBS

View File

@@ -0,0 +1,4 @@
# From https://launchpad.net/ecryptfs/trunk/111/+download/ecryptfs-utils_111.orig.tar.gz/+md5
md5 83513228984f671930752c3518cac6fd ecryptfs-utils_111.orig.tar.gz
# Locally computed
sha256 112cb3e37e81a1ecd8e39516725dec0ce55c5f3df6284e0f4cc0f118750a987f ecryptfs-utils_111.orig.tar.gz

View File

@@ -0,0 +1,28 @@
################################################################################
#
# ecryptfs-utils
#
################################################################################
ECRYPTFS_UTILS_VERSION = 111
ECRYPTFS_UTILS_SOURCE = ecryptfs-utils_$(ECRYPTFS_UTILS_VERSION).orig.tar.gz
ECRYPTFS_UTILS_SITE = https://launchpad.net/ecryptfs/trunk/$(ECRYPTFS_UTILS_VERSION)/+download
ECRYPTFS_UTILS_LICENSE = GPL-2.0+
ECRYPTFS_UTILS_LICENSE_FILES = COPYING
ECRYPTFS_UTILS_DEPENDENCIES = keyutils libnss host-intltool
ECRYPTFS_UTILS_CONF_OPTS = --disable-pywrap --disable-pam
#Needed for build system to find pk11func.h and libnss3.so
ECRYPTFS_UTILS_CONF_ENV = \
NSS_CFLAGS="-I$(STAGING_DIR)/usr/include/nss -I$(STAGING_DIR)/usr/include/nspr" \
NSS_LIBS="-lnss3"
ifeq ($(BR2_PACKAGE_OPENSSL),y)
ECRYPTFS_UTILS_CONF_OPTS += --enable-openssl
ECRYPTFS_UTILS_DEPENDENCIES += openssl
else
ECRYPTFS_UTILS_CONF_OPTS += --disable-openssl
endif
$(eval $(autotools-package))