aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/support_luks2.patch
diff options
context:
space:
mode:
authorMx Kookie <kookie@spacekookie.de>2020-12-09 18:55:19 +0000
committerMx Kookie <kookie@spacekookie.de>2020-12-09 18:55:19 +0000
commit80d90d9b204f7c17912740f9f414fe5d59f293ba (patch)
tree5f2065a06e724270610760d59d01c6888b375a46 /infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/support_luks2.patch
parent3a31a84c7d3e589035ad08499206aac44a81f424 (diff)
parent83cbad92d73216bb0d9187c56cce0b91f9121d5a (diff)
Merge commit '83cbad92d73216bb0d9187c56cce0b91f9121d5a' into main
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/support_luks2.patch')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/support_luks2.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/support_luks2.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/support_luks2.patch
new file mode 100644
index 000000000000..0b8557f1bae0
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/pam_mount/support_luks2.patch
@@ -0,0 +1,47 @@
+commit d4434c05e7c0cf05d87089404cfa2deedc60811a
+Author: Ingo Franzki <ifranzki@linux.ibm.com>
+Date: Mon Oct 29 16:47:40 2018 +0100
+
+ crypto: Add support for LUKS2
+
+ Cryptsetup version 2.0 added support for LUKS2.
+ This patch adds support for mounting LUKS2 volumes with
+ pam_mount.
+
+ Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
+
+diff --git a/src/crypto-dmc.c b/src/crypto-dmc.c
+index d0ab6ca..abd0358 100644
+--- a/src/crypto-dmc.c
++++ b/src/crypto-dmc.c
+@@ -21,6 +21,12 @@
+ #include "libcryptmount.h"
+ #include "pam_mount.h"
+
++#ifndef CRYPT_LUKS
++ #define CRYPT_LUKS NULL /* Passing NULL to crypt_load will
++ default to LUKS(1) on older
++ libcryptsetup versions. */
++#endif
++
+ /**
+ * dmc_is_luks - check if @path points to a LUKS volume (cf. normal dm-crypt)
+ * @path: path to the crypto container
+@@ -48,7 +54,7 @@ EXPORT_SYMBOL int ehd_is_luks(const char *path, bool blkdev)
+
+ ret = crypt_init(&cd, device);
+ if (ret == 0) {
+- ret = crypt_load(cd, CRYPT_LUKS1, NULL);
++ ret = crypt_load(cd, CRYPT_LUKS, NULL);
+ if (ret == -EINVAL)
+ ret = false;
+ else if (ret == 0)
+@@ -106,7 +112,7 @@ static bool dmc_run(const struct ehd_mount_request *req,
+ #endif
+ }
+
+- ret = crypt_load(cd, CRYPT_LUKS1, NULL);
++ ret = crypt_load(cd, CRYPT_LUKS, NULL);
+ if (ret == 0) {
+ ret = crypt_activate_by_passphrase(cd, mt->crypto_name,
+ CRYPT_ANY_SLOT, req->key_data, req->key_size, flags);