diff --git a/tests/api-test-2.c b/tests/api-test-2.c index c7e930ca..2de2a8a0 100644 --- a/tests/api-test-2.c +++ b/tests/api-test-2.c @@ -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(); } diff --git a/tests/api_test.h b/tests/api_test.h index 51843eab..3088309f 100644 --- a/tests/api_test.h +++ b/tests/api_test.h @@ -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); diff --git a/tests/test_utils.c b/tests/test_utils.c index 599fe556..e09a24f7 100644 --- a/tests/test_utils.c +++ b/tests/test_utils.c @@ -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