Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion src/plugins/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,7 @@ gboolean _crypto_luks_format (const gchar *device,
gchar *msg = NULL;
const gchar* crypt_version = NULL;
GError *l_error = NULL;
struct crypt_pbkdf_type *pbkdf = NULL;

#ifdef LIBCRYPTSETUP_27
struct crypt_params_hw_opal opal_params = {
Expand Down Expand Up @@ -1068,7 +1069,7 @@ gboolean _crypto_luks_format (const gchar *device,
if (extra) {
if (luks_version == BD_CRYPTO_LUKS_VERSION_LUKS1) {

if (extra->integrity || extra->sector_size || extra->label || extra->subsystem || extra->pbkdf) {
if (extra->integrity || extra->sector_size || extra->label || extra->subsystem) {
g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_PARAMS,
"Invalid extra arguments specified. Only `data_alignment`"
"and `data_device` are valid for LUKS 1.");
Expand All @@ -1079,11 +1080,35 @@ gboolean _crypto_luks_format (const gchar *device,
return FALSE;
}

if (extra->pbkdf) {
if (g_strcmp0 (extra->pbkdf->type, "pbkdf2") != 0) {
g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_INVALID_PARAMS,
"Invalid pbkdf specified. Only `pbkdf2` is valid for LUKS 1.");
crypt_free (cd);
g_strfreev (cipher_specs);
bd_utils_report_finished (progress_id, l_error->message);
g_propagate_error (error, l_error);
return FALSE;
}

pbkdf = get_pbkdf_params (extra->pbkdf, &l_error);
if (pbkdf == NULL && l_error != NULL) {
crypt_free (cd);
g_strfreev (cipher_specs);
bd_utils_report_finished (progress_id, l_error->message);
g_propagate_prefixed_error (error, l_error,
"Failed to get PBKDF parameters for '%s'.", device);
return FALSE;
}
crypt_set_pbkdf_type (cd, pbkdf);
}

struct crypt_params_luks1 params = ZERO_INIT;
params.data_alignment = extra->data_alignment;
params.data_device = extra->data_device;
ret = crypt_format (cd, crypt_version, cipher_specs[0], cipher_specs[1],
NULL, NULL, key_size, &params);
g_free (pbkdf);
}
else if (luks_version == BD_CRYPTO_LUKS_VERSION_LUKS2) {
struct crypt_params_luks2 params = ZERO_INIT;
Expand Down
14 changes: 7 additions & 7 deletions tests/_lvm_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@


def _get_lvm_version():
_ret, out, _err = run_command("lvm version")
m = re.search(r"LVM version:\s+([\d\.]+)", out)
if not m or len(m.groups()) != 1:
raise RuntimeError("Failed to determine LVM version from: %s" % out)
return Version(m.groups()[0])
_ret, out, _err = run_command("lvm version")
m = re.search(r"LVM version:\s+([\d\.]+)", out)
if not m or len(m.groups()) != 1:
raise RuntimeError("Failed to determine LVM version from: %s" % out)
return Version(m.groups()[0])

LVM_VERSION = _get_lvm_version()

Expand Down Expand Up @@ -1243,7 +1243,7 @@ def test_cache_get_pool_name(self):
self.assertEqual(BlockDev.lvm_cache_pool_name("testVG", "testLV"), cpool_name)

@tag_test(TestTags.SLOW)
def test_create_cached_lv(self):
def test_create_writecached_lv(self):
"""Verify that it is possible to create a cached LV in a single step"""

if LVM_VERSION < Version("2.03.10") and self.test_type == "dbus":
Expand Down Expand Up @@ -1299,7 +1299,7 @@ def test_cache_get_stats(self):
self.assertEqual(stats.mode, BlockDev.LVMCacheMode.WRITETHROUGH)

@tag_test(TestTags.SLOW)
def test_cache_get_stats(self):
def test_thinpool_cache_get_stats(self):
"""Verify that it is possible to get stats for a cached thinpool"""

succ = BlockDev.lvm_pvcreate(self.loop_dev, 0, 0, None)
Expand Down
2 changes: 1 addition & 1 deletion tests/btrfs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def setUpClass(cls):
class BtrfsPluginVersionCase(BtrfsTest):
@tag_test(TestTags.NOSTORAGE)
def test_plugin_version(self):
self.assertEqual(BlockDev.get_plugin_soname(BlockDev.Plugin.BTRFS), "libbd_btrfs.so.3")
self.assertEqual(BlockDev.get_plugin_soname(BlockDev.Plugin.BTRFS), "libbd_btrfs.so.3")

class BtrfsTestCase(BtrfsTest):

Expand Down
Loading