mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Fix unused parameter in LUKS2 reencryption handlers.
This commit is contained in:
@@ -162,6 +162,7 @@ static uint64_t reencrypt_get_data_offset_old(struct luks2_hdr *hdr)
|
|||||||
return reencrypt_data_offset(hdr, 0);
|
return reencrypt_data_offset(hdr, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int reencrypt_digest(struct luks2_hdr *hdr, unsigned new)
|
static int reencrypt_digest(struct luks2_hdr *hdr, unsigned new)
|
||||||
{
|
{
|
||||||
int segment = LUKS2_get_segment_id_by_flag(hdr, new ? "backup-final" : "backup-previous");
|
int segment = LUKS2_get_segment_id_by_flag(hdr, new ? "backup-final" : "backup-previous");
|
||||||
@@ -764,6 +765,7 @@ static int reencrypt_make_post_segments(struct crypt_device *cd,
|
|||||||
return rh->jobj_segs_post ? 0 : -EINVAL;
|
return rh->jobj_segs_post ? 0 : -EINVAL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint64_t reencrypt_data_shift(struct luks2_hdr *hdr)
|
static uint64_t reencrypt_data_shift(struct luks2_hdr *hdr)
|
||||||
{
|
{
|
||||||
json_object *jobj_keyslot, *jobj_area, *jobj_data_shift;
|
json_object *jobj_keyslot, *jobj_area, *jobj_data_shift;
|
||||||
@@ -878,13 +880,13 @@ void LUKS2_reencrypt_free(struct crypt_device *cd, struct luks2_reencrypt *rh)
|
|||||||
free(rh);
|
free(rh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if USE_LUKS2_REENCRYPTION
|
||||||
int LUKS2_reencrypt_max_hotzone_size(struct crypt_device *cd __attribute__((unused)),
|
int LUKS2_reencrypt_max_hotzone_size(struct crypt_device *cd __attribute__((unused)),
|
||||||
struct luks2_hdr *hdr,
|
struct luks2_hdr *hdr,
|
||||||
const struct reenc_protection *rp,
|
const struct reenc_protection *rp,
|
||||||
int reencrypt_keyslot,
|
int reencrypt_keyslot,
|
||||||
uint64_t *r_length)
|
uint64_t *r_length)
|
||||||
{
|
{
|
||||||
#if USE_LUKS2_REENCRYPTION
|
|
||||||
int r;
|
int r;
|
||||||
uint64_t dummy, area_length;
|
uint64_t dummy, area_length;
|
||||||
|
|
||||||
@@ -917,11 +919,8 @@ int LUKS2_reencrypt_max_hotzone_size(struct crypt_device *cd __attribute__((unus
|
|||||||
}
|
}
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
#else
|
|
||||||
return -ENOTSUP;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#if USE_LUKS2_REENCRYPTION
|
|
||||||
static size_t reencrypt_get_alignment(struct crypt_device *cd,
|
static size_t reencrypt_get_alignment(struct crypt_device *cd,
|
||||||
struct luks2_hdr *hdr)
|
struct luks2_hdr *hdr)
|
||||||
{
|
{
|
||||||
@@ -3303,7 +3302,17 @@ static int reencrypt_load(struct crypt_device *cd, struct luks2_hdr *hdr,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
int LUKS2_reencrypt_max_hotzone_size(struct crypt_device *cd __attribute__((unused)),
|
||||||
|
struct luks2_hdr *hdr __attribute__((unused)),
|
||||||
|
const struct reenc_protection *rp __attribute__((unused)),
|
||||||
|
int reencrypt_keyslot __attribute__((unused)),
|
||||||
|
uint64_t *r_length __attribute__((unused)))
|
||||||
|
{
|
||||||
|
return -ENOTSUP;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int reencrypt_lock_internal(struct crypt_device *cd, const char *uuid, struct crypt_lock_handle **reencrypt_lock)
|
static int reencrypt_lock_internal(struct crypt_device *cd, const char *uuid, struct crypt_lock_handle **reencrypt_lock)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
@@ -3752,7 +3761,7 @@ out:
|
|||||||
return r;
|
return r;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
static int reencrypt_init_by_passphrase(struct crypt_device *cd,
|
static int reencrypt_init_by_passphrase(struct crypt_device *cd,
|
||||||
const char *name,
|
const char *name,
|
||||||
const char *passphrase,
|
const char *passphrase,
|
||||||
@@ -3763,7 +3772,6 @@ static int reencrypt_init_by_passphrase(struct crypt_device *cd,
|
|||||||
const char *cipher_mode,
|
const char *cipher_mode,
|
||||||
const struct crypt_params_reencrypt *params)
|
const struct crypt_params_reencrypt *params)
|
||||||
{
|
{
|
||||||
#if USE_LUKS2_REENCRYPTION
|
|
||||||
int r;
|
int r;
|
||||||
crypt_reencrypt_info ri;
|
crypt_reencrypt_info ri;
|
||||||
struct volume_key *vks = NULL;
|
struct volume_key *vks = NULL;
|
||||||
@@ -3825,11 +3833,22 @@ out:
|
|||||||
crypt_drop_keyring_key(cd, vks);
|
crypt_drop_keyring_key(cd, vks);
|
||||||
crypt_free_volume_key(vks);
|
crypt_free_volume_key(vks);
|
||||||
return r < 0 ? r : LUKS2_find_keyslot(hdr, "reencrypt");
|
return r < 0 ? r : LUKS2_find_keyslot(hdr, "reencrypt");
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
|
static int reencrypt_init_by_passphrase(struct crypt_device *cd,
|
||||||
|
const char *name __attribute__((unused)),
|
||||||
|
const char *passphrase __attribute__((unused)),
|
||||||
|
size_t passphrase_size __attribute__((unused)),
|
||||||
|
int keyslot_old __attribute__((unused)),
|
||||||
|
int keyslot_new __attribute__((unused)),
|
||||||
|
const char *cipher __attribute__((unused)),
|
||||||
|
const char *cipher_mode __attribute__((unused)),
|
||||||
|
const struct crypt_params_reencrypt *params __attribute__((unused)))
|
||||||
|
{
|
||||||
log_err(cd, _("This operation is not supported for this device type."));
|
log_err(cd, _("This operation is not supported for this device type."));
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int crypt_reencrypt_init_by_keyring(struct crypt_device *cd,
|
int crypt_reencrypt_init_by_keyring(struct crypt_device *cd,
|
||||||
const char *name,
|
const char *name,
|
||||||
@@ -4169,14 +4188,12 @@ static int reencrypt_teardown(struct crypt_device *cd, struct luks2_hdr *hdr,
|
|||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int crypt_reencrypt_run(
|
int crypt_reencrypt_run(
|
||||||
struct crypt_device *cd,
|
struct crypt_device *cd,
|
||||||
int (*progress)(uint64_t size, uint64_t offset, void *usrptr),
|
int (*progress)(uint64_t size, uint64_t offset, void *usrptr),
|
||||||
void *usrptr)
|
void *usrptr)
|
||||||
{
|
{
|
||||||
#if USE_LUKS2_REENCRYPTION
|
|
||||||
int r;
|
int r;
|
||||||
crypt_reencrypt_info ri;
|
crypt_reencrypt_info ri;
|
||||||
struct luks2_hdr *hdr;
|
struct luks2_hdr *hdr;
|
||||||
@@ -4237,19 +4254,9 @@ int crypt_reencrypt_run(
|
|||||||
|
|
||||||
r = reencrypt_teardown(cd, hdr, rh, rs, quit, progress, usrptr);
|
r = reencrypt_teardown(cd, hdr, rh, rs, quit, progress, usrptr);
|
||||||
return r;
|
return r;
|
||||||
#else
|
|
||||||
log_err(cd, _("This operation is not supported for this device type."));
|
|
||||||
return -ENOTSUP;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int crypt_reencrypt(
|
|
||||||
struct crypt_device *cd,
|
|
||||||
int (*progress)(uint64_t size, uint64_t offset, void *usrptr))
|
|
||||||
{
|
|
||||||
return crypt_reencrypt_run(cd, progress, NULL);
|
|
||||||
}
|
|
||||||
#if USE_LUKS2_REENCRYPTION
|
|
||||||
static int reencrypt_recovery(struct crypt_device *cd,
|
static int reencrypt_recovery(struct crypt_device *cd,
|
||||||
struct luks2_hdr *hdr,
|
struct luks2_hdr *hdr,
|
||||||
uint64_t device_size,
|
uint64_t device_size,
|
||||||
@@ -4285,7 +4292,27 @@ out:
|
|||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
#else /* USE_LUKS2_REENCRYPTION */
|
||||||
|
int crypt_reencrypt_run(
|
||||||
|
struct crypt_device *cd,
|
||||||
|
int (*progress)(uint64_t size, uint64_t offset, void *usrptr),
|
||||||
|
void *usrptr)
|
||||||
|
{
|
||||||
|
UNUSED(progress);
|
||||||
|
UNUSED(usrptr);
|
||||||
|
|
||||||
|
log_err(cd, _("This operation is not supported for this device type."));
|
||||||
|
return -ENOTSUP;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int crypt_reencrypt(
|
||||||
|
struct crypt_device *cd,
|
||||||
|
int (*progress)(uint64_t size, uint64_t offset, void *usrptr))
|
||||||
|
{
|
||||||
|
return crypt_reencrypt_run(cd, progress, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* use only for calculation of minimal data device size.
|
* use only for calculation of minimal data device size.
|
||||||
* The real data offset is taken directly from segments!
|
* The real data offset is taken directly from segments!
|
||||||
|
|||||||
Reference in New Issue
Block a user