Use crypt_is_cipher_null check where possible.

This commit is contained in:
Ondrej Kozina
2021-02-18 14:19:09 +01:00
committed by Milan Broz
parent fb8aa6d03b
commit c8c28cf6dd
3 changed files with 3 additions and 3 deletions

View File

@@ -651,7 +651,7 @@ static char *get_dm_crypt_params(const struct dm_target *tgt, uint32_t flags)
} else
*features = '\0';
if (!strncmp(cipher_dm, "cipher_null-", 12))
if (crypt_is_cipher_null(cipher_dm))
null_cipher = 1;
if (flags & CRYPT_ACTIVATE_KEYRING_KEY) {

View File

@@ -1015,7 +1015,7 @@ static int LUKS_open_key(unsigned int keyIndex,
r = LUKS_verify_volume_key(hdr, vk);
/* Allow only empty passphrase with null cipher */
if (!r && !strcmp(hdr->cipherName, "cipher_null") && passwordLen)
if (!r && crypt_is_cipher_null(hdr->cipherName) && passwordLen)
r = -EPERM;
out:
crypt_safe_free(AfKey);

View File

@@ -199,7 +199,7 @@ int crypt_storage_wrapper_init(struct crypt_device *cd,
goto err;
}
if (!strcmp(_cipher, "cipher_null")) {
if (crypt_is_cipher_null(_cipher)) {
log_dbg(cd, "Requested cipher_null, switching to noop wrapper.");
w->type = NONE;
*cw = w;