mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-15 12:50:06 +01:00
Rename crypt_get/set reenc_context to luks2_reencrypt.
This commit is contained in:
@@ -222,8 +222,8 @@ int PLAIN_activate(struct crypt_device *cd,
|
|||||||
uint32_t flags);
|
uint32_t flags);
|
||||||
|
|
||||||
void *crypt_get_hdr(struct crypt_device *cd, const char *type);
|
void *crypt_get_hdr(struct crypt_device *cd, const char *type);
|
||||||
void crypt_set_reenc_context(struct crypt_device *cd, struct luks2_reenc_context *rh);
|
void crypt_set_luks2_reencrypt(struct crypt_device *cd, struct luks2_reenc_context *rh);
|
||||||
struct luks2_reenc_context *crypt_get_reenc_context(struct crypt_device *cd);
|
struct luks2_reenc_context *crypt_get_luks2_reencrypt(struct crypt_device *cd);
|
||||||
|
|
||||||
int onlyLUKS2(struct crypt_device *cd);
|
int onlyLUKS2(struct crypt_device *cd);
|
||||||
int onlyLUKS2mask(struct crypt_device *cd, uint32_t mask);
|
int onlyLUKS2mask(struct crypt_device *cd, uint32_t mask);
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ int LUKS2_device_write_lock(struct crypt_device *cd, struct luks2_hdr *hdr, stru
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* run sequence id check only on first write lock (r == 1) and w/o LUKS2 reencryption in-progress */
|
/* run sequence id check only on first write lock (r == 1) and w/o LUKS2 reencryption in-progress */
|
||||||
if (r == 1 && !crypt_get_reenc_context(cd)) {
|
if (r == 1 && !crypt_get_luks2_reencrypt(cd)) {
|
||||||
log_dbg(cd, "Checking context sequence id matches value stored on disk.");
|
log_dbg(cd, "Checking context sequence id matches value stored on disk.");
|
||||||
if (LUKS2_check_sequence_id(cd, hdr, device)) {
|
if (LUKS2_check_sequence_id(cd, hdr, device)) {
|
||||||
device_write_unlock(cd, device);
|
device_write_unlock(cd, device);
|
||||||
|
|||||||
@@ -2786,10 +2786,10 @@ static int reencrypt_load_by_passphrase(struct crypt_device *cd,
|
|||||||
|
|
||||||
log_dbg(cd, "Loading LUKS2 reencryption context.");
|
log_dbg(cd, "Loading LUKS2 reencryption context.");
|
||||||
|
|
||||||
rh = crypt_get_reenc_context(cd);
|
rh = crypt_get_luks2_reencrypt(cd);
|
||||||
if (rh) {
|
if (rh) {
|
||||||
LUKS2_reencrypt_free(cd, rh);
|
LUKS2_reencrypt_free(cd, rh);
|
||||||
crypt_set_reenc_context(cd, NULL);
|
crypt_set_luks2_reencrypt(cd, NULL);
|
||||||
rh = NULL;
|
rh = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2914,7 +2914,7 @@ static int reencrypt_load_by_passphrase(struct crypt_device *cd,
|
|||||||
MOVE_REF(rh->vks, *vks);
|
MOVE_REF(rh->vks, *vks);
|
||||||
MOVE_REF(rh->reenc_lock, reencrypt_lock);
|
MOVE_REF(rh->reenc_lock, reencrypt_lock);
|
||||||
|
|
||||||
crypt_set_reenc_context(cd, rh);
|
crypt_set_luks2_reencrypt(cd, rh);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
err:
|
||||||
@@ -3321,7 +3321,7 @@ static int reencrypt_teardown(struct crypt_device *cd, struct luks2_hdr *hdr,
|
|||||||
|
|
||||||
/* this frees reencryption lock */
|
/* this frees reencryption lock */
|
||||||
LUKS2_reencrypt_free(cd, rh);
|
LUKS2_reencrypt_free(cd, rh);
|
||||||
crypt_set_reenc_context(cd, NULL);
|
crypt_set_luks2_reencrypt(cd, NULL);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -3347,7 +3347,7 @@ int crypt_reencrypt(struct crypt_device *cd,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
rh = crypt_get_reenc_context(cd);
|
rh = crypt_get_luks2_reencrypt(cd);
|
||||||
if (!rh || (!rh->reenc_lock && crypt_metadata_locking_enabled())) {
|
if (!rh || (!rh->reenc_lock && crypt_metadata_locking_enabled())) {
|
||||||
log_err(cd, _("Missing or invalid reencrypt context."));
|
log_err(cd, _("Missing or invalid reencrypt context."));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
@@ -662,7 +662,7 @@ int crypt_set_data_device(struct crypt_device *cd, const char *device)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLUKS2(cd->type) && crypt_get_reenc_context(cd)) {
|
if (isLUKS2(cd->type) && crypt_get_luks2_reencrypt(cd)) {
|
||||||
log_err(cd, _("Illegal operation with reencryption in-progress."));
|
log_err(cd, _("Illegal operation with reencryption in-progress."));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -5510,13 +5510,13 @@ void *crypt_get_hdr(struct crypt_device *cd, const char *type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* internal only */
|
/* internal only */
|
||||||
struct luks2_reenc_context *crypt_get_reenc_context(struct crypt_device *cd)
|
struct luks2_reenc_context *crypt_get_luks2_reencrypt(struct crypt_device *cd)
|
||||||
{
|
{
|
||||||
return cd->u.luks2.rh;
|
return cd->u.luks2.rh;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* internal only */
|
/* internal only */
|
||||||
void crypt_set_reenc_context(struct crypt_device *cd, struct luks2_reenc_context *rh)
|
void crypt_set_luks2_reencrypt(struct crypt_device *cd, struct luks2_reenc_context *rh)
|
||||||
{
|
{
|
||||||
cd->u.luks2.rh = rh;
|
cd->u.luks2.rh = rh;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user