Skip to content

Commit

Permalink
Use cryptsetup2-2.2.2 and make cryptsetup1/cryptsetup2 optionals
Browse files Browse the repository at this point in the history
  • Loading branch information
root-hardenedvault authored and tlaurion committed Jan 17, 2021
1 parent e2eabb0 commit ce94c05
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 20 deletions.
18 changes: 8 additions & 10 deletions modules/cryptsetup
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
modules-$(CONFIG_CRYPTSETUP) += cryptsetup

cryptsetup_depends := util-linux popt lvm2 json-c $(musl_dep)
cryptsetup_depends := util-linux popt lvm2 $(musl_dep)

cryptsetup_version := 2.3.3
cryptsetup_version := 1.7.3
cryptsetup_dir := cryptsetup-$(cryptsetup_version)
cryptsetup_tar := cryptsetup-$(cryptsetup_version).tar.xz
cryptsetup_url := https://www.kernel.org/pub/linux/utils/cryptsetup/v2.3/cryptsetup-$(cryptsetup_version).tar.xz
cryptsetup_hash := 3bca4ffe39e2f94cef50f6ea65acb873a6dbce5db34fc6bcefe38b6d095e82df
cryptsetup_url := https://www.kernel.org/pub/linux/utils/cryptsetup/v1.7/cryptsetup-$(cryptsetup_version).tar.xz
cryptsetup_hash := af2b04e8475cf40b8d9ffd97a1acfa73aa787c890430afd89804fb544d6adc02

# Use an empty prefix so that the executables will not include the
# build path.
cryptsetup_configure := ./configure \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--prefix "/" \
--disable-rpath \
--disable-gcrypt-pbkdf2 \
--enable-cryptsetup-reencrypt \
--with-crypto_backend=kernel \
--with-tmpfilesdir=$(INSTALL)/lib/tmpfiles.d

# but after building, replace prefix so that they will be installed
# in the correct directory.
Expand All @@ -30,10 +28,10 @@ cryptsetup_target := \
install

cryptsetup_output := \
.libs/cryptsetup \
.libs/cryptsetup-reencrypt \
.libs/veritysetup \
src/.libs/cryptsetup \
src/.libs/cryptsetup-reencrypt \
src/.libs/veritysetup \

cryptsetup_libraries := \
.libs/libcryptsetup.so.12 \
lib/.libs/libcryptsetup.so.4 \

39 changes: 39 additions & 0 deletions modules/cryptsetup2
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
modules-$(CONFIG_CRYPTSETUP2) += cryptsetup2

cryptsetup2_depends := util-linux popt lvm2 json-c $(musl_dep)

cryptsetup2_version := 2.2.2
cryptsetup2_dir := cryptsetup-$(cryptsetup2_version)
cryptsetup2_tar := cryptsetup-$(cryptsetup2_version).tar.xz
cryptsetup2_url := https://www.kernel.org/pub/linux/utils/cryptsetup/v2.2/cryptsetup-$(cryptsetup2_version).tar.xz
cryptsetup2_hash := 2af0ec9551ab9c870074cae9d3f68d82cab004f4095fa89db0e4413713424a46

# Use an empty prefix so that the executables will not include the
# build path.
cryptsetup2_configure := ./configure \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--prefix "/" \
--disable-rpath \
--disable-gcrypt-pbkdf2 \
--enable-cryptsetup-reencrypt \
--with-crypto_backend=kernel \
--with-tmpfilesdir=$(INSTALL)/lib/tmpfiles.d

# but after building, replace prefix so that they will be installed
# in the correct directory.
cryptsetup2_target := \
$(MAKE_JOBS) \
&& $(MAKE) \
-C $(build)/$(cryptsetup2_dir) \
prefix="$(INSTALL)" \
install

cryptsetup2_output := \
.libs/cryptsetup \
.libs/cryptsetup-reencrypt \
.libs/veritysetup \

cryptsetup2_libraries := \
.libs/libcryptsetup.so.12 \

2 changes: 1 addition & 1 deletion modules/json-c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
modules-$(CONFIG_CRYPTSETUP) += json-c
modules-$(CONFIG_CRYPTSETUP2) += json-c

json-c_version := 0.14
json-c_dir := json-c-$(json-c_version)
Expand Down
21 changes: 21 additions & 0 deletions patches/cryptsetup-1.7.3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff -u --recursive ../../clean/cryptsetup-1.7.3/src/Makefile.in ./cryptsetup-1.7.3/src/Makefile.in
--- ../../clean/cryptsetup-1.7.3/src/Makefile.in 2016-10-28 09:45:06.000000000 -0400
+++ cryptsetup-1.7.3/src/Makefile.in 2017-01-27 17:24:13.115962328 -0500
@@ -479,6 +479,8 @@
cryptsetup_LDADD = \
$(top_builddir)/lib/libcryptsetup.la \
@POPT_LIBS@ \
+ @UUID_LIBS@ \
+ @DEVMAPPER_LIBS@ \
@PWQUALITY_LIBS@ \
@PASSWDQC_LIBS@

@@ -503,6 +505,8 @@

@VERITYSETUP_TRUE@veritysetup_LDADD = \
@VERITYSETUP_TRUE@ $(top_builddir)/lib/libcryptsetup.la \
+@VERITYSETUP_TRUE@ @UUID_LIBS@ \
+@VERITYSETUP_TRUE@ @DEVMAPPER_LIBS@ \
@VERITYSETUP_TRUE@ @POPT_LIBS@

