const char *crypt_get_cipher_spec(struct crypt_device *cd)
{
	if (!cd)
		return NULL;
	else if (isLUKS2(cd->type))
		return LUKS2_get_cipher(&cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT);
	else if (isLUKS1(cd->type))
		return cd->u.luks1.cipher_spec;
	else if (isPLAIN(cd->type))
		return cd->u.plain.cipher_spec;
	else if (isLOOPAES(cd->type))
		return cd->u.loopaes.cipher_spec;
	else if (isBITLK(cd->type))
		return cd->u.bitlk.cipher_spec;
	else if (!cd->type && !_init_by_name_crypt_none(cd))
		return cd->u.none.cipher_spec;

	return NULL;
}
const char *crypt_get_cipher_spec(struct crypt_device *cd)
{
	if (!cd)
		return NULL;
	else if (isLUKS2(cd->type))
		return LUKS2_get_cipher(&cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT);
	else if (isLUKS1(cd->type))
		return cd->u.luks1.cipher_spec;
	else if (isPLAIN(cd->type))
		return cd->u.plain.cipher_spec;
	else if (isLOOPAES(cd->type))
		return cd->u.loopaes.cipher_spec;
	else if (isBITLK(cd->type))
		return cd->u.bitlk.cipher_spec;
	else if (!cd->type && !_init_by_name_crypt_none(cd))
		return cd->u.none.cipher_spec;

	return NULL;
}