Fix api test on kernels with capi format support.

This commit is contained in:
Ondrej Kozina
2023-01-19 11:50:48 +01:00
parent 48d6f85cc3
commit 4cd8d1efdb
3 changed files with 17 additions and 9 deletions

View File

@@ -1727,15 +1727,17 @@ static void ResizeDeviceLuks2(void)
OK_(crypt_deactivate(cd, CDEVICE_1));
CRYPT_FREE(cd);
OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
OK_(crypt_set_pbkdf_type(cd, &min_pbkdf2));
OK_(crypt_format(cd, CRYPT_LUKS2, capi_cipher, capi_cipher_mode, NULL, key, key_size, NULL));
OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
OK_(crypt_resize(cd, CDEVICE_1, 8));
if (!t_device_size(DMDIR CDEVICE_1, &r_size))
EQ_(8, r_size >> TST_SECTOR_SHIFT);
OK_(crypt_deactivate(cd, CDEVICE_1));
CRYPT_FREE(cd);
if (t_dm_capi_string_supported()) {
OK_(crypt_init(&cd, DMDIR L_DEVICE_OK));
OK_(crypt_set_pbkdf_type(cd, &min_pbkdf2));
OK_(crypt_format(cd, CRYPT_LUKS2, capi_cipher, capi_cipher_mode, NULL, key, key_size, NULL));
OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, key, key_size, 0));
OK_(crypt_resize(cd, CDEVICE_1, 8));
if (!t_device_size(DMDIR CDEVICE_1, &r_size))
EQ_(8, r_size >> TST_SECTOR_SHIFT);
OK_(crypt_deactivate(cd, CDEVICE_1));
CRYPT_FREE(cd);
}
_cleanup_dmdevices();
}

View File

@@ -40,6 +40,7 @@ int t_dm_crypt_cpu_switch_support(void);
int t_dm_crypt_discard_support(void);
int t_dm_integrity_resize_support(void);
int t_dm_integrity_recalculate_support(void);
int t_dm_capi_string_supported(void);
int t_set_readahead(const char *device, unsigned value);
int fips_mode(void);

View File

@@ -685,6 +685,11 @@ int t_dm_integrity_recalculate_support(void)
return t_dm_crypt_flags & T_DM_INTEGRITY_RECALC_SUPPORTED;
}
int t_dm_capi_string_supported(void)
{
return t_dm_crypt_flags & T_DM_CAPI_STRING_SUPPORTED;
}
/* loop helpers */
#define LOOP_DEV_MAJOR 7