@VERITYSETUP_TRUE@veritysetup_CFLAGS = $(cryptsetup_CFLAGS)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff -u -r cryptsetup-2.3.3-clean/configure cryptsetup-2.3.3/configure
--- cryptsetup-2.3.3-clean/configure 2020-06-10 14:05:45.784925972 +0200
+++ cryptsetup-2.3.3/configure 2020-06-10 14:12:03.811651237 +0200
diff -u -r cryptsetup-2.2.2-clean/configure cryptsetup-2.2.2/configure
--- cryptsetup-2.2.2-clean/configure 2020-06-10 14:05:45.784925972 +0200
+++ cryptsetup-2.2.2/configure 2020-06-10 14:12:03.811651237 +0200
@@ -10206,7 +10206,7 @@
hardcode_automatic=no
hardcode_direct=no
Expand Down Expand Up @@ -504,9 +504,9 @@ diff -u -r cryptsetup-2.3.3-clean/configure cryptsetup-2.3.3/configure

# Whether we need a single "-rpath" flag with a separated argument.
hardcode_libdir_separator=$lt_hardcode_libdir_separator
diff -u -r cryptsetup-2.3.3-clean/Makefile.in cryptsetup-2.3.3/Makefile.in
--- cryptsetup-2.3.3-clean/Makefile.in 2020-06-10 14:05:45.781594282 +0200
+++ cryptsetup-2.3.3/Makefile.in 2020-06-10 14:30:09.512375745 +0200
diff -u -r cryptsetup-2.2.2-clean/Makefile.in cryptsetup-2.2.2/Makefile.in
--- cryptsetup-2.2.2-clean/Makefile.in 2020-06-10 14:05:45.781594282 +0200
+++ cryptsetup-2.2.2/Makefile.in 2020-06-10 14:30:09.512375745 +0200
@@ -1032,6 +1032,8 @@
@CRYPTSETUP_TRUE@cryptsetup_LDADD = $(LDADD) \
@CRYPTSETUP_TRUE@ libcryptsetup.la \
Expand All @@ -516,15 +516,13 @@ diff -u -r cryptsetup-2.3.3-clean/Makefile.in cryptsetup-2.3.3/Makefile.in
@CRYPTSETUP_TRUE@ @PWQUALITY_LIBS@ \
@CRYPTSETUP_TRUE@ @PASSWDQC_LIBS@ \
@CRYPTSETUP_TRUE@ @UUID_LIBS@ \
@@ -1060,6 +1062,9 @@
@@ -1060,4 +1062,7 @@
@VERITYSETUP_TRUE@veritysetup_LDADD = $(LDADD) \
@VERITYSETUP_TRUE@ libcryptsetup.la \
@VERITYSETUP_TRUE@ @POPT_LIBS@ \
+@VERITYSETUP_TRUE@ @UUID_LIBS@ \
+@VERITYSETUP_TRUE@ @DEVMAPPER_LIBS@ \
+@VERITYSETUP_TRUE@ @JSON_C_LIBS@ \
@VERITYSETUP_TRUE@ @PWQUALITY_LIBS@ \
@VERITYSETUP_TRUE@ @PASSWDQC_LIBS@ \
@VERITYSETUP_TRUE@ @BLKID_LIBS@
@@ -1093,6 +1093,8 @@
@INTEGRITYSETUP_TRUE@ libcryptsetup.la \
Expand Down
30 changes: 30 additions & 0 deletions patches/cryptsetup2-2.2.2/0000-use-json-c-get-uint64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff -u -r cryptsetup-2.2.2-clean/lib/luks2/luks2_internal.h cryptsetup-2.2.2/lib/luks2/luks2_internal.h
--- cryptsetup-2.2.2-clean/lib/luks2/luks2_internal.h 1970-01-01 00:00:00.0 +0000
+++ cryptsetup-2.2.2/lib/luks2/luks2_internal.h 1970-01-01 00:00:00.0 +0000
@@ -59,7 +59,8 @@
void hexprint_base64(struct crypt_device *cd, json_object *jobj,
const char *sep, const char *line_sep);

-uint64_t json_object_get_uint64(json_object *jobj);
+#define FALSE 0
+#define TRUE 1
uint32_t json_object_get_uint32(json_object *jobj);
json_object *json_object_new_uint64(uint64_t value);

diff -u -r cryptsetup-2.2.2-clean/lib/luks2/luks2_json_metadata.c cryptsetup-2.2.2/lib/luks2/luks2_json_metadata.c
--- cryptsetup-2.2.2-clean/lib/luks2/luks2_json_metadata.c 1970-01-01 00:00:00.0 +0000
+++ cryptsetup-2.2.2/lib/luks2/luks2_json_metadata.c 1970-01-01 00:00:00.0 +0000
@@ -241,13 +241,6 @@
return TRUE;
}

-uint64_t json_object_get_uint64(json_object *jobj)
-{
- uint64_t r;
- json_str_to_uint64(jobj, &r);
- return r;
-}
-
json_object *json_object_new_uint64(uint64_t value)
{
/* 18446744073709551615 */

0 comments on commit ce94c05

Please sign in to comment